List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:jp.primecloud.auto.ui.WinServerNetworkConfig.java
License:Open Source License
WinServerNetworkConfig(Application ap, Long instanceNo, Long platformNo, InstanceNetworkDto instanceNetworkDto, List<InstanceNetworkDto> instanceNetworkDtos) { this.ap = ap; this.instanceNo = instanceNo; this.platformNo = platformNo; this.instanceNetworkDto = instanceNetworkDto; this.isAddMode = (this.instanceNetworkDto == null) ? true : false; this.instanceNetworkDtos = instanceNetworkDtos; // Window//w w w. j a v a2 s .c o m if (isAddMode) { //? setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.WinServerAddNetwork")); } else { //? setIcon(Icons.EDIT.resource()); setCaption(ViewProperties.getCaption("window.WinServerEditNetwork")); } setModal(true); setWidth("380px"); setResizable(false); // Layout VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); layout.setSpacing(true); // Form Form form = new Form(); //?? networkSelect = new ComboBox(ViewProperties.getCaption("field.netWork")); networkSelect.setWidth(COMBOBOX_WIDTH); networkSelect.setNullSelectionAllowed(false); networkSelect.setItemCaptionPropertyId(CID_NETWORK); networkSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); networkSelect.setImmediate(true); networkSelect.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { changeNetwork(event); } }); //IP? ipModeSelect = new ComboBox(ViewProperties.getCaption("caption.field.ipMode")); ipModeSelect.setWidth(COMBOBOX_WIDTH); ipModeSelect.setNullSelectionAllowed(false); ipModeSelect.setItemCaptionPropertyId(CID_IP_MODE); ipModeSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); ipModeSelect.setImmediate(true); ipModeSelect.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { changeIpMode(event); } }); //IP ipAddressField = new TextField(ViewProperties.getCaption("field.ipAddress")); ipAddressField.setWidth("100%"); ipAddressField.setImmediate(true); //? netmaskField = new TextField(ViewProperties.getCaption("field.netmask")); netmaskField.setWidth("100%"); netmaskField.setReadOnly(true); netmaskField.setImmediate(true); // gateWayField = new TextField(ViewProperties.getCaption("field.gateway")); gateWayField.setWidth("100%"); gateWayField.setReadOnly(true); gateWayField.setImmediate(true); //DNS1 dns1Field = new TextField(ViewProperties.getCaption("field.dns1")); dns1Field.setWidth("100%"); dns1Field.setReadOnly(true); dns1Field.setImmediate(true); //DNS2 dns2Field = new TextField(ViewProperties.getCaption("field.dns2")); dns2Field.setWidth("100%"); dns2Field.setReadOnly(true); dns2Field.setImmediate(true); //Primary primaryOpg = new OptionGroup(ViewProperties.getCaption("field.primary")); primaryOpg.addItem(CID_PRIMARY); primaryOpg.setItemCaption(CID_PRIMARY, ""); primaryOpg.setNullSelectionAllowed(false); primaryOpg.setImmediate(true); form.getLayout().addComponent(networkSelect); form.getLayout().addComponent(ipModeSelect); form.getLayout().addComponent(ipAddressField); form.getLayout().addComponent(netmaskField); form.getLayout().addComponent(gateWayField); form.getLayout().addComponent(dns1Field); form.getLayout().addComponent(dns2Field); form.getLayout().addComponent(primaryOpg); layout.addComponent(form); // ?? HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setSpacing(true); buttonBar.setMargin(false, true, true, false); layout.addComponent(buttonBar); layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT); // OK Button Button btnOk = new Button(ViewProperties.getCaption("button.ok")); btnOk.setDescription(ViewProperties.getCaption("description.ok")); btnOk.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { okButtonClick(event); } }); buttonBar.addComponent(btnOk); // [Enter]?OK btnOk.setClickShortcut(KeyCode.ENTER); //Cancel Button Button btnCancel = new Button(ViewProperties.getCaption("button.cancel")); btnCancel.setDescription(ViewProperties.getCaption("description.cancel")); btnCancel.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttonBar.addComponent(btnCancel); //? initData(); // showData(); // ?? initValidation(); }
From source file:jp.primecloud.auto.ui.WinServiceAdd.java
License:Open Source License
WinServiceAdd(Application ap) { apl = ap;// w w w. j a va2 s . co m // setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.winServiceAdd")); setModal(true); setWidth("630px"); //setHeight("500px"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(false); // layout.addComponent(new BasicForm()); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // Add Button addButton = new Button(ViewProperties.getCaption("button.add")); addButton.setDescription(ViewProperties.getCaption("description.addService")); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinServiceAdd.this.addButtonClick(event); } }); okbar.addComponent(addButton); // [Enter]?addButton addButton.setClickShortcut(KeyCode.ENTER); addButton.focus(); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinServiceAdd.this.close(); } }); okbar.addComponent(cancelButton); // ?? initValidation(); // ??? initData(); // showServices(); }
From source file:jp.primecloud.auto.ui.WinServiceEdit.java
License:Open Source License
WinServiceEdit(Application ap, Long componentNo) { apl = ap;/*from ww w . j a v a 2 s . co m*/ this.componentNo = componentNo; // ??? initData(); // setIcon(Icons.EDITMINI.resource()); setCaption(ViewProperties.getCaption("window.winServiceEdit")); setModal(true); setWidth("600px"); VerticalLayout layout = (VerticalLayout) getContent(); // layout.setWidth("100%"); layout.setMargin(false, true, false, true); layout.setSpacing(true); // layout.addComponent(tab); basicTab = new BasicTab(); tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource()); detailTab = new DetailTab(); Boolean useCustomPara = BooleanUtils.toBooleanObject(Config.getProperty("userCustomize.useCustomParam")); if (BooleanUtils.isTrue(useCustomPara)) { tab.addTab(detailTab, ViewProperties.getCaption("tab.detail"), Icons.BASIC.resource()); } // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // OK Button okButton = new Button(ViewProperties.getCaption("button.ok")); okButton.setDescription(ViewProperties.getCaption("description.editService.ok")); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { okButtonClick(event); } }); okbar.addComponent(okButton); // [Enter]?okButton okButton.setClickShortcut(KeyCode.ENTER); okButton.focus(); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); okbar.addComponent(cancelButton); // ?? initValidation(); // ? basicTab.showData(); // ? detailTab.showData(); }
From source file:jp.primecloud.auto.ui.WinUserAuthAddEdit.java
License:Open Source License
WinUserAuthAddEdit(Long masterUserNo, Long userNo) { this.masterUserNo = masterUserNo; this.userNo = userNo; //?/*w ww .jav a 2 s . c om*/ isAddUser = (userNo == null) ? true : false; // ??? initData(); // //???? if (isAddUser) { //?? setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.winUserAdd")); } else { //? setIcon(Icons.EDIT.resource()); setCaption(ViewProperties.getCaption("window.winUserEdit")); } // setModal(true); setWidth("450px"); // setResizable(false); // VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(false); // layout.addComponent(new AuthAddForm()); // ? userAuthTable = new UserAuthTable(); layout.addComponent(userAuthTable); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(true, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // OK Button okButton = new Button(ViewProperties.getCaption("button.ok")); if (isAddUser) { //?? okButton.setDescription(ViewProperties.getCaption("description.addUserAuth.ok")); } else { //? okButton.setDescription(ViewProperties.getCaption("description.editUserAuth.ok")); } okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinUserAuthAddEdit.this.okButtonClick(event); } }); okbar.addComponent(okButton); //Delete if (!isAddUser) { //????? Button deleteButton = new Button(ViewProperties.getCaption("button.delete")); deleteButton.setDescription(ViewProperties.getCaption("description.editUserAuth.delete")); deleteButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinUserAuthAddEdit.this.deleteButtonClick(event); } }); okbar.addComponent(deleteButton); } // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinUserAuthAddEdit.this.cancelButtonClick(event); } }); okbar.addComponent(cancelButton); // ?? showData(); // ?? initValidation(); }
From source file:jp.primecloud.auto.ui.WinUserAuthEditDetail.java
License:Open Source License
WinUserAuthEditDetail(Long userNo, Long farmNo) { this.userNo = userNo; this.farmNo = farmNo; ////from w w w . j ava 2s. com setIcon(Icons.EDIT.resource()); setCaption(ViewProperties.getCaption("window.winUserDetailEdit")); // setModal(true); setWidth("300px"); // setResizable(false); // VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(false); layout.addComponent(new AuthForm()); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // OK Button okButton = new Button(ViewProperties.getCaption("button.ok")); okButton.setDescription(ViewProperties.getCaption("description.editUserAuthDetail.ok")); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinUserAuthEditDetail.this.okButtonClick(event); } }); okbar.addComponent(okButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinUserAuthEditDetail.this.cancelButtonClick(event); } }); okbar.addComponent(cancelButton); // ?? initData(); // ? showData(); // ?? initValidation(); }
From source file:kn.uni.gis.ui.AdminWindow.java
License:Apache License
private Component loginComponent() { final VerticalLayout layout = new VerticalLayout(); final PasswordField passwordField = new PasswordField("Old Hunters Age"); passwordField.setWidth("-1px"); passwordField.setHeight("-1px"); passwordField.focus();//from ww w . j av a 2s. co m Button button_2 = new Button(); button_2.setCaption("Login"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); button_2.addListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (password.equals(passwordField.getValue())) { AdminWindow.this.removeComponent(layout); AdminWindow.this.addComponent(createTable()); } else { AdminWindow.this.showNotification("Wrong age!"); } } }); layout.addComponent(passwordField); layout.addComponent(button_2); layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER); layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER); return layout; }
From source file:lifetime.component.welcome.HomeView.java
License:Apache License
private Component getSearchView() { searchText.setWidth("50%"); VerticalLayout layout = new VerticalLayout(searchText, searchButton); layout.setWidth("100%"); layout.setHeightUndefined();/*from www . j a v a 2s. c om*/ layout.setMargin(true); layout.setComponentAlignment(searchText, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(searchButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java
License:Open Source License
public AdminAuthView() { setSizeFull();/*ww w . jav a 2s.c om*/ VerticalLayout header = new VerticalLayout(); header.setSizeFull(); HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); addComponents(header, content); setExpandRatio(header, 1); setExpandRatio(content, 6); welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>"); welcomeText.setContentMode(ContentMode.HTML); welcomeText.setSizeUndefined(); header.addComponent(welcomeText); header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); Panel controlPanel = new Panel("Administrator control panel"); controlPanel.setSizeUndefined(); Panel addCoordPanel = new Panel("Create a new coordinator"); addCoordPanel.setSizeUndefined(); Panel messagesPanel = new Panel("Administrator messages"); messagesPanel.setWidth("580px"); Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setColumnWidth("inputEvent", 180); adminMessagesTable.setSizeFull(); VerticalLayout controlLayout = new VerticalLayout(controlPanel); controlLayout.setSizeFull(); controlLayout.setMargin(false); controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER); VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel); coordOperationsLayout.setSizeFull(); coordOperationsLayout.setMargin(false); coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER); /******************************************/ coordOperationsLayout.setVisible(true); // main layout in the middle addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator" /******************************************/ HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel); VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable); messagesExternalLayout.setSizeFull(); messagesExternalLayout.setMargin(false); messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER); messagesInternalLayout.setMargin(false); messagesInternalLayout.setSizeFull(); messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER); messagesPanel.setContent(messagesInternalLayout); TextField idCoordAdd = new TextField(); TextField loginCoord = new TextField(); PasswordField pwdCoord = new PasswordField(); Label idCaptionAdd = new Label("ID"); Label loginCaption = new Label("Login"); Label pwdCaption = new Label("Password"); idCaptionAdd.setSizeUndefined(); idCoordAdd.setSizeUndefined(); loginCaption.setSizeUndefined(); loginCoord.setSizeUndefined(); pwdCaption.setSizeUndefined(); pwdCoord.setSizeUndefined(); Button validateNewCoord = new Button("Validate"); validateNewCoord.setClickShortcut(KeyCode.ENTER); validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY); GridLayout addCoordinatorLayout = new GridLayout(2, 4); addCoordinatorLayout.setSpacing(true); addCoordinatorLayout.setMargin(true); addCoordinatorLayout.setSizeFull(); addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption, pwdCoord); addCoordinatorLayout.addComponent(validateNewCoord, 1, 3); addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT); addCoordPanel.setContent(addCoordinatorLayout); content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setExpandRatio(controlLayout, 20); content.setExpandRatio(coordOperationsLayout, 10); content.setExpandRatio(messagesExternalLayout, 28); Button addCoordinator = new Button("Add coordinator"); Button deleteCoordinator = new Button("Delete coordinator"); addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE); VerticalLayout buttons = new VerticalLayout(); buttons.setMargin(true); buttons.setSpacing(true); buttons.setSizeFull(); buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); controlPanel.setContent(buttons); buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn); /******* DELETE COORDINATOR PANEL BEGIN *********/ Label idCaptionDel = new Label("ID"); TextField idCoordDel = new TextField(); Panel delCoordPanel = new Panel("Delete a coordinator"); coordOperationsLayout.addComponent(delCoordPanel); delCoordPanel.setVisible(false); coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER); delCoordPanel.setSizeUndefined(); GridLayout delCoordinatorLayout = new GridLayout(2, 2); delCoordinatorLayout.setSpacing(true); delCoordinatorLayout.setMargin(true); delCoordinatorLayout.setSizeFull(); Button deleteCoordBtn = new Button("Delete"); deleteCoordBtn.setClickShortcut(KeyCode.ENTER); deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY); delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel); delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1); delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT); delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT); delCoordPanel.setContent(delCoordinatorLayout); /******* DELETE COORDINATOR PANEL END *********/ /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/ addCoordinator.addClickListener(event -> { if (!addCoordPanel.isVisible()) { delCoordPanel.setVisible(false); addCoordPanel.setVisible(true); idCoordAdd.focus(); } else addCoordPanel.setVisible(false); }); deleteCoordinator.addClickListener(event -> { if (!delCoordPanel.isVisible()) { addCoordPanel.setVisible(false); delCoordPanel.setVisible(true); idCoordDel.focus(); } else delCoordPanel.setVisible(false); }); /************************************************* MAIN BUTTONS LOGIC END *************************************************/ /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/ validateNewCoord.addClickListener(event -> { String currentURL = Page.getCurrent().getLocation().toString(); int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName); String iCrashURL = currentURL.substring(0, strIndexCreator); String googleShebang = "#!"; String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang; try { sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())), new DtLogin(new PtString(loginCoord.getValue())), new DtPassword(new PtString(pwdCoord.getValue()))); // open new browser tab with the newly created coordinator console... // "_blank" instructs the browser to open a new tab instead of a new window... // unhappily not all browsers interpret it correctly, // some versions of some browsers might still open a new window instead (notably Firefox)! Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank"); } catch (Exception e) { e.printStackTrace(); } idCoordAdd.setValue(""); loginCoord.setValue(""); pwdCoord.setValue(""); idCoordAdd.focus(); }); /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/ /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/ deleteCoordBtn.addClickListener(event -> { IcrashSystem sys = IcrashSystem.getInstance(); try { sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue()))); } catch (Exception e) { e.printStackTrace(); } idCoordDel.setValue(""); idCoordDel.focus(); }); /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/ }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminLoginView.java
License:Open Source License
public AdminLoginView() { actAdmin.setActorUI(UI.getCurrent()); env.setActAdministrator(actAdmin.getName(), actAdmin); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctAdmin, actAdmin); log.debug("CHECK: ADMIN UI is " + actAdmin.getActorUI()); welcomeText = new Label("Please login to access iCrash Administrator Console"); hintText = new Label("(icrashadmin/7WXC1359)"); welcomeText.setSizeUndefined();/*from ww w . j av a2 s.com*/ hintText.setSizeUndefined(); // create the username input field username = new TextField("Login:"); username.setWidth("120px"); username.setInputPrompt("Admin login"); username.setImmediate(true); // create the password input field password = new PasswordField("Password:"); password.setWidth("120px"); password.setValue(""); password.setNullRepresentation(""); password.setImmediate(true); // create the login button loginButton = new Button("Login", this); loginButton.setClickShortcut(KeyCode.ENTER); loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); loginButton.setImmediate(true); /*********************************************************************************************/ Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setCaption("Administrator messages"); // adminMessagesTable.setVisibleColumns("inputEvent", "message"); /*********************************************************************************************/ FormLayout FL = new FormLayout(username, password, loginButton); VerticalLayout welcomeLayout = new VerticalLayout(welcomeText, /*hintText,*/ FL); VerticalLayout leftVL = new VerticalLayout(welcomeLayout); VerticalLayout rightVL = new VerticalLayout(adminMessagesTable); welcomeLayout.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); // welcomeLayout.setComponentAlignment(hintText, Alignment.MIDDLE_CENTER); welcomeLayout.setComponentAlignment(FL, Alignment.MIDDLE_CENTER); setSizeFull(); FL.setSizeUndefined(); welcomeLayout.setSizeUndefined(); leftVL.setSizeFull(); rightVL.setSizeFull(); leftVL.setComponentAlignment(welcomeLayout, Alignment.MIDDLE_CENTER); rightVL.setComponentAlignment(adminMessagesTable, Alignment.MIDDLE_CENTER); addComponent(leftVL); addComponent(rightVL); setMargin(true); setExpandRatio(leftVL, 6); setExpandRatio(rightVL, 4); }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileLoginView.java
License:Open Source License
public CoordMobileLoginView(String CoordID) { CtCoordinator ctCoordinator = (CtCoordinator) sys .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID))); ActCoordinator actCoordinator = env.getActCoordinator(ctCoordinator.login); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); setCaption("Login to Coord " + ctCoordinator.login.toString()); VerticalLayout layout = new VerticalLayout(); setContent(layout);/* w w w. j a va2s. c om*/ VerticalComponentGroup group = new VerticalComponentGroup(); layout.addComponent(group); VerticalLayout loginExtLayout = new VerticalLayout(); loginExtLayout.setSizeFull(); group.addComponent(loginExtLayout); FormLayout loginIntLayout = new FormLayout(); loginIntLayout.setSizeUndefined(); loginExtLayout.addComponent(loginIntLayout); loginExtLayout.setComponentAlignment(loginIntLayout, Alignment.MIDDLE_CENTER); login.setInputPrompt("Coord login"); pwd.setValue(""); pwd.setNullRepresentation(""); loginBtn.setClickShortcut(KeyCode.ENTER); loginIntLayout.addComponents(login, pwd, loginBtn); /////////////////////////////////////////////////////////////////////////////////// Grid messagesTable = new Grid(); messagesTable.setContainerDataSource(actCoordinator.getMessagesDataSource()); messagesTable.setSizeUndefined(); VerticalLayout tableLayout = new VerticalLayout(); tableLayout.setSizeFull(); group.addComponent(tableLayout); tableLayout.addComponent(messagesTable); tableLayout.setComponentAlignment(messagesTable, Alignment.MIDDLE_CENTER); /////////////////////////////////////////////////////////////////////////////////// loginBtn.addClickListener(event -> { PtBoolean res; try { res = actCoordinator.oeLogin(new DtLogin(new PtString(login.getValue())), new DtPassword(new PtString(pwd.getValue()))); log.info("oeLogin returned " + res.getValue()); if (res.getValue()) { log.debug("After actCoordinator.oeLogin: JUST LOGGED IN, so Coord's vpIsLogged = " + ctCoordinator.vpIsLogged.getValue()); } } catch (Exception e) { e.printStackTrace(); } // refreshing this view forces redirection of the user // to the view, where he should go now, be it CoordLoginView or CoordAuthView Page.getCurrent().reload(); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); }); }