List of usage examples for com.vaadin.ui Component setSizeUndefined
public void setSizeUndefined();
From source file:com.github.mjvesa.herd.wordset.VaadinWordSet.java
License:Apache License
@Override public Word[] getWords() { return new Word[] { new BaseWord("new-button", "", Word.POSTPONED) { private static final long serialVersionUID = -2492817908731559368L; @Override//ww w.j ava2 s . c om public void execute(final Interpreter interpreter) { Button b = new Button("", new Button.ClickListener() { private static final long serialVersionUID = -4622489800920283752L; @Override public void buttonClick(ClickEvent event) { Button b = event.getButton(); Word command = (Word) b.getData(); if (command != null) { interpreter.execute(command); } } }); interpreter.pushData(b); } }, new BaseWord("set-click-listener", "", Word.POSTPONED) { private static final long serialVersionUID = 5749856686458297558L; @Override public void execute(Interpreter interpreter) { Object o = interpreter.popData(); Button b = (Button) interpreter.popData(); b.setData(o); interpreter.pushData(b); } }, new BaseWord("new-hl", "", Word.POSTPONED) { private static final long serialVersionUID = 8813556668649386248L; @Override public void execute(Interpreter interpreter) { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); interpreter.pushData(hl); } }, new BaseWord("new-vl", "", Word.POSTPONED) { private static final long serialVersionUID = -1848213448504804229L; @Override public void execute(Interpreter interpreter) { VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true); interpreter.pushData(vl); } }, new BaseWord("new-gl", "( x y - gl )", Word.POSTPONED) { private static final long serialVersionUID = 4079634885691605257L; @Override public void execute(Interpreter interpreter) { Integer height = (Integer) interpreter.popData(); Integer width = (Integer) interpreter.popData(); interpreter.pushData(new GridLayout(width, height)); } }, new BaseWord("gl-new-line", "", Word.POSTPONED) { private static final long serialVersionUID = 975877390052961807L; @Override public void execute(Interpreter interpreter) { ((GridLayout) interpreter.peekData()).newLine(); } }, new BaseWord("new-window", "", Word.POSTPONED) { private static final long serialVersionUID = -6887364362728545090L; @Override public void execute(Interpreter interpreter) { Window w = new Window(); VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true); w.setContent(vl); interpreter.pushData(w); interpreter.pushData(vl); } }, new BaseWord("main-panel", "", Word.POSTPONED) { private static final long serialVersionUID = -8622281600566696475L; @Override public void execute(Interpreter interpreter) { interpreter.pushData(interpreter.getMainPanel()); } }, new BaseWord("add-window", "", Word.POSTPONED) { private static final long serialVersionUID = 7106029415576813922L; @Override public void execute(Interpreter interpreter) { Window w = (Window) interpreter.popData(); interpreter.getView().getUI().addWindow(w); } }, new BaseWord("add-component", "", Word.POSTPONED) { private static final long serialVersionUID = 5640824046985354091L; @Override public void execute(Interpreter interpreter) { Component comp = (Component) interpreter.popData(); ComponentContainer cc = (ComponentContainer) interpreter.popData(); cc.addComponent(comp); interpreter.pushData(cc); } }, new BaseWord("set-caption", "", Word.POSTPONED) { private static final long serialVersionUID = 5497598050469462487L; @Override public void execute(Interpreter interpreter) { String s = (String) interpreter.popData(); Component c = (Component) interpreter.popData(); c.setCaption(s); interpreter.pushData(c); } }, new BaseWord("set-value", "", Word.POSTPONED) { private static final long serialVersionUID = -1769743552659215058L; @Override public void execute(Interpreter interpreter) { Object o = interpreter.popData(); Property p = (Property) interpreter.popData(); p.setValue(o); interpreter.pushData(p); } }, new BaseWord("get-value", "", Word.POSTPONED) { private static final long serialVersionUID = 8445550546521886374L; @Override public void execute(Interpreter interpreter) { Field f = (Field) interpreter.popData(); interpreter.pushData(f); interpreter.pushData(f.getValue()); } }, new BaseWord("set-size-full", "", Word.POSTPONED) { private static final long serialVersionUID = -1206491811133054467L; @Override public void execute(Interpreter interpreter) { Component comp = (Component) interpreter.popData(); comp.setSizeFull(); interpreter.pushData(comp); } }, new BaseWord("set-size-undefined", "", Word.POSTPONED) { private static final long serialVersionUID = -3450618729379622987L; @Override public void execute(Interpreter interpreter) { Component comp = (Component) interpreter.popData(); comp.setSizeUndefined(); interpreter.pushData(comp); } }, new BaseWord("set-height", "", Word.POSTPONED) { private static final long serialVersionUID = -8426734568403715950L; @Override public void execute(Interpreter interpreter) { String str = (String) interpreter.popData(); Component comp = (Component) interpreter.popData(); comp.setHeight(str); interpreter.pushData(comp); } }, new BaseWord("set-width", "", Word.POSTPONED) { private static final long serialVersionUID = -4558264143049463814L; @Override public void execute(Interpreter interpreter) { String str = (String) interpreter.popData(); Component comp = (Component) interpreter.popData(); comp.setWidth(str); interpreter.pushData(comp); } }, new BaseWord("clear-container", "", Word.POSTPONED) { private static final long serialVersionUID = 1070175466682034329L; @Override public void execute(Interpreter interpreter) { ComponentContainer cc = (ComponentContainer) interpreter.popData(); cc.removeAllComponents(); } }, new BaseWord("new-check-box", "", Word.POSTPONED) { private static final long serialVersionUID = 4018632924389912599L; @Override public void execute(Interpreter interpreter) { interpreter.pushData(new CheckBox()); } }, new BaseWord("new-date-field", "", Word.POSTPONED) { private static final long serialVersionUID = 6313296566085274642L; @Override public void execute(final Interpreter interpreter) { interpreter.pushData(new DateField()); final String dfCommand = (String) interpreter.popData(); DateField df = new DateField(); df.setImmediate(true); df.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 1472139878970514093L; public void valueChange(ValueChangeEvent event) { interpreter.pushData(event.getProperty().getValue()); interpreter.interpret(dfCommand); } }); interpreter.pushData(df); } }, new BaseWord("new-label", "", Word.POSTPONED) { private static final long serialVersionUID = -2825285195439247251L; @Override public void execute(Interpreter interpreter) { interpreter.pushData(new Label()); } }, new BaseWord("new-text-field", "", Word.POSTPONED) { private static final long serialVersionUID = -1064489458253275380L; @Override public void execute(final Interpreter interpreter) { final String tfCommand = interpreter.getNextNonNopWord(); TextField tf = new TextField(); tf.setCaption((String) interpreter.popData()); tf.setValue(""); tf.setImmediate(true); tf.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 4325104922208051065L; public void valueChange(ValueChangeEvent event) { interpreter.pushData(event.getProperty().getValue()); interpreter.interpret(tfCommand); } }); interpreter.pushData(tf); } }, new BaseWord("new-table", "", Word.POSTPONED) { private static final long serialVersionUID = -5052653341575232035L; @Override public void execute(final Interpreter interpreter) { final String tableCommand = interpreter.getParser().getNextWord(); Table table = new Table(); table.setCaption((String) interpreter.popData()); table.setImmediate(true); table.setSelectable(true); table.addItemClickListener(new ItemClickListener() { /** * */ private static final long serialVersionUID = 3585546076571010729L; public void itemClick(ItemClickEvent event) { interpreter.pushData(event.getItem()); interpreter.execute(interpreter.getDictionary().get(tableCommand)); } }); interpreter.pushData(table); } }, new BaseWord("new-combo-box", "", Word.POSTPONED) { private static final long serialVersionUID = 3881577354424928897L; @Override public void execute(final Interpreter interpreter) { final String newItemCommand = interpreter.getParser().getNextWord(); final String itemSelectedCommand = interpreter.getParser().getNextWord(); final ComboBox cb = new ComboBox(); String str = (String) interpreter.popData(); cb.setNullSelectionAllowed(false); cb.setCaption(str); cb.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM); cb.setNewItemsAllowed(true); cb.setNewItemHandler(new NewItemHandler() { /** * */ private static final long serialVersionUID = 3340658590351611289L; public void addNewItem(String newItemCaption) { cb.setImmediate(false); interpreter.pushData(newItemCaption); interpreter.interpret(newItemCommand); cb.setImmediate(true); } }); cb.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 2706579869793251379L; public void valueChange(ValueChangeEvent event) { interpreter.pushData( cb.getContainerDataSource().getItem(event.getProperty().getValue())); interpreter.interpret(itemSelectedCommand); } }); cb.setImmediate(true); interpreter.pushData(cb); } }, new BaseWord("new-select", "", Word.POSTPONED) { private static final long serialVersionUID = -6142351970812196488L; @Override public void execute(final Interpreter interpreter) { final String selCommand = interpreter.getParser().getNextWord(); final ComboBox sel = new ComboBox(); sel.setCaption((String) interpreter.popData()); sel.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM); sel.setNullSelectionAllowed(false); sel.setImmediate(true); sel.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = -7705548618092166199L; public void valueChange(ValueChangeEvent event) { Item item = sel.getContainerDataSource().getItem(event.getProperty().getValue()); interpreter.pushData(item); interpreter.interpret(selCommand); } }); interpreter.pushData(sel); } }, new BaseWord("new-list-select", "", Word.POSTPONED) { private static final long serialVersionUID = 8686093227035249035L; @Override public void execute(final Interpreter interpreter) { final String lselCommand = interpreter.getParser().getNextWord(); final ListSelect lsel = new ListSelect(); lsel.setCaption((String) interpreter.popData()); lsel.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM); lsel.setNullSelectionAllowed(false); lsel.setImmediate(true); lsel.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = -5523488417834167806L; public void valueChange(ValueChangeEvent event) { Item item = lsel.getContainerDataSource().getItem(event.getProperty().getValue()); interpreter.pushData(item); interpreter.interpret(lselCommand); } }); interpreter.pushData(lsel); } }, new BaseWord("set-container-data-source", "", Word.POSTPONED) { private static final long serialVersionUID = 8644721936358613031L; @Override public void execute(Interpreter interpreter) { Container cont = (Container) interpreter.popData(); AbstractSelect as = (AbstractSelect) interpreter.popData(); as.setContainerDataSource(cont); interpreter.pushData(as); } }, new BaseWord("set-column-headers", "", Word.POSTPONED) { private static final long serialVersionUID = -7296881714369214846L; @Override public void execute(Interpreter interpreter) { Table table = (Table) interpreter.popData(); table.setColumnHeaders((String[]) getArrayFromList(interpreter, new String[0])); } }, new BaseWord("set-visible-columns", "", Word.POSTPONED) { private static final long serialVersionUID = 5674765074478598320L; @Override public void execute(Interpreter interpreter) { Table table = (Table) interpreter.popData(); table.setVisibleColumns((String[]) getArrayFromList(interpreter, new String[0])); } } }; }
From source file:com.google.code.vaadin.internal.preconfigured.VaadinComponentsInjector.java
License:Apache License
private void configureComponentApi(Component component, Preconfigured preconfigured) { component.setEnabled(preconfigured.enabled()); component.setVisible(preconfigured.visible()); component.setReadOnly(preconfigured.readOnly()); String[] styleName = preconfigured.styleName(); if (styleName.length > 0) { for (String style : styleName) { component.addStyleName(style); }/*w w w. ja v a 2 s . c o m*/ } configureLocalization(component, preconfigured); String id = preconfigured.id(); if (!id.isEmpty()) { component.setId(id); } if (preconfigured.sizeFull()) { component.setSizeFull(); } else if (preconfigured.sizeUndefined()) { component.setSizeUndefined(); } else { float width = preconfigured.width(); if (width > -1.0f) { Sizeable.Unit widthUnits = preconfigured.widthUnits(); component.setWidth(width, widthUnits); } float height = preconfigured.height(); if (height > -1.0f) { Sizeable.Unit heightUnits = preconfigured.heightUnits(); component.setHeight(height, heightUnits); } } }
From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java
private void showComponent(final Component c, final String name) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();/*from ww w . ja v a2s . co m*/ layout.setMargin(true); final Window w = new Window(name, layout); w.addStyleName("dropdisplaywindow"); w.setSizeUndefined(); w.setResizable(false); c.setSizeUndefined(); layout.addComponent(c); UI.getCurrent().addWindow(w); }
From source file:com.javalego.ui.vaadin.component.util.MessageBox.java
License:Apache License
/** * Similar to/*w ww.ja va 2s .c o m*/ * {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)} * , but the message component is defined explicitly. The component can be * even a composite of a layout manager and manager further Vaadin * components. * * @param messageComponent * a Vaadin component */ public MessageBox(String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); messageComponent.setSizeUndefined(); // Add Content if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); // Label icon = new Label(); // switch (dialogIcon) { // case QUESTION: // icon.setIcon(FontAwesome.QUESTION); // break; // case INFO: // icon.setIcon(FontAwesome.INFO); // break; // case WARN: // icon.setIcon(FontAwesome.WARNING); // break; // case ERROR: // icon.setIcon(FontAwesome.STOP); // break; // default: // break; // } // mainLayout.addComponent(icon, 0, 0); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setMargin(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { ButtonExt button = new ButtonExt(buttonConfig.getCaption()); // if (buttonConfig.buttonType == ButtonType.YES || buttonConfig.buttonType == ButtonType.OK) { // button.blue(); // } button.addClickListener(new ButtonClickListener(buttonConfig.getButtonType())); buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void addProfileEntry(GridLayout layout, Component name, Component value) { name.addStyleName(ExplorerLayout.STYLE_PROFILE_FIELD); name.setSizeUndefined(); layout.addComponent(name);/*from w w w.j ava 2s.c o m*/ value.setSizeUndefined(); layout.addComponent(value); }
From source file:com.mymita.vaadlets.VaadletsBuilder.java
License:Apache License
private static void setComponentAttributes(final com.vaadin.ui.Component vaadinComponent, final com.mymita.vaadlets.core.Component c) { vaadinComponent.setCaption(c.getCaption()); vaadinComponent.setEnabled(c.isEnabled()); vaadinComponent.setReadOnly(c.isReadonly()); vaadinComponent.setVisible(c.isVisible()); if (c.getHeight() != null) { vaadinComponent.setHeight(c.getHeight()); }// w w w.java 2 s.co m if (c.getWidth() != null) { vaadinComponent.setWidth(c.getWidth()); } if (c.isSizeUndefined() != null && c.isSizeUndefined().booleanValue()) { vaadinComponent.setSizeUndefined(); } if (c.isSizeFull() != null && c.isSizeFull().booleanValue()) { vaadinComponent.setSizeFull(); } }
From source file:com.scsb.crpro.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * /*w w w . j a v a 2 s . c o m*/ * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.scsb.vaadin.composite.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * /*w w w.ja v a 2 s .co m*/ * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("./images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("./images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("./images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("./images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:org.escidoc.browser.ui.dnd.FilesDropBox.java
License:Open Source License
private void showComponent(final Component component, final String name) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();//from www. j av a 2 s . c om layout.setMargin(true); final Window window = new Window(name, layout); window.setSizeUndefined(); component.setSizeUndefined(); window.addComponent(component); getWindow().addWindow(window); }
From source file:org.lunifera.mobile.vaadin.ecview.presentation.internal.NavigationPagePresentation.java
License:Open Source License
/** * Sets the alignment to the component./*from w w w.j a v a2 s.c o m*/ * * @param child * @param yAlignment */ protected void applyAlignment(Component child, YAlignment yAlignment) { if (yAlignment != null) { child.setSizeUndefined(); switch (yAlignment) { case BOTTOM_CENTER: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER); break; case BOTTOM_FILL: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); child.setWidth("100%"); break; case BOTTOM_LEFT: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); break; case BOTTOM_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT); break; case MIDDLE_CENTER: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER); break; case MIDDLE_FILL: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); child.setWidth("100%"); break; case MIDDLE_LEFT: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); break; case MIDDLE_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT); break; case TOP_CENTER: verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); break; case TOP_FILL: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); break; case TOP_LEFT: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); break; case TOP_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); break; case FILL_CENTER: verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); child.setHeight("100%"); break; case FILL_FILL: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); child.setHeight("100%"); break; case FILL_LEFT: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setHeight("100%"); break; case FILL_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); child.setHeight("100%"); break; default: break; } } }