List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java
private void generalInfoLayout() { generalGroup = new VerticalComponentGroup(); generalGroup.setSizeUndefined();/*from w ww . j a va 2s. c o m*/ addTab(generalGroup, "", FontAwesome.CHILD); peopleIdType = new OptionGroup("", new PeopleIdType()); peopleIdType.setItemCaptionPropertyId("name"); peopleIdType.setImmediate(true); peopleIdType.setRequired(true); peopleIdType.setNullSelectionAllowed(false); peopleIdType.setWidth("-1px"); peopleIdType.setHeight("-1px"); generalGroup.addComponent(peopleIdType); peopleId = new TextField(""); peopleId.setInputPrompt(""); peopleId.setImmediate(false); peopleId.setRequired(true); peopleId.setWidth("-1px"); peopleId.setHeight("-1px"); peopleId.setNullRepresentation(""); peopleId.addValidator( new StringLengthValidator("?", 13, 20, false)); peopleId.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { if (event.getText() != null) { if (event.getText().length() >= 13) { pSqlContainer.addContainerFilter(new Equal(PersonnelSchema.PEOPLE_ID, event.getText())); if (pSqlContainer.size() > 0) { disableDuplicatePeopleIdForm(); Notification.show( "?? ??", Type.WARNING_MESSAGE); } else { enableDuplicatePeopleIdForm(); } pSqlContainer.removeAllContainerFilters(); } } } }); generalGroup.addComponent(peopleId); prename = new NativeSelect("", new Prename()); //prename.setInputPrompt("??"); prename.setItemCaptionPropertyId("name"); prename.setImmediate(true); prename.setNullSelectionAllowed(false); prename.setRequired(true); prename.setWidth("-1px"); prename.setHeight("-1px"); //prename.setFilteringMode(FilteringMode.CONTAINS); generalGroup.addComponent(prename); firstname = new TextField(""); firstname.setInputPrompt(""); firstname.setImmediate(false); firstname.setRequired(true); firstname.setWidth("-1px"); firstname.setHeight("-1px"); firstname.setNullRepresentation(""); generalGroup.addComponent(firstname); lastname = new TextField("?"); lastname.setInputPrompt("?"); lastname.setImmediate(false); lastname.setRequired(true); lastname.setWidth("-1px"); lastname.setHeight("-1px"); lastname.setNullRepresentation(""); generalGroup.addComponent(lastname); firstnameNd = new TextField("?"); firstnameNd.setInputPrompt("?"); firstnameNd.setImmediate(false); firstnameNd.setWidth("-1px"); firstnameNd.setHeight("-1px"); firstnameNd.setNullRepresentation(""); generalGroup.addComponent(firstnameNd); lastnameNd = new TextField("??"); lastnameNd.setInputPrompt("??"); lastnameNd.setImmediate(false); lastnameNd.setWidth("-1px"); lastnameNd.setHeight("-1px"); lastnameNd.setNullRepresentation(""); generalGroup.addComponent(lastnameNd); firstnameRd = new TextField(""); firstnameRd.setInputPrompt(""); firstnameRd.setImmediate(false); firstnameRd.setWidth("-1px"); firstnameRd.setHeight("-1px"); firstnameRd.setNullRepresentation(""); generalGroup.addComponent(firstnameRd); lastnameRd = new TextField("?"); lastnameRd.setInputPrompt("?"); lastnameRd.setImmediate(false); lastnameRd.setWidth("-1px"); lastnameRd.setHeight("-1px"); lastnameRd.setNullRepresentation(""); generalGroup.addComponent(lastnameRd); nickname = new TextField(""); nickname.setInputPrompt(""); nickname.setImmediate(false); nickname.setWidth("-1px"); nickname.setHeight("-1px"); nickname.setNullRepresentation(""); generalGroup.addComponent(nickname); gender = new OptionGroup("", new Gender()); gender.setItemCaptionPropertyId("name"); gender.setImmediate(true); gender.setNullSelectionAllowed(false); gender.setRequired(true); gender.setWidth("-1px"); gender.setHeight("-1px"); generalGroup.addComponent(gender); religion = new NativeSelect("", new Religion()); //religion.setInputPrompt("??"); religion.setItemCaptionPropertyId("name"); religion.setImmediate(true); religion.setNullSelectionAllowed(false); religion.setRequired(true); religion.setWidth("-1px"); religion.setHeight("-1px"); //religion.setFilteringMode(FilteringMode.CONTAINS); generalGroup.addComponent(religion); race = new NativeSelect("", new Race()); //race.setInputPrompt("??"); race.setItemCaptionPropertyId("name"); race.setImmediate(true); race.setNullSelectionAllowed(false); race.setRequired(true); race.setWidth("-1px"); race.setHeight("-1px"); //race.setFilteringMode(FilteringMode.CONTAINS); generalGroup.addComponent(race); nationality = new NativeSelect("?", new Nationality()); //nationality.setInputPrompt("??"); nationality.setItemCaptionPropertyId("name"); nationality.setImmediate(true); nationality.setNullSelectionAllowed(false); nationality.setRequired(true); nationality.setWidth("-1px"); nationality.setHeight("-1px"); //nationality.setFilteringMode(FilteringMode.CONTAINS); generalGroup.addComponent(nationality); maritalStatus = new NativeSelect("", new MaritalStatus()); //maritalStatus.setInputPrompt("??"); maritalStatus.setItemCaptionPropertyId("name"); maritalStatus.setImmediate(true); maritalStatus.setNullSelectionAllowed(false); maritalStatus.setRequired(true); maritalStatus.setWidth("-1px"); maritalStatus.setHeight("-1px"); //maritalStatus.setFilteringMode(FilteringMode.CONTAINS); generalGroup.addComponent(maritalStatus); aliveStatus = new NativeSelect("?", new AliveStatus()); //aliveStatus.setInputPrompt("??"); aliveStatus.setItemCaptionPropertyId("name"); aliveStatus.setImmediate(true); aliveStatus.setNullSelectionAllowed(false); aliveStatus.setRequired(true); aliveStatus.setWidth("-1px"); aliveStatus.setHeight("-1px"); //aliveStatus.setFilteringMode(FilteringMode.CONTAINS); aliveStatus.setVisible(false); generalGroup.addComponent(aliveStatus); birthDate = new PopupDateField(" ?"); birthDate.setInputPrompt("//"); birthDate.setImmediate(false); birthDate.setRequired(true); birthDate.setWidth("-1px"); birthDate.setHeight("-1px"); birthDate.setDateFormat("dd/MM/yyyy"); birthDate.setLocale(new Locale("th", "TH")); generalGroup.addComponent(birthDate); blood = new NativeSelect("", new Blood()); //blood.setInputPrompt("??"); blood.setItemCaptionPropertyId("name"); blood.setImmediate(true); blood.setNullSelectionAllowed(false); blood.setRequired(true); blood.setWidth("-1px"); blood.setHeight("-1px"); //blood.setFilteringMode(FilteringMode.CONTAINS); generalGroup.addComponent(blood); height = new NumberField(""); height.setInputPrompt(""); height.setImmediate(false); height.setWidth("-1px"); height.setHeight("-1px"); height.setNullRepresentation(""); generalGroup.addComponent(height); weight = new NumberField("?"); weight.setInputPrompt("?"); weight.setImmediate(false); weight.setWidth("-1px"); weight.setHeight("-1px"); weight.setNullRepresentation(""); generalGroup.addComponent(weight); congenitalDisease = new TextField(""); congenitalDisease.setInputPrompt(""); congenitalDisease.setImmediate(false); congenitalDisease.setWidth("-1px"); congenitalDisease.setHeight("-1px"); congenitalDisease.setNullRepresentation(""); generalGroup.addComponent(congenitalDisease); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); generalGroup.addComponent(buttonLayout); workNext = new Button(FontAwesome.ARROW_RIGHT); workNext.setWidth("100%"); workNext.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { setSelectedTab(workGroup); } }); buttonLayout.addComponent(workNext); }
From source file:com.invient.vaadin.InvientChartsDemoWin.java
License:Apache License
public InvientChartsDemoWin() { VerticalLayout mainLayout = new VerticalLayout(); setContent(mainLayout);/*from ww w . ja v a 2s.c om*/ setSizeFull(); mainLayout.setSizeFull(); setCaption("Invient Charts"); HorizontalLayout infoBar = new HorizontalLayout(); mainLayout.addComponent(infoBar); infoBar.setHeight("50px"); infoBar.setWidth("100%"); Label lblAppTitle = new Label("Demo Gallery for Invient Charts"); lblAppTitle.setSizeFull(); lblAppTitle.setStyleName("v-label-app-title"); infoBar.addComponent(lblAppTitle); mainSplit = new HorizontalSplitPanel(); mainSplit.setSizeFull(); mainLayout.addComponent(mainSplit); mainLayout.setExpandRatio(mainSplit, 1); leftLayout = new VerticalLayout(); leftLayout.setSpacing(true); mainSplit.setFirstComponent(leftLayout); rightLayout = new VerticalLayout(); rightLayout.setSpacing(true); rightLayout.setMargin(true); mainSplit.setSecondComponent(rightLayout); mainSplit.setSplitPosition(200, Sizeable.UNITS_PIXELS); navTree = createChartsTree(); leftLayout.addComponent(navTree); eventLog.setReadOnly(true); eventLog.setStyleName("v-textarea-chart-events-log"); eventLog.setSizeFull(); eventLog.setHeight("200px"); setTheme("chartdemo"); }
From source file:com.jain.addon.action.confirm.ConfirmWindow.java
License:Apache License
@JNIComponentInit public void init() { setModal(true);/*from w w w .j a v a 2 s .c om*/ setWidth("25%"); VerticalLayout layout = new VerticalLayout(); setContent(layout); layout.setWidth("100%"); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName(JNStyleConstants.J_ALTERNATE_VIEW); JNConfirm confirm = action.getConfirm(); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSpacing(true); hLayout.setWidth("100%"); findNAddIcon(confirm, hLayout); Label label = new Label(confirm.message()); label.setContentMode(confirm.mode()); hLayout.addComponent(label); hLayout.setExpandRatio(label, 2); layout.addComponent(hLayout); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); ActionMenuBar<ConfirmWindow> menuBar = new ActionMenuBar<ConfirmWindow>(null, this); layout.addComponent(menuBar); layout.setExpandRatio(menuBar, 2); layout.setComponentAlignment(menuBar, Alignment.MIDDLE_CENTER); }
From source file:com.jain.addon.action.confirm.ConfirmWindow.java
License:Apache License
/** * //from w w w. java 2 s.c o m * @param confirm * @param layout */ private void findNAddIcon(JNConfirm confirm, HorizontalLayout layout) { if (StringHelper.isNotEmptyWithTrim(confirm.icon())) { String iconPath = PropertyReader.instance().getProperty(confirm.icon()); if (StringHelper.isNotEmptyWithTrim(iconPath)) { Label label = new Label(); ThemeResource icon = new ThemeResource(iconPath); label.setIcon(icon); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); } } }
From source file:com.jain.addon.web.layout.JainLayout.java
License:Apache License
/** * Add a column with column span for current component * @param @link Component}// ww w .j a v a 2 s.c o m * @param colSpan */ public void addComponent(Component component, int colSpan) { HorizontalLayout hLayout = getHLayout(colSpan); hLayout.addComponent(component); hLayout.setExpandRatio(component, 1.0f); }
From source file:com.jain.common.header.Header.java
License:Apache License
private void addHeaderMenu() { HorizontalLayout layout = new HorizontalLayout(); layout.setStyleName(ApplicationTheme.HEADER_SEGMENT); int i = 0;/*from ww w .j av a2s . c om*/ Button button = null; for (JHeaderItem item : JHeaderItem.values()) { button = new Button(item.getDisplayName(), this); layout.addComponent(button); if (i == 0) { current = button; current.setStyleName(ApplicationTheme.FIRST); current.addStyleName(ApplicationTheme.SELECTED); i++; } } button.setStyleName(ApplicationTheme.LAST); addComponent(layout); setComponentAlignment(layout, Alignment.MIDDLE_LEFT); setExpandRatio(layout, 1); }
From source file:com.jain.common.header.WelcomeBar.java
License:Apache License
private void createRightActions() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/* w ww . j a va2 s .c om*/ layout.setMargin(new MarginInfo(false, true, false, true)); I18NSelector localSelection = new I18NSelector(); localSelection.setInputPrompt("module.locale.name"); for (JLocale locale : JLocale.values()) { localSelection.addItem(locale.getLocale(), locale.getDisplayName()); } layout.addComponent(localSelection); ActionBar<WelcomeBar> hLayout = new ActionBar<WelcomeBar>(currentUser, this); layout.addComponent(hLayout); addComponent(layout); setComponentAlignment(layout, Alignment.TOP_RIGHT); }
From source file:com.javalego.ui.vaadin.component.util.MessageBox.java
License:Apache License
/** * Similar to// ww w .j av a 2s .c om * {@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.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * ?/*from w w w.j a v a2s .c o m*/ * @param mainLayout */ private void createlStartSetting(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label("??"); caption.setWidth("-1px"); caption.setDescription( "<B>????</B>"); layout.addComponent(caption); startSettingOption = new OptionGroup(); startSettingOption.addItem(true); startSettingOption.addItem(false); startSettingOption.setItemCaption(true, "?"); startSettingOption.setItemCaption(false, ""); startSettingOption.setImmediate(true); startSettingOption.setValue(false); startSettingOption.setReadOnly(true); startSettingOption.setDescription( "<B>????</B>"); startSettingOption.setNullSelectionAllowed(false); startSettingOption.addStyleName("twocol200"); startSettingOption.addStyleName("myopacity"); layout.addComponent(startSettingOption); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * (????)//from ww w . j a va2s.co m * @param mainLayout */ private void createlDaysOfWeekType(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label(""); caption.setWidth("-1px"); caption.setDescription("<B>?</B>"); layout.addComponent(caption); dayOfWeekTypeSelector = new ComboBox(); dayOfWeekTypeSelector.addItem("weekday"); dayOfWeekTypeSelector.setItemCaption("weekday", ""); dayOfWeekTypeSelector.addItem("weekend"); dayOfWeekTypeSelector.setItemCaption("weekend", ""); dayOfWeekTypeSelector.addItem("custom"); dayOfWeekTypeSelector.setItemCaption("custom", ""); dayOfWeekTypeSelector.setWidth("200px"); dayOfWeekTypeSelector.setImmediate(true); dayOfWeekTypeSelector.setReadOnly(true); dayOfWeekTypeSelector.setDescription("<B>?</B>"); dayOfWeekTypeSelector.setNullSelectionAllowed(false); dayOfWeekTypeSelector.addListener(this); layout.addComponent(dayOfWeekTypeSelector); }