blob: c567a9d880dd07a80c436ac21ca069862be9dfd6 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.vaaclipse.addons.softwarefactory.welcome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
@SuppressWarnings("restriction")
public class WelcomeView {
private Label label;
@Inject
public WelcomeView(VerticalLayout parent, IEclipseContext context,
MApplication app) {
parent.addStyleName("os-welcome");
label = new Label("", ContentMode.HTML);
label.setSizeFull();
parent.addComponent(label);
parent.setMargin(true);
label.setValue(readHTML());
}
private String readHTML() {
URL url = getClass().getResource("Welcome.html");
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
url.openStream()));
StringBuilder builder = new StringBuilder();
while (reader.ready()) {
builder.append(reader.readLine());
builder.append("\n");
}
reader.close();
return builder.toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}