Java tutorial
/** * This file is part of mycollab-web-community. * * mycollab-web-community is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * mycollab-web-community is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with mycollab-web-community. If not, see <http://www.gnu.org/licenses/>. */ package com.esofthead.mycollab.community.shell.view.components; import com.esofthead.mycollab.core.MyCollabVersion; import com.esofthead.mycollab.core.utils.FileUtils; import com.esofthead.mycollab.shell.view.components.AbstractAboutWindow; import com.esofthead.mycollab.vaadin.mvp.ViewComponent; import com.esofthead.mycollab.vaadin.ui.AssetResource; import com.esofthead.mycollab.vaadin.ui.ELabel; import com.esofthead.mycollab.vaadin.web.ui.UIConstants; import com.esofthead.mycollab.vaadin.web.ui.WebResourceIds; import com.hp.gagawa.java.elements.A; import com.hp.gagawa.java.elements.Div; import com.hp.gagawa.java.elements.Text; import com.vaadin.server.Page; import com.vaadin.server.WebBrowser; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Alignment; import com.vaadin.ui.Image; import com.vaadin.ui.Label; import org.vaadin.viritin.layouts.MHorizontalLayout; import org.vaadin.viritin.layouts.MVerticalLayout; import java.util.Calendar; import java.util.GregorianCalendar; /** * @author MyCollab Ltd. * @since 5.0.5 */ @ViewComponent public class AboutWindow extends AbstractAboutWindow { public AboutWindow() { MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth(); this.setContent(content); Image about = new Image("", new AssetResource(WebResourceIds._about)); MVerticalLayout rightPanel = new MVerticalLayout(); ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", MyCollabVersion.getVersion())); Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"))); Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath()); WebBrowser browser = Page.getCurrent().getWebBrowser(); Label osLbl = new Label( String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())); osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP); Div licenseDiv = new Div().appendChild(new Text("Powered by: ")) .appendChild(new A("https://www.mycollab.com").appendText("MyCollab")) .appendChild(new Text(". Open source under GPL license")); Label licenseLbl = new Label(licenseDiv.write(), ContentMode.HTML); Label copyRightLbl = new Label(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011", new GregorianCalendar().get(Calendar.YEAR) + ""), ContentMode.HTML); rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl) .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT); content.with(about, rightPanel).expand(rightPanel); } }