Java tutorial
/** * Copyright ?? 2013 Universidad Icesi * * This file is part of SongStock. * * SongStock 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. * * SongStock 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 SongStock. If not, see <http://www.gnu.org/licenses/>. **/ package co.shift.pcs.basic.web.client; import com.vaadin.annotations.AutoGenerated; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.CustomComponent; /** * Content panel component. * @author Andr??s Paz * */ public class ContentPanel extends CustomComponent { /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":true,"snappingDistance":10} */ @AutoGenerated private AbsoluteLayout mainLayout; private static final long serialVersionUID = 1L; /** * The constructor should first build the main layout, set the * composition root and then do any custom initialization. * * The constructor will not be automatically regenerated by the * visual editor. */ public ContentPanel() { buildMainLayout(); setCompositionRoot(mainLayout); // User code } /*** * Removes all components and adds the component to the content panel. * @param component The component to be added. */ public void setContent(CustomComponent component) { removeContent(); this.mainLayout.addComponent(component); } /*** * Removes all components and adds the component to the content panel at a given position. * @param component The component to be added. * @param cssPosition The component's position in CSS format. */ public void setContent(CustomComponent component, String cssPosition) { removeContent(); this.mainLayout.addComponent(component, cssPosition); } /** * Removes all components. */ public void removeContent() { mainLayout.removeAllComponents(); } @AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("1024px"); mainLayout.setHeight("500px"); // top-level component properties setWidth("1024px"); setHeight("500px"); return mainLayout; } }