List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminApplicationConfigurationPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override/*from w ww . j av a 2 s. c o m*/ public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); final String pageId = getPageId(parameters); final int pageNr = getPageNr(parameters); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content, ADMIN_APPLICATION_CONFIGURATION); final DataContainer<ApplicationConfiguration, Long> dataContainer = getApplicationManager() .getDataContainer(ApplicationConfiguration.class); final BeanItemContainer<ApplicationConfiguration> politicianDocumentDataSource = new BeanItemContainer<>( ApplicationConfiguration.class, dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationConfiguration_.configurationGroup)); createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE); getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "ApplicationConfiguration", new String[] { "hjid", "configurationGroup", "component", "componentTitle", "configTitle", "configDescription", "componentDescription", "propertyId", "propertyValue" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion", "createdDate", "updatedDate", "propertyId", "componentDescription", "componentTitle" }, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_CONFIGURATION_VIEW_NAME, "hjid"), null, null); if (pageId != null && !pageId.isEmpty()) { final ApplicationConfiguration applicationConfiguration = dataContainer.load(Long.valueOf(pageId)); if (applicationConfiguration != null) { final VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setSizeFull(); final VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setSizeFull(); final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth(ContentSize.FULL_SIZE); content.addComponent(horizontalLayout); horizontalLayout.addComponent(leftLayout); horizontalLayout.addComponent(rightLayout); getFormFactory().addFormPanelTextFields(leftLayout, new BeanItem<>(applicationConfiguration), ApplicationConfiguration.class, Arrays.asList(new String[] { "configurationGroup", "component", "configTitle", "configDescription", "propertyValue", "createdDate", "updatedDate" })); final UpdateApplicationConfigurationRequest request = new UpdateApplicationConfigurationRequest(); request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); request.setApplicationConfigurationId(applicationConfiguration.getHjid()); request.setConfigTitle(applicationConfiguration.getConfigTitle()); request.setConfigDescription(applicationConfiguration.getConfigDescription()); request.setComponentTitle(applicationConfiguration.getConfigTitle()); request.setComponentDescription(applicationConfiguration.getComponentDescription()); request.setPropertyValue(applicationConfiguration.getPropertyValue()); final ClickListener buttonListener = new UpdateApplicationConfigurationClickListener(request, getApplicationManager()); final Panel updateFormPanel = new Panel(); updateFormPanel.setSizeFull(); rightLayout.addComponent(updateFormPanel); final FormLayout updateFormContent = new FormLayout(); updateFormPanel.setContent(updateFormContent); getFormFactory().addRequestInputFormFields(updateFormContent, new BeanItem<>(request), UpdateApplicationConfigurationRequest.class, Arrays.asList(new String[] { "configTitle", "configDescription", "componentTitle", "componentDescription", "propertyValue" }), "Update Configuration", buttonListener); } } getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_CONFIGURATION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminApplicationSessionPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override/* w ww .j a va 2 s. c o m*/ public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); final String pageId = getPageId(parameters); final int pageNr = getPageNr(parameters); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content, ADMIN_APPLICATION_SESSION); final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager() .getDataContainer(ApplicationSession.class); final BeanItemContainer<ApplicationSession> politicianDocumentDataSource = new BeanItemContainer<>( ApplicationSession.class, dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate)); createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE); getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "ApplicationSession", new String[] { "hjid", "createdDate", "sessionType", "userId", "events", "operatingSystem", "locale", "ipInformation", "userAgentInformation", "sessionId" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion", "userAgentInformation", "sessionId", "ipInformation" }, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter(List.class, "page", "events", "actionName") }); if (pageId != null && !pageId.isEmpty()) { final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId)); if (applicationSession != null) { final VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setSizeFull(); final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth(ContentSize.FULL_SIZE); content.addComponent(horizontalLayout); content.setExpandRatio(horizontalLayout, ContentRatio.GRID); getFormFactory().addFormPanelTextFields(horizontalLayout, new BeanItem<>(applicationSession), ApplicationSession.class, Arrays.asList(new String[] { "createdDate", "sessionType", "userId", "sessionId", "operatingSystem", "locale", "ipInformation", "userAgentInformation" })); horizontalLayout.addComponent(rightLayout); horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID); final BeanItemContainer<ApplicationActionEvent> eventsItemContainer = new BeanItemContainer<>( ApplicationActionEvent.class, applicationSession.getEvents()); getGridFactory().createBasicBeanItemGrid(rightLayout, eventsItemContainer, "ApplicationActionEvent", new String[] { "hjid", "createdDate", "eventGroup", "actionName", "applicationOperation", "page", "pageMode", "elementId", "errorMessage", "applicationMessage", "modelObjectVersion" }, new String[] { "hjid", "modelObjectId", "modelObjectVersion", "userId", "sessionId" }, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null); } } getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java
License:Apache License
/** * Creates the basic layout with panel and footer. * * @param panelName//from w ww . j a va 2 s. co m * the panel name */ protected final void createBasicLayoutWithPanelAndFooter(final String panelName) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); final VerticalLayout pageModeContent = new VerticalLayout(); pageModeContent.setMargin(true); pageModeContent.setSpacing(true); pageModeContent.setWidth(100, Unit.PERCENTAGE); pageModeContent.setHeight(100, Unit.PERCENTAGE); layout.addComponent(pageModeContent); final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png"); final Image ciaLogoImage = new Image(null, ciaLogoResource); final HorizontalLayout topHeader = new HorizontalLayout(); topHeader.addComponent(ciaLogoImage); ciaLogoImage.setWidth("75px"); ciaLogoImage.setHeight("75px"); topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL); final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout(); final Label titleLabel = new Label("Citizen Intelligence Agency"); titleLabel.setStyleName("Header"); topTitleHeadertPanel.addComponent(titleLabel); topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final Label sloganLabel = new Label("// Tracking politicians like bugs!"); sloganLabel.setStyleName("HeaderSlogan"); topTitleHeadertPanel.addComponent(sloganLabel); topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT); topHeader.addComponent(topTitleHeadertPanel); topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID); topHeaderRightPanel.removeAllComponents(); topHeader.addComponent(topHeaderRightPanel); topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT); topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink(); topHeaderRightPanel.addComponent(userHomePageLink); topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT); final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT); final LogoutRequest logoutRequest = new LogoutRequest(); logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager)); topHeaderRightPanel.addComponent(logoutButton); topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT); } else { final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink(); topHeaderRightPanel.addComponent(createRegisterPageLink); topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT); final Link createLoginPageLink = pageLinkFactory.createLoginPageLink(); topHeaderRightPanel.addComponent(createLoginPageLink); topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT); } topHeaderRightPanel.setWidth("100%"); topHeaderRightPanel.setHeight("60px"); topHeader.setWidth("100%"); topHeader.setHeight("60px"); pageModeContent.addComponent(topHeader); pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER); pageModeContent.addComponent(getBarmenu()); pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER); panel = new Panel(panelName); panel.setSizeFull(); pageModeContent.addComponent(panel); pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE); pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink()); setContent(layout); setWidth(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); setSizeFull(); }
From source file:com.haulmont.cuba.web.app.folders.CubaFoldersPane.java
License:Apache License
protected Component addFoldersLabel(AbstractLayout layout, Label label) { HorizontalLayout l = new HorizontalLayout(); l.setMargin(new MarginInfo(false, true, false, true)); l.addComponent(label);/*from w ww . ja v a2s . c om*/ l.setWidth("100%"); layout.addComponent(l); return l; }
From source file:com.haulmont.cuba.web.exception.ExceptionDialog.java
License:Apache License
public ExceptionDialog(Throwable throwable, @Nullable String caption, @Nullable String message) { final AppUI ui = AppUI.getCurrent(); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction( "closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); addActionHandler(new com.vaadin.event.Action.Handler() { @Override// www . j av a 2 s . c o m public com.vaadin.event.Action[] getActions(Object target, Object sender) { return new com.vaadin.event.Action[] { closeShortcutAction }; } @Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (Objects.equals(action, closeShortcutAction)) { close(); } } }); setCaption(caption != null ? caption : messages.getMainMessage("exceptionDialog.caption")); ThemeConstants theme = ui.getApp().getThemeConstants(); setWidth(theme.get("cuba.web.ExceptionDialog.width")); center(); final String text = message != null ? message : getText(throwable); Throwable exception = removeRemoteException(throwable); final String stackTrace = getStackTrace(exception); mainLayout = new VerticalLayout(); mainLayout.setSpacing(true); TextArea textArea = new TextArea(); textArea.setHeight(theme.get("cuba.web.ExceptionDialog.textArea.height")); textArea.setWidth(100, Unit.PERCENTAGE); boolean showExceptionDetails = userSessionSource.getUserSession() != null && security.isSpecificPermitted("cuba.gui.showExceptionDetails"); if (showExceptionDetails) { textArea.setValue(text); } else { textArea.setValue(messages.getMainMessage("exceptionDialog.contactAdmin")); } textArea.setReadOnly(true); mainLayout.addComponent(textArea); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); buttonsLayout.setWidth("100%"); mainLayout.addComponent(buttonsLayout); Button closeButton = new CubaButton(messages.getMainMessage("exceptionDialog.closeBtn")); closeButton.addClickListener((Button.ClickListener) event -> this.close()); buttonsLayout.addComponent(closeButton); showStackTraceButton = new CubaButton(messages.getMainMessage("exceptionDialog.showStackTrace")); showStackTraceButton .addClickListener((Button.ClickListener) event -> setStackTraceVisible(!isStackTraceVisible)); buttonsLayout.addComponent(showStackTraceButton); showStackTraceButton.setVisible(showExceptionDetails); Label spacer = new Label(); buttonsLayout.addComponent(spacer); buttonsLayout.setExpandRatio(spacer, 1); String cubaLogContentClass = "c-exception-dialog-log-content"; String cubaCopyLogContentClass = cubaLogContentClass + "-" + UUID.randomUUID(); if (browserSupportCopy()) { copyButton = new CubaButton(messages.getMainMessage("exceptionDialog.copyStackTrace")); copyButton.setVisible(false); CubaCopyButtonExtension copyExtension = CubaCopyButtonExtension.copyWith(copyButton, cubaCopyLogContentClass); copyExtension .addCopyListener( event -> Notification.show( messages.getMainMessage(event.isSuccess() ? "exceptionDialog.copingSuccessful" : "exceptionDialog.copingFailed"), Notification.Type.TRAY_NOTIFICATION)); buttonsLayout.addComponent(copyButton); } if (userSessionSource.getUserSession() != null) { if (!StringUtils.isBlank(clientConfig.getSupportEmail())) { Button reportButton = new CubaButton(messages.getMainMessage("exceptionDialog.reportBtn")); reportButton.addClickListener((Button.ClickListener) event -> { sendSupportEmail(text, stackTrace); reportButton.setEnabled(false); }); buttonsLayout.addComponent(reportButton); if (ui.isTestMode()) { reportButton.setCubaId("errorReportButton"); } } } Button logoutButton = new CubaButton(messages.getMainMessage("exceptionDialog.logout")); logoutButton.addClickListener((Button.ClickListener) event -> logoutPrompt()); buttonsLayout.addComponent(logoutButton); stackTraceTextArea = new TextArea(); stackTraceTextArea.setSizeFull(); stackTraceTextArea.setWordwrap(false); stackTraceTextArea.setValue(stackTrace); stackTraceTextArea.setStyleName(cubaLogContentClass); stackTraceTextArea.addStyleName(cubaCopyLogContentClass); stackTraceTextArea.setReadOnly(true); setContent(mainLayout); setResizable(false); if (ui.isTestMode()) { setId(ui.getTestIdManager().getTestId("exceptionDialog")); setCubaId("exceptionDialog"); closeButton.setCubaId("closeButton"); if (copyButton != null) { copyButton.setCubaId("copyStackTraceButton"); } showStackTraceButton.setCubaId("showStackTraceButton"); stackTraceTextArea.setCubaId("stackTraceTextArea"); logoutButton.setCubaId("logoutButton"); } }
From source file:com.haulmont.cuba.web.log.LogWindow.java
License:Apache License
private void initUI() { ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction( "closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); addActionHandler(new com.vaadin.event.Action.Handler() { @Override/* w ww . j a va2 s . c om*/ public com.vaadin.event.Action[] getActions(Object target, Object sender) { return new com.vaadin.event.Action[] { closeShortcutAction }; } @Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (Objects.equals(action, closeShortcutAction)) { close(); } } }); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Panel scrollablePanel = new Panel(); scrollablePanel.setSizeFull(); VerticalLayout scrollContent = new VerticalLayout(); scrollContent.setSizeUndefined(); scrollablePanel.setContent(scrollContent); final Label label = new Label(); label.setContentMode(ContentMode.HTML); label.setValue(writeLog()); label.setSizeUndefined(); label.setStyleName("c-log-content"); ((Layout) scrollablePanel.getContent()).addComponent(label); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setHeightUndefined(); Messages messages = AppBeans.get(Messages.NAME); Button refreshBtn = new CubaButton(messages.getMessage(getClass(), "logWindow.refreshBtn"), (Button.ClickListener) event -> label.setValue(writeLog())); topLayout.addComponent(refreshBtn); layout.addComponent(topLayout); layout.addComponent(scrollablePanel); layout.setExpandRatio(scrollablePanel, 1.0f); }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaRowsCount.java
License:Apache License
public CubaRowsCount() { HorizontalLayout layout = new HorizontalLayout(); layout.setStyleName("c-paging"); layout.setSpacing(false);/*from w w w . j a v a2 s .c o m*/ layout.setMargin(new MarginInfo(false, false, false, true)); setCompositionRoot(layout); CubaPlaceHolder expander = new CubaPlaceHolder(); expander.setWidth("100%"); layout.addComponent(expander); layout.setExpandRatio(expander, 1); AbstractOrderedLayout contentLayout = createContentLayout(); layout.addComponent(contentLayout); layout.setWidth("100%"); setWidth("100%"); }
From source file:com.haulmont.cuba.web.widgets.CubaRowsCount.java
License:Apache License
public CubaRowsCount() { HorizontalLayout layout = new HorizontalLayout(); // vaadin8 use CssLayout instead layout.setStyleName("c-paging"); layout.setSpacing(false);/* ww w.j a v a2 s . c o m*/ layout.setMargin(new MarginInfo(false, false, false, true)); setCompositionRoot(layout); CubaPlaceHolder expander = new CubaPlaceHolder(); expander.setWidth("100%"); layout.addComponent(expander); layout.setExpandRatio(expander, 1); AbstractOrderedLayout contentLayout = createContentLayout(); layout.addComponent(contentLayout); layout.setWidth("100%"); setWidth("100%"); }
From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java
private void generalInfoLayout() { generalGroup = new VerticalComponentGroup(); generalGroup.setSizeUndefined();/*w w w . ja v a 2 s . co 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.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java
private void workGroup() { workGroup = new VerticalComponentGroup(); workGroup.setSizeUndefined();/* w ww .j a v a2 s .c o m*/ addTab(workGroup, "?", FontAwesome.GRADUATION_CAP); jobPosition = new NativeSelect("?", new JobPosition()); //jobPosition.setInputPrompt("??"); jobPosition.setItemCaptionPropertyId("name"); jobPosition.setImmediate(true); jobPosition.setNullSelectionAllowed(false); jobPosition.setRequired(true); jobPosition.setWidth("-1px"); jobPosition.setHeight("-1px"); //jobPosition.setFilteringMode(FilteringMode.CONTAINS); jobPosition.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() != null) { if (autoGenerate.getValue() != null) { String personnelCodeStr = getPersonnelCode(event.getProperty().getValue().toString(), autoGenerate.getValue().toString()); personnelCode.setEnabled(true); personnelCode.setValue(personnelCodeStr + TEMP_TITLE); personnelCode.setEnabled(false); } } } }); workGroup.addComponent(jobPosition); autoGenerate = new OptionGroup("?", new PersonnelCodeGenerateType()); autoGenerate.setItemCaptionPropertyId("name"); autoGenerate.setImmediate(true); autoGenerate.setRequired(true); autoGenerate.setNullSelectionAllowed(false); autoGenerate.setWidth("-1px"); autoGenerate.setHeight("-1px"); //autoGenerate.setValue(1); autoGenerate.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() != null) { if (event.getProperty().getValue().toString().equals("0")) { if (jobPosition.getValue() != null) { String personnelCodeStr = getPersonnelCode(jobPosition.getValue().toString(), event.getProperty().getValue().toString()); personnelCode.setEnabled(true); personnelCode.setValue(personnelCodeStr + TEMP_TITLE); personnelCode.setEnabled(false); } else if (event.getProperty().getValue().equals("0")) Notification.show( "??", Type.WARNING_MESSAGE); } else { personnelCode.setEnabled(true); personnelCode.setValue(getPersonnelCode(null, "1")); } } } }); workGroup.addComponent(autoGenerate); personnelCode = new TextField(""); personnelCode.setInputPrompt(""); personnelCode.setImmediate(false); personnelCode.setRequired(true); personnelCode.setEnabled(false); personnelCode.setWidth("-1px"); personnelCode.setHeight("-1px"); personnelCode.setNullRepresentation(""); workGroup.addComponent(personnelCode); personnelStatus = new NativeSelect("?", new PersonnelStatus()); //personnelStatus.setInputPrompt("??"); personnelStatus.setItemCaptionPropertyId("name"); personnelStatus.setImmediate(true); personnelStatus.setNullSelectionAllowed(false); personnelStatus.setRequired(true); personnelStatus.setWidth("-1px"); personnelStatus.setHeight("-1px"); //personnelStatus.setFilteringMode(FilteringMode.CONTAINS); workGroup.addComponent(personnelStatus); startWorkDate = new PopupDateField(" "); startWorkDate.setInputPrompt("//"); startWorkDate.setImmediate(false); startWorkDate.setRequired(true); startWorkDate.setWidth("-1px"); startWorkDate.setHeight("-1px"); startWorkDate.setDateFormat("dd/MM/yyyy"); startWorkDate.setLocale(new Locale("th", "TH")); workGroup.addComponent(startWorkDate); department = new NativeSelect("??", new Department()); //department.setInputPrompt("??"); department.setItemCaptionPropertyId("name"); department.setImmediate(true); department.setNullSelectionAllowed(false); department.setRequired(true); department.setWidth("-1px"); department.setHeight("-1px"); //department.setFilteringMode(FilteringMode.CONTAINS); workGroup.addComponent(department); employmentType = new NativeSelect("?", new EmploymentType()); //employmentType.setInputPrompt("??"); employmentType.setItemCaptionPropertyId("name"); employmentType.setImmediate(true); employmentType.setNullSelectionAllowed(false); employmentType.setRequired(true); employmentType.setWidth("-1px"); employmentType.setHeight("-1px"); //employmentType.setFilteringMode(FilteringMode.CONTAINS); workGroup.addComponent(employmentType); bankaccountName = new TextField("?"); bankaccountName.setInputPrompt("?"); bankaccountName.setImmediate(false); bankaccountName.setWidth("-1px"); bankaccountName.setHeight("-1px"); bankaccountName.setNullRepresentation(""); workGroup.addComponent(bankaccountName); bankAccountNumber = new TextField("?"); bankAccountNumber.setInputPrompt("?"); bankAccountNumber.setImmediate(false); bankAccountNumber.setWidth("-1px"); bankAccountNumber.setHeight("-1px"); bankAccountNumber.setNullRepresentation(""); workGroup.addComponent(bankAccountNumber); bankAccountType = new NativeSelect("?", new BankAccountType()); //bankAccountType.setInputPrompt("??"); bankAccountType.setItemCaptionPropertyId("name"); bankAccountType.setImmediate(true); bankAccountType.setNullSelectionAllowed(false); bankAccountType.setWidth("-1px"); bankAccountType.setHeight("-1px"); //bankAccountType.setFilteringMode(FilteringMode.CONTAINS); workGroup.addComponent(bankAccountType); bankName = new TextField(""); bankName.setInputPrompt(""); bankName.setImmediate(false); bankName.setWidth("-1px"); bankName.setHeight("-1px"); bankName.setNullRepresentation(""); workGroup.addComponent(bankName); bankaccountBranch = new TextField(""); bankaccountBranch.setInputPrompt(""); bankaccountBranch.setImmediate(false); bankaccountBranch.setWidth("-1px"); bankaccountBranch.setHeight("-1px"); bankaccountBranch.setNullRepresentation(""); workGroup.addComponent(bankaccountBranch); bankProvinceId = new NativeSelect("", new Province()); //bankProvinceId.setInputPrompt("??"); bankProvinceId.setItemCaptionPropertyId("name"); bankProvinceId.setImmediate(true); bankProvinceId.setNullSelectionAllowed(false); bankProvinceId.setWidth("-1px"); bankProvinceId.setHeight("-1px"); //bankProvinceId.setFilteringMode(FilteringMode.CONTAINS); bankProvinceId.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() != null) currentDistrict.setContainerDataSource( new District(Integer.parseInt(event.getProperty().getValue().toString()))); } }); workGroup.addComponent(bankProvinceId); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setWidth("100%"); buttonLayout.setSpacing(true); workGroup.addComponent(buttonLayout); generalBack = new Button(FontAwesome.ARROW_LEFT); generalBack.setWidth("100%"); generalBack.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { setSelectedTab(generalGroup); } }); buttonLayout.addComponents(generalBack); licenseeNext = new Button(FontAwesome.ARROW_RIGHT); licenseeNext.setWidth("100%"); licenseeNext.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { setSelectedTab(licenseeGroup); } }); buttonLayout.addComponents(licenseeNext); }