List of usage examples for com.vaadin.ui HorizontalLayout getComponent
public Component getComponent(int index) throws IndexOutOfBoundsException
From source file:org.escidoc.browser.ui.GroupRolesView.java
License:Open Source License
private void bind(HorizontalLayout grantRow, Grant grant) throws EscidocClientException { NativeSelect roleNameSelect = (NativeSelect) grantRow.getComponent(0); roleNameSelect.setContainerDataSource(buildRoleNameDataSource()); roleNameSelect.setItemCaptionPropertyId(PropertyId.NAME); Collection<?> collection = roleNameSelect.getContainerDataSource().getItemIds(); for (Object object : collection) { ResourceModel rm = (ResourceModel) object; if (grant.getProperties() == null || grant.getProperties().getRole() == null || grant.getProperties().getRole().getXLinkTitle() == null) { return; }/*ww w. j a v a 2s.c om*/ // LOG.debug(" Inside " + rm.getName()); if (rm.getName().equalsIgnoreCase(grant.getProperties().getRole().getXLinkTitle())) { // THIS ONE TAKES TOO LONG FOR SOME REASON roleNameSelect.setValue(rm); } } bindResourceType(grantRow, (RoleModel) roleNameSelect.getValue(), grant); }
From source file:org.escidoc.browser.ui.GroupRolesView.java
License:Open Source License
private void bindResourceType(HorizontalLayout grantRow, RoleModel value, Grant grant) throws EscidocClientException { if (value == null) { router.getMainWindow().showNotification("Inconsistency Detected", "There was a grant which does no longer exist as a role: " + grant.getXLinkTitle()); } else {// w w w. j a va2 s.c o m final List<ResourceType> resourceTypeList = buildScopeDefinitions(value); NativeSelect resourceTypeSelect = (NativeSelect) grantRow.getComponent(1); final BeanItemContainer<ResourceType> dataSource = new BeanItemContainer<ResourceType>( ResourceType.class, resourceTypeList); resourceTypeSelect.setContainerDataSource(dataSource); resourceTypeSelect.setItemCaptionPropertyId(PropertyId.NAME); // TODO refactor this if (dataSource.size() > 0 && (NativeSelect) grantRow.getComponent(2) != null) { resourceTypeSelect.setValue(dataSource.getIdByIndex(0)); loadData((NativeSelect) grantRow.getComponent(2), dataSource.getIdByIndex(0)); for (Object object : ((NativeSelect) grantRow.getComponent(2)).getContainerDataSource() .getItemIds()) { Reference assignedOn = grant.getProperties().getAssignedOn(); if (assignedOn == null) { LOG.debug("no resource: " + assignedOn); } else if (assignedOn != null && getRoleName(object).equalsIgnoreCase(assignedOn.getXLinkTitle())) { ((NativeSelect) grantRow.getComponent(2)).select(object); } } } } }
From source file:org.escidoc.browser.ui.useraccount.UserRolesView.java
License:Open Source License
private void bind(HorizontalLayout grantRow, Grant grant) throws EscidocClientException { NativeSelect roleNameSelect = (NativeSelect) grantRow.getComponent(0); roleNameSelect.setContainerDataSource(buildRoleNameDataSource()); roleNameSelect.setItemCaptionPropertyId(PropertyId.NAME); // // FIXME this causes a bad performance Collection<?> collection = roleNameSelect.getContainerDataSource().getItemIds(); for (Object object : collection) { ResourceModel rm = (ResourceModel) object; if (grant.getProperties() == null || grant.getProperties().getRole() == null || grant.getProperties().getRole().getXLinkTitle() == null) { return; }// w w w .j a v a 2s. c om if (rm.getName().equalsIgnoreCase(grant.getProperties().getRole().getXLinkTitle())) { roleNameSelect.setValue(rm); } } bindResourceType(grantRow, (RoleModel) roleNameSelect.getValue(), grant); }
From source file:org.escidoc.browser.ui.useraccount.UserRolesView.java
License:Open Source License
private void bindResourceType(HorizontalLayout grantRow, RoleModel value, Grant grant) throws EscidocClientException { final List<ResourceType> resourceTypeList = buildScopeDefinitions(value); NativeSelect resourceTypeSelect = (NativeSelect) grantRow.getComponent(1); final BeanItemContainer<ResourceType> dataSource = new BeanItemContainer<ResourceType>(ResourceType.class, resourceTypeList);/*from w w w .j a va 2s .c o m*/ resourceTypeSelect.setContainerDataSource(dataSource); resourceTypeSelect.setItemCaptionPropertyId(PropertyId.NAME); // TODO refactor this if (dataSource.size() > 0 && (NativeSelect) grantRow.getComponent(2) != null) { resourceTypeSelect.setValue(dataSource.getIdByIndex(0)); loadData((NativeSelect) grantRow.getComponent(2), dataSource.getIdByIndex(0)); for (Object object : ((NativeSelect) grantRow.getComponent(2)).getContainerDataSource().getItemIds()) { Reference assignedOn = grant.getProperties().getAssignedOn(); if (assignedOn != null && getRoleName(object).equalsIgnoreCase(assignedOn.getXLinkTitle())) { ((NativeSelect) grantRow.getComponent(2)).select(object); } } } }
From source file:org.inakirj.imagerulette.screens.DiceURLSetupView.java
License:Open Source License
/** * Generate lottery list.//from w w w. j a va 2 s . com * * @return the list */ private List<Object> generateLotteryList() { List<Object> randomList = new ArrayList<>(); Iterator<Component> iterator = imagesLayout.iterator(); while (iterator.hasNext()) { HorizontalLayout hl = (HorizontalLayout) iterator.next(); Image imageSelected = (Image) hl.getComponent(0); Image img = new Image("", imageSelected.getSource()); img.setData(imageSelected.getData()); Slider slider = (Slider) hl.getComponent(1); int rep = slider.getValue().intValue(); while (rep > 0) { randomList.add(img); rep--; } } return randomList; }
From source file:org.inakirj.imagerulette.screens.DiceURLSetupView.java
License:Open Source License
/** * Enable dice tab or not.//ww w . j a v a 2s. c om */ private void enableDiceTabOrNot() { Iterator<Component> iterator = imagesLayout.iterator(); while (iterator.hasNext()) { HorizontalLayout hl = (HorizontalLayout) iterator.next(); Slider slider = (Slider) hl.getComponent(1); if (slider.getValue().intValue() > 0) { tabContent3.setEnabled(true); MyUI ui = (MyUI) UI.getCurrent(); ui.setLottery(generateLotteryList()); return; } } tabContent3.setEnabled(false); }
From source file:org.opencms.ui.apps.CmsQuickLaunchEditor.java
License:Open Source License
/** * Saves the changed apps setting.<p> *///from w w w.j a v a 2s . com void saveToUser() { List<String> apps = new ArrayList<String>(); HorizontalLayout appsLayout = m_userApps.getWrappedLayout(); int count = appsLayout.getComponentCount(); for (int i = 0; i < count; i++) { WrappedDraggableComponent wrapper = (WrappedDraggableComponent) appsLayout.getComponent(i); apps.add(wrapper.getItemId()); } try { OpenCms.getWorkplaceAppManager().setUserQuickLaunchApps(A_CmsUI.getCmsObject(), apps); } catch (CmsException e) { CmsErrorDialog.showErrorDialog("Could not write user Quicklaunch apps", e); } close(); }
From source file:uicomponents.MSSampleMultiplicationTable.java
License:Open Source License
private ComboBox parseBoxRow(Object id, String propertyName) { Item item = sampleTable.getItem(id); Object component = item.getItemProperty(propertyName).getValue(); if (component instanceof ComboBox) return (ComboBox) component; else {//from ww w . j a v a 2s . c o m HorizontalLayout h = (HorizontalLayout) component; return (ComboBox) h.getComponent(0); } }