/*
* Copyright 2009 IT Mill Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.itmill.toolkit.demo.featurebrowser;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.GridLayout;
import com.itmill.toolkit.ui.HorizontalLayout;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.TabSheet;
import com.itmill.toolkit.ui.VerticalLayout;
/**
* A few examples of layout possibilities.
*
* @author IT Mill Ltd.
*/
public class LayoutExample extends CustomComponent {
public LayoutExample() {
final VerticalLayout main = new VerticalLayout();
main.setMargin(true);
setCompositionRoot(main);
final GridLayout g = new GridLayout(2, 5);
g.setWidth("100%");
main.addComponent(g);
// panel
Panel p = new Panel("This is a normal panel");
Label l = new Label("A normal panel.");
p.addComponent(l);
g.addComponent(p);
// lightpanel
p = new Panel("This is a light panel");
p.setStyleName(Panel.STYLE_LIGHT);
l = new Label("A light-style panel.");
p.addComponent(l);
g.addComponent(p);
TabSheet ts = new TabSheet();
g.addComponent(ts, 0, 1, 1, 1);
VerticalLayout ol = new VerticalLayout();
ol.setMargin(true);
ol.addComponent(new Label("Component 1"));
ol.addComponent(new Label("Component 2"));
ol.addComponent(new Label("Component 3"));
ts.addTab(ol, "Vertical OrderedLayout", null);
HorizontalLayout hl = new HorizontalLayout();
hl.setMargin(true);
hl.addComponent(new Label("Component 1"));
hl.addComponent(new Label("Component 2"));
hl.addComponent(new Label("Component 3"));
ts.addTab(hl, "Horizontal OrderedLayout", null);
final GridLayout gl = new GridLayout(3, 3);
gl.setMargin(true);
gl.addComponent(new Label("Component 1.1"));
gl.addComponent(new Label("Component 1.2"));
gl.addComponent(new Label("Component 1.3"));
gl.addComponent(new Label("Component 2.2"), 1, 1);
gl.addComponent(new Label("Component 3.1"), 0, 2);
gl.addComponent(new Label("Component 3.3"), 2, 2);
ts.addTab(gl, "GridLayout", null);
/*- TODO spitpanel removed for now - do we need it here?
ts = new TabSheet();
ts.setHeight(150);
g.addComponent(ts, 0, 2, 1, 2);
SplitPanel sp = new SplitPanel();
sp.addComponent(new Label("Component 1"));
sp.addComponent(new Label("Component 2"));
ts.addTab(sp, "Vertical SplitPanel", null);
sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
sp.addComponent(new Label("Component 1"));
sp.addComponent(new Label("Component 2"));
ts.addTab(sp, "Horizontal SplitPanel", null);
-*/
}
}
|