List of usage examples for com.vaadin.ui NativeSelect NativeSelect
public NativeSelect()
From source file:info.magnolia.security.app.dialog.field.WebAccessFieldFactory.java
License:Open Source License
private Component createRuleRow(final AbstractOrderedLayout parentContainer, final AbstractJcrNodeAdapter ruleItem, final Label emptyLabel) { final HorizontalLayout ruleLayout = new HorizontalLayout(); ruleLayout.setSpacing(true);/* w ww . j a va 2s.co m*/ ruleLayout.setWidth("100%"); NativeSelect accessRights = new NativeSelect(); accessRights.addItem(Permission.ALL); accessRights.setItemCaption(Permission.ALL, i18n.translate("security.web.field.getPost")); accessRights.addItem(Permission.READ); accessRights.setItemCaption(Permission.READ, i18n.translate("security.web.field.get")); accessRights.addItem(Permission.NONE); accessRights.setItemCaption(Permission.NONE, i18n.translate("security.web.field.deny")); accessRights.setNullSelectionAllowed(false); accessRights.setImmediate(true); accessRights.setInvalidAllowed(false); accessRights.setNewItemsAllowed(false); Property permissionsProperty = ruleItem.getItemProperty(PERMISSIONS_PROPERTY_NAME); if (permissionsProperty == null) { permissionsProperty = new DefaultProperty<Long>(Long.class, Permission.ALL); ruleItem.addItemProperty(PERMISSIONS_PROPERTY_NAME, permissionsProperty); } accessRights.setPropertyDataSource(permissionsProperty); ruleLayout.addComponent(accessRights); TextField path = new TextField(); path.setWidth("100%"); Property pathProperty = ruleItem.getItemProperty(PATH_PROPERTY_NAME); if (pathProperty == null) { pathProperty = new DefaultProperty<String>(String.class, "/*"); ruleItem.addItemProperty(PATH_PROPERTY_NAME, pathProperty); } path.setPropertyDataSource(pathProperty); ruleLayout.addComponent(path); ruleLayout.setExpandRatio(path, 1.0f); final Button deleteButton = new Button(); deleteButton.setHtmlContentAllowed(true); deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>"); deleteButton.addStyleName("inline"); deleteButton.setDescription(i18n.translate("security.web.field.delete")); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { parentContainer.removeComponent(ruleLayout); ruleItem.getParent().removeChild(ruleItem); if (parentContainer.getComponentCount() == 1) { parentContainer.addComponent(emptyLabel, 0); } } }); ruleLayout.addComponent(deleteButton); return ruleLayout; }
From source file:info.magnolia.security.app.dialog.field.WorkspaceAccessFieldFactory.java
License:Open Source License
protected Component createRuleRow(final AbstractOrderedLayout parentContainer, final AbstractJcrNodeAdapter ruleItem, final Label emptyLabel) { final HorizontalLayout ruleLayout = new HorizontalLayout(); ruleLayout.setSpacing(true);// w ww . j ava 2 s. co m ruleLayout.setWidth("100%"); NativeSelect accessRights = new NativeSelect(); accessRights.setNullSelectionAllowed(false); accessRights.setImmediate(true); accessRights.setInvalidAllowed(false); accessRights.setNewItemsAllowed(false); accessRights.addItem(Permission.ALL); accessRights.setItemCaption(Permission.ALL, i18n.translate("security.workspace.field.readWrite")); accessRights.addItem(Permission.READ); accessRights.setItemCaption(Permission.READ, i18n.translate("security.workspace.field.readOnly")); accessRights.addItem(Permission.NONE); accessRights.setItemCaption(Permission.NONE, i18n.translate("security.workspace.field.denyAccess")); accessRights.setPropertyDataSource(ruleItem.getItemProperty(AccessControlList.PERMISSIONS_PROPERTY_NAME)); ruleLayout.addComponent(accessRights); NativeSelect accessType = new NativeSelect(); accessType.setNullSelectionAllowed(false); accessType.setImmediate(true); accessType.setInvalidAllowed(false); accessType.setNewItemsAllowed(false); accessType.setWidth("150px"); accessType.addItem(AccessControlList.ACCESS_TYPE_NODE); accessType.setItemCaption(AccessControlList.ACCESS_TYPE_NODE, i18n.translate("security.workspace.field.selected")); accessType.addItem(AccessControlList.ACCESS_TYPE_CHILDREN); accessType.setItemCaption(AccessControlList.ACCESS_TYPE_CHILDREN, i18n.translate("security.workspace.field.subnodes")); accessType.addItem(AccessControlList.ACCESS_TYPE_NODE_AND_CHILDREN); accessType.setItemCaption(AccessControlList.ACCESS_TYPE_NODE_AND_CHILDREN, i18n.translate("security.workspace.field.selectedSubnodes")); Property accessTypeProperty = ruleItem.getItemProperty(ACCESS_TYPE_PROPERTY_NAME); accessType.setPropertyDataSource(accessTypeProperty); ruleLayout.addComponent(accessType); final TextField path = new TextField(); path.setWidth("100%"); path.setPropertyDataSource(ruleItem.getItemProperty(AccessControlList.PATH_PROPERTY_NAME)); ruleLayout.addComponent(path); ruleLayout.setExpandRatio(path, 1.0f); Button chooseButton = new Button(i18n.translate("security.workspace.field.choose")); chooseButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { openChooseDialog(path); } }); ruleLayout.addComponent(chooseButton); Button deleteButton = new Button(); deleteButton.setHtmlContentAllowed(true); deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>"); deleteButton.addStyleName("inline"); deleteButton.setDescription(i18n.translate("security.workspace.field.delete")); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { parentContainer.removeComponent(ruleLayout); ruleItem.getParent().removeChild(ruleItem); if (parentContainer.getComponentCount() == 1) { parentContainer.addComponent(emptyLabel, 0); } } }); ruleLayout.addComponent(deleteButton); return ruleLayout; }
From source file:it.vige.greenarea.bpm.custom.ui.TimeField.java
License:Apache License
private NativeSelect getSelect() { NativeSelect select = new NativeSelect() { private static final long serialVersionUID = 7956455947702461208L; @Override/* ww w . j av a 2 s . co m*/ public String getItemCaption(Object itemId) { if (itemId instanceof Integer) { int val = (Integer) itemId; if (val < 10) { return "0" + val; } return val + ""; } return super.getItemCaption(itemId); } }; select.setImmediate(true); select.setNullSelectionAllowed(false); select.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 3383351188340627219L; public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (maskInternalValueChange) { return; } maskInternalValueChange = true; updateValue(); TimeField.this.fireValueChange(true); maskInternalValueChange = false; } }); return select; }
From source file:jcaster_vaadin.Gui2.java
License:Open Source License
@AutoGenerated private GridLayout buildGridLayout_3() { // common part: create layout gridLayout_3 = new GridLayout(); gridLayout_3.setWidth("100.0%"); gridLayout_3.setHeight("100.0%"); gridLayout_3.setImmediate(false);//from w w w .j a v a 2s .c o m gridLayout_3.setMargin(false); gridLayout_3.setSpacing(true); gridLayout_3.setColumns(4); gridLayout_3.setRows(7); // flnmLbl flnmLbl = new Label(); flnmLbl.setWidth("-1px"); flnmLbl.setHeight("-1px"); flnmLbl.setValue("Filename"); flnmLbl.setImmediate(false); gridLayout_3.addComponent(flnmLbl, 0, 1); // txtFlnm txtFlnm = new TextField(); txtFlnm.setWidth("-1px"); txtFlnm.setHeight("-1px"); txtFlnm.setImmediate(false); txtFlnm.setValue("test"); //set default filename gridLayout_3.addComponent(txtFlnm, 1, 1); // svlcLbl svlcLbl = new Label(); svlcLbl.setWidth("-1px"); svlcLbl.setHeight("-1px"); svlcLbl.setValue("Save location"); svlcLbl.setImmediate(false); gridLayout_3.addComponent(svlcLbl, 0, 2); // txtSvLc txtSvLc = new TextField(); txtSvLc.setWidth("-1px"); txtSvLc.setHeight("-1px"); txtSvLc.setImmediate(false); txtSvLc.setValue(System.getProperty("user.home") + File.separator); gridLayout_3.addComponent(txtSvLc, 1, 2); // brwBtn brwBtn = new NativeButton(); brwBtn.setWidth("-1px"); brwBtn.setHeight("-1px"); brwBtn.setCaption("Browse..."); brwBtn.setImmediate(true); gridLayout_3.addComponent(brwBtn, 2, 2); brwBtn.addListener(new Button.ClickListener() { private static final long serialVersionUID = -8389582613309805795L; public void buttonClick(Button.ClickEvent event) { // browse(); } }); // rcrdLbl rcrdLbl = new Label(); rcrdLbl.setWidth("-1px"); rcrdLbl.setHeight("-1px"); rcrdLbl.setValue("Record type"); rcrdLbl.setImmediate(false); gridLayout_3.addComponent(rcrdLbl, 0, 3); // slctRrcdTp slctRrcdTp = new NativeSelect(); slctRrcdTp.setWidth("-1px"); slctRrcdTp.setHeight("-1px"); slctRrcdTp.setImmediate(false); slctRrcdTp.addItem("audio+video"); slctRrcdTp.addItem("video only"); slctRrcdTp.addItem("audio only"); slctRrcdTp.setValue("audio+video"); //set default record type gridLayout_3.addComponent(slctRrcdTp, 1, 3); // RcrdCtdLbl RcrdCtdLbl = new Label(); RcrdCtdLbl.setWidth("-1px"); RcrdCtdLbl.setHeight("-1px"); RcrdCtdLbl.setValue("Recording countdown"); RcrdCtdLbl.setImmediate(false); gridLayout_3.addComponent(RcrdCtdLbl, 0, 4); // txtRrcdCtd txtRrcdCtd = new TextField(); txtRrcdCtd.setWidth("-1px"); txtRrcdCtd.setHeight("-1px"); txtRrcdCtd.setValue(0); txtRrcdCtd.setImmediate(false); gridLayout_3.addComponent(txtRrcdCtd, 1, 4); // DrRcrdLbl DrRcrdLbl = new Label(); DrRcrdLbl.setWidth("-1px"); DrRcrdLbl.setHeight("-1px"); DrRcrdLbl.setValue("Duration of record"); DrRcrdLbl.setImmediate(false); gridLayout_3.addComponent(DrRcrdLbl, 0, 5); // txtDrRcrd txtDrRcrd = new TextField(); txtDrRcrd.setWidth("-1px"); txtDrRcrd.setHeight("-1px"); txtDrRcrd.setValue(0); txtDrRcrd.setImmediate(false); gridLayout_3.addComponent(txtDrRcrd, 1, 5); return gridLayout_3; }
From source file:jcaster_vaadin.Gui2.java
License:Open Source License
@AutoGenerated private GridLayout buildGridLayout_4() { // common part: create layout gridLayout_4 = new GridLayout(); gridLayout_4.setWidth("100.0%"); gridLayout_4.setHeight("100.0%"); gridLayout_4.setImmediate(false);//from w w w . jav a 2 s . c o m gridLayout_4.setMargin(false); gridLayout_4.setSpacing(true); gridLayout_4.setColumns(5); gridLayout_4.setRows(7); // frmtLbl frmtLbl = new Label(); frmtLbl.setWidth("-1px"); frmtLbl.setHeight("-1px"); frmtLbl.setValue("Format"); frmtLbl.setImmediate(false); gridLayout_4.addComponent(frmtLbl, 0, 1); // slctFrmt slctFrmt = new NativeSelect(); slctFrmt.setWidth("-1px"); slctFrmt.setHeight("-1px"); slctFrmt.setImmediate(false); slctFrmt.addItem("mp4"); slctFrmt.addItem("avi"); slctFrmt.addItem("mov"); slctFrmt.addItem("flv"); slctFrmt.setValue("mp4"); //set default video format gridLayout_4.addComponent(slctFrmt, 1, 1); // cdcLbl cdcLbl = new Label(); cdcLbl.setWidth("-1px"); cdcLbl.setHeight("-1px"); cdcLbl.setValue("Codec"); cdcLbl.setImmediate(false); gridLayout_4.addComponent(cdcLbl, 0, 2); // slctCdc slctCdc = new NativeSelect(); slctCdc.setWidth("-1px"); slctCdc.setHeight("-1px"); slctCdc.setImmediate(false); gridLayout_4.addComponent(slctCdc, 1, 2); return gridLayout_4; }
From source file:jcaster_vaadin.Gui2.java
License:Open Source License
@AutoGenerated private GridLayout buildGridLayout_5() { // common part: create layout gridLayout_5 = new GridLayout(); gridLayout_5.setWidth("100.0%"); gridLayout_5.setHeight("100.0%"); gridLayout_5.setImmediate(false);/* w w w .j a va2 s. c o m*/ gridLayout_5.setMargin(false); gridLayout_5.setSpacing(true); gridLayout_5.setColumns(4); gridLayout_5.setRows(7); // chnlsLbl chnlsLbl = new Label(); chnlsLbl.setWidth("-1px"); chnlsLbl.setHeight("-1px"); chnlsLbl.setValue("Channels"); chnlsLbl.setImmediate(false); gridLayout_5.addComponent(chnlsLbl, 0, 1); // slctChnls slctChnls = new NativeSelect(); slctChnls.setWidth("-1px"); slctChnls.setHeight("-1px"); slctChnls.setImmediate(false); slctChnls.addItem(1); slctChnls.addItem(2); slctChnls.setValue(2); //set default number of channels gridLayout_5.addComponent(slctChnls, 1, 1); // smplSzLbl smplSzLbl = new Label(); smplSzLbl.setWidth("-1px"); smplSzLbl.setHeight("-1px"); smplSzLbl.setValue("Sample size"); smplSzLbl.setImmediate(false); gridLayout_5.addComponent(smplSzLbl, 0, 2); // slctSmplSz slctSmplSz = new NativeSelect(); slctSmplSz.setWidth("-1px"); slctSmplSz.setHeight("-1px"); slctSmplSz.setImmediate(false); slctSmplSz.addItem("8-bit"); slctSmplSz.addItem("16-bit"); slctSmplSz.setValue("16-bit"); //set default sample size gridLayout_5.addComponent(slctSmplSz, 1, 2); // splRtLbl splRtLbl = new Label(); splRtLbl.setWidth("-1px"); splRtLbl.setHeight("-1px"); splRtLbl.setValue("Sample rate"); splRtLbl.setImmediate(false); gridLayout_5.addComponent(splRtLbl, 0, 3); // slctSmplRt slctSmplRt = new NativeSelect(); slctSmplRt.setWidth("-1px"); slctSmplRt.setHeight("-1px"); slctSmplRt.setImmediate(false); slctSmplRt.addItem(8000); slctSmplRt.addItem(11025); slctSmplRt.addItem(16000); slctSmplRt.addItem(22050); slctSmplRt.addItem(44100); slctSmplRt.setValue(44100); //set default sample rate gridLayout_5.addComponent(slctSmplRt, 1, 3); return gridLayout_5; }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileAuthView.java
License:Open Source License
public CoordMobileAuthView(String CoordID) { CtCoordinator ctCoordinator = (CtCoordinator) sys .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID))); ActCoordinator actCoordinator = sys.getActCoordinator(ctCoordinator); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); thisCoordID = CoordID;/*from w w w . j a v a2s .co m*/ setResponsive(true); setWidth("100%"); NavigationBar alertsBar = new NavigationBar(); VerticalComponentGroup alertsContent = new VerticalComponentGroup(); alertsContent.setWidth("100%"); alertsContent.setResponsive(true); HorizontalLayout alertButtons1 = new HorizontalLayout(); HorizontalLayout alertButtons2 = new HorizontalLayout(); //alertButtons.setMargin(true); //alertButtons.setSpacing(true); alertsBar.setCaption("Coordinator " + ctCoordinator.login.toString()); // NavigationButton logoutBtn1 = new NavigationButton("Logout"); Button logoutBtn1 = new Button("Logout"); alertsBar.setRightComponent(logoutBtn1); alertsTable = new Grid(); alertsTable.setContainerDataSource(actCoordinator.getAlertsContainer()); alertsTable.setColumnOrder("ID", "date", "time", "longitude", "latitude", "comment", "status"); alertsTable.setSelectionMode(SelectionMode.SINGLE); alertsTable.setWidth("100%"); alertsTable.setResponsive(true); //alertsTable.setSizeUndefined(); alertsTable.setImmediate(true); Grid inputEventsTable1 = new Grid(); inputEventsTable1.setContainerDataSource(actCoordinator.getMessagesDataSource()); inputEventsTable1.setWidth("100%"); inputEventsTable1.setResponsive(true); alertsContent.addComponents(alertsBar, alertButtons1, alertButtons2, alertsTable, inputEventsTable1); Tab alertsTab = this.addTab(alertsContent); alertsTab.setCaption("Alerts"); alertStatus = new NativeSelect(); alertStatus.setNullSelectionAllowed(false); alertStatus.addItems("Pending", "Valid", "Invalid"); alertStatus.setImmediate(true); alertStatus.select("Pending"); Button validateAlertBtn = new Button("Validate"); Button invalidateAlertBtn = new Button("Invalidate"); Button getAlertsSetBtn = new Button("Get alerts set"); validateAlertBtn.setImmediate(true); invalidateAlertBtn.setImmediate(true); validateAlertBtn.addClickListener(event -> { AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow(); Integer thisAlertID = new Integer(selectedAlertBean.getID()); PtBoolean res; res = sys.oeValidateAlert(new DtAlertID(new PtString(thisAlertID.toString()))); }); invalidateAlertBtn.addClickListener(event -> { AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow(); Integer thisAlertID = new Integer(selectedAlertBean.getID()); PtBoolean res; res = sys.oeInvalidateAlert(new DtAlertID(new PtString(thisAlertID.toString()))); }); getAlertsSetBtn.addClickListener(event -> { if (alertStatus.getValue().toString().equals("Pending")) actCoordinator.oeGetAlertsSet(EtAlertStatus.pending); else if (alertStatus.getValue().toString().equals("Valid")) actCoordinator.oeGetAlertsSet(EtAlertStatus.valid); else if (alertStatus.getValue().toString().equals("Invalid")) actCoordinator.oeGetAlertsSet(EtAlertStatus.invalid); }); alertButtons1.addComponents(validateAlertBtn, invalidateAlertBtn); alertButtons2.addComponents(getAlertsSetBtn, alertStatus); ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// NavigationBar crisesBar = new NavigationBar(); VerticalComponentGroup crisesContent = new VerticalComponentGroup(); crisesContent.setWidth("100%"); crisesContent.setResponsive(true); HorizontalLayout crisesButtons1 = new HorizontalLayout(); HorizontalLayout crisesButtons2 = new HorizontalLayout(); crisesBar.setCaption("Coordinator " + ctCoordinator.login.toString()); //NavigationButton logoutBtn2 = new NavigationButton("Logout"); Button logoutBtn2 = new Button("Logout"); crisesBar.setRightComponent(logoutBtn2); crisesTable = new Grid(); crisesTable.setContainerDataSource(actCoordinator.getCrisesContainer()); crisesTable.setColumnOrder("ID", "date", "time", "type", "longitude", "latitude", "comment", "status"); crisesTable.setSelectionMode(SelectionMode.SINGLE); crisesTable.setWidth("100%"); //crisesTable.setSizeUndefined(); crisesTable.setImmediate(true); crisesTable.setResponsive(true); Grid inputEventsTable2 = new Grid(); inputEventsTable2.setContainerDataSource(actCoordinator.getMessagesDataSource()); inputEventsTable2.setWidth("100%"); inputEventsTable2.setResponsive(true); crisesContent.addComponents(crisesBar, crisesButtons1, crisesButtons2, crisesTable, inputEventsTable2); Tab crisesTab = this.addTab(crisesContent); crisesTab.setCaption("Crises"); Button handleCrisesBtn = new Button("Handle"); Button reportOnCrisisBtn = new Button("Report"); Button changeCrisisStatusBtn = new Button("Status"); Button closeCrisisBtn = new Button("Close"); Button getCrisesSetBtn = new Button("Get crises set"); crisesStatus = new NativeSelect(); handleCrisesBtn.setImmediate(true); reportOnCrisisBtn.setImmediate(true); changeCrisisStatusBtn.setImmediate(true); closeCrisisBtn.setImmediate(true); getCrisesSetBtn.setImmediate(true); crisesStatus.setImmediate(true); crisesStatus.addItems("Pending", "Handled", "Solved", "Closed"); crisesStatus.setNullSelectionAllowed(false); crisesStatus.select("Pending"); crisesButtons1.addComponents(handleCrisesBtn, reportOnCrisisBtn, changeCrisisStatusBtn); crisesButtons2.addComponents(closeCrisisBtn, getCrisesSetBtn, crisesStatus); //////////////////////////////////////// Window reportCrisisSubWindow = new Window(); reportCrisisSubWindow.setClosable(false); reportCrisisSubWindow.setResizable(false); reportCrisisSubWindow.setResponsive(true); VerticalLayout reportLayout = new VerticalLayout(); reportLayout.setMargin(true); reportLayout.setSpacing(true); reportCrisisSubWindow.setContent(reportLayout); TextField crisisID = new TextField(); TextField reportText = new TextField(); HorizontalLayout buttonsLayout = new HorizontalLayout(); Button reportCrisisBtn = new Button("Report"); reportCrisisBtn.setClickShortcut(KeyCode.ENTER); reportCrisisBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancelBtn = new Button("Cancel"); buttonsLayout.addComponents(reportCrisisBtn, cancelBtn); buttonsLayout.setSpacing(true); reportLayout.addComponents(crisisID, reportText, buttonsLayout); cancelBtn.addClickListener(event -> { reportCrisisSubWindow.close(); reportText.clear(); }); reportCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); actCoordinator.oeReportOnCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())), new DtComment(new PtString(reportText.getValue()))); reportCrisisSubWindow.close(); reportText.clear(); }); //////////////////////////////////////// Window changeCrisisStatusSubWindow = new Window(); changeCrisisStatusSubWindow.setClosable(false); changeCrisisStatusSubWindow.setResizable(false); changeCrisisStatusSubWindow.setResponsive(true); VerticalLayout statusLayout = new VerticalLayout(); statusLayout.setMargin(true); statusLayout.setSpacing(true); changeCrisisStatusSubWindow.setContent(statusLayout); TextField crisisID1 = new TextField(); NativeSelect crisisStatus = new NativeSelect("crisis status"); crisisStatus.addItems("Pending", "Handled", "Solved", "Closed"); crisisStatus.setNullSelectionAllowed(false); crisisStatus.select("Pending"); HorizontalLayout buttonsLayout1 = new HorizontalLayout(); Button changeCrisisStatusBtn1 = new Button("Change status"); changeCrisisStatusBtn1.setClickShortcut(KeyCode.ENTER); changeCrisisStatusBtn1.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancelBtn1 = new Button("Cancel"); buttonsLayout1.addComponents(changeCrisisStatusBtn1, cancelBtn1); buttonsLayout1.setSpacing(true); statusLayout.addComponents(crisisID1, crisisStatus, buttonsLayout1); cancelBtn1.addClickListener(event -> changeCrisisStatusSubWindow.close()); changeCrisisStatusBtn1.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); EtCrisisStatus statusToPut = null; if (crisisStatus.getValue().toString().equals("Pending")) statusToPut = EtCrisisStatus.pending; if (crisisStatus.getValue().toString().equals("Handled")) statusToPut = EtCrisisStatus.handled; if (crisisStatus.getValue().toString().equals("Solved")) statusToPut = EtCrisisStatus.solved; if (crisisStatus.getValue().toString().equals("Closed")) statusToPut = EtCrisisStatus.closed; PtBoolean res = actCoordinator.oeSetCrisisStatus(new DtCrisisID(new PtString(thisCrisisID.toString())), statusToPut); changeCrisisStatusSubWindow.close(); }); //////////////////////////////////////// handleCrisesBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); PtBoolean res = actCoordinator .oeSetCrisisHandler(new DtCrisisID(new PtString(thisCrisisID.toString()))); }); reportOnCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); reportCrisisSubWindow.center(); crisisID.setValue(thisCrisisID.toString()); crisisID.setEnabled(false); reportText.focus(); UI.getCurrent().addWindow(reportCrisisSubWindow); }); changeCrisisStatusBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); changeCrisisStatusSubWindow.center(); crisisID1.setValue(thisCrisisID.toString()); crisisID1.setEnabled(false); crisisStatus.focus(); UI.getCurrent().addWindow(changeCrisisStatusSubWindow); }); closeCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); PtBoolean res = actCoordinator.oeCloseCrisis(new DtCrisisID(new PtString(thisCrisisID.toString()))); }); getCrisesSetBtn.addClickListener(event -> { if (crisesStatus.getValue().toString().equals("Closed")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.closed); if (crisesStatus.getValue().toString().equals("Handled")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.handled); if (crisesStatus.getValue().toString().equals("Solved")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.solved); if (crisesStatus.getValue().toString().equals("Pending")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.pending); }); ClickListener logoutAction = event -> { PtBoolean res; try { res = actCoordinator.oeLogout(); if (res.getValue()) { } } catch (Exception e) { e.printStackTrace(); } Page.getCurrent().reload(); }; logoutBtn1.addClickListener(logoutAction); logoutBtn2.addClickListener(logoutAction); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
Layout getSelectPreviews() { Layout grid = getPreviewLayout("Selects"); ComboBox combo = new ComboBox(); addSelectItems(combo, true, 100);/* w w w. j a v a2 s .co m*/ grid.addComponent(combo); combo = new ComboBox(); addSelectItems(combo, true, 100); combo.setStyleName("small"); grid.addComponent(combo); combo = new ComboBox(); addSelectItems(combo, true, 100); combo.setStyleName("big"); grid.addComponent(combo); combo = new ComboBox(); addSelectItems(combo, false, 5); combo.setStyleName("search"); combo.setInputPrompt("Search combo"); grid.addComponent(combo); combo = new ComboBox(); addSelectItems(combo, false, 5); combo.setStyleName("small search"); combo.setInputPrompt("Small search combo"); grid.addComponent(combo); combo = new ComboBox(); addSelectItems(combo, false, 5); combo.setStyleName("big search"); combo.setInputPrompt("Big search combo"); grid.addComponent(combo); NativeSelect s = new NativeSelect(); addSelectItems(s, true, 10); grid.addComponent(s); s = new NativeSelect(); addSelectItems(s, true, 10); s.setStyleName("small"); grid.addComponent(s); s = new NativeSelect(); addSelectItems(s, true, 10); s.setStyleName("big"); grid.addComponent(s); combo = new ComboBox(); addSelectItems(combo, false, 5); combo.setInputPrompt("Just click me"); combo.setStyleName("select-button"); // Must always specify width combo.setWidth("150px"); grid.addComponent(combo); combo.setDescription(combo.getDescription() + "<br><strong>You must always specify an explicit width for a combobox with this style, otherwise it will not work</strong>"); return grid; }
From source file:org.escidoc.browser.ui.GroupRolesView.java
License:Open Source License
private static NativeSelect buildResourceSelect() { NativeSelect select = new NativeSelect(); select.setWidth("250px"); select.setNullSelectionAllowed(false); select.setMultiSelect(false);/* w w w . ja v a 2 s .c o m*/ select.setNewItemsAllowed(false); select.setImmediate(true); return select; }
From source file:org.escidoc.browser.ui.GroupRolesView.java
License:Open Source License
private NativeSelect buildRoleNameSelect(final NativeSelect resourceTypeSelect, final NativeSelect resourceSelect) { NativeSelect roleNameSelect = new NativeSelect(); roleNameSelect.setMultiSelect(false); roleNameSelect.setNewItemsAllowed(false); roleNameSelect.setNullSelectionAllowed(false); roleNameSelect.setImmediate(true);//from www . j a v a 2s . c om roleNameSelect.setRequired(true); roleNameSelect.setRequiredError("Role can not be empty."); roleNameSelect.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() instanceof RoleModel) { final List<ResourceType> resourceTypeList = new ArrayList<ResourceType>(); for (final ResourceType resourceType : buildScopeDefinitions( (RoleModel) event.getProperty().getValue())) { if (resourceType != null && !resourceType.equals(ResourceType.COMPONENT)) { resourceTypeList.add(resourceType); } } resourceTypeSelect.removeAllItems(); bind(resourceTypeSelect, resourceTypeList); } } private void bind(NativeSelect resourceTypeSelect, List<ResourceType> resourceTypeList) { enableScoping(resourceTypeSelect, resourceTypeList.size() > 0); final BeanItemContainer<ResourceType> dataSource = new BeanItemContainer<ResourceType>( ResourceType.class, resourceTypeList); resourceTypeSelect.setContainerDataSource(dataSource); resourceTypeSelect.setItemCaptionPropertyId(PropertyId.NAME); if (dataSource.size() > 0) { resourceTypeSelect.setValue(dataSource.getIdByIndex(0)); } } private void enableScoping(NativeSelect resourceTypeSelect, boolean isEnabled) { resourceTypeSelect.setVisible(isEnabled); resourceSelect.setVisible(isEnabled); } }); return roleNameSelect; }