List of usage examples for com.vaadin.ui Alignment TOP_RIGHT
Alignment TOP_RIGHT
To view the source code for com.vaadin.ui Alignment TOP_RIGHT.
Click Source Link
From source file:org.eclipse.hawkbit.ui.management.targettag.filter.MultipleTargetFilter.java
License:Open Source License
protected void removeCancelButtonAndAddMenuBar() { targetTagTableLayout.removeComponent(cancelTagButton); targetTagTableLayout.addComponent(menu, 0); targetTagTableLayout.setComponentAlignment(menu, Alignment.TOP_RIGHT); filterByButtons.removeUpdateAndDeleteColumn(); }
From source file:org.eclipse.hawkbit.ui.management.targettag.MultipleTargetFilter.java
License:Open Source License
private Component getSimpleFilterTab() { simpleFilterTab = new VerticalLayout(); final VerticalLayout targetTagTableLayout = new VerticalLayout(); targetTagTableLayout.setSizeFull();//from ww w . ja v a2s . com if (null != config) { targetTagTableLayout.addComponent(config); targetTagTableLayout.setComponentAlignment(config, Alignment.TOP_RIGHT); } targetTagTableLayout.addComponent(filterByButtons); targetTagTableLayout.setComponentAlignment(filterByButtons, Alignment.MIDDLE_CENTER); targetTagTableLayout.setId(UIComponentIdProvider.TARGET_TAG_DROP_AREA_ID); targetTagTableLayout.setExpandRatio(filterByButtons, 1.0F); simpleFilterTab.setCaption(i18n.getMessage("caption.filter.simple")); simpleFilterTab.addComponent(targetTagTableLayout); simpleFilterTab.setExpandRatio(targetTagTableLayout, 1.0F); simpleFilterTab.addComponent(filterByStatusFotter); simpleFilterTab.setComponentAlignment(filterByStatusFotter, Alignment.MIDDLE_CENTER); simpleFilterTab.setSizeFull(); simpleFilterTab.addStyleName(SPUIStyleDefinitions.SIMPLE_FILTER_HEADER); return simpleFilterTab; }
From source file:org.eclipse.skalli.view.component.MultiLinkField.java
License:Open Source License
@SuppressWarnings({ "serial", "deprecation" }) private void render() { layout.removeAllComponents();/* w w w . j av a2 s. c o m*/ if (!readOnly) { layout.setColumns(2); } int groupsIdx = 0; int groupsSize = linkGroups.getItems().size(); for (final LinkGroup linkGroup : linkGroups.getItems()) { Label linkGroupLabel = new Label(linkGroup.getCaption()); linkGroupLabel.addStyleName(STYLE_LABEL_GROUP); layout.addComponent(linkGroupLabel); layout.setComponentAlignment(linkGroupLabel, Alignment.TOP_RIGHT); if (!readOnly) { Button btnUpGroup = null; Button btnDownGroup = null; Button btnRemoveGroup = null; // up if (groupsIdx > 0) { btnUpGroup = new Button("up"); btnUpGroup.setStyleName(Button.STYLE_LINK); btnUpGroup.addStyleName(STYLE_BUTTON_GROUPACTION); btnUpGroup.setDescription(String.format("Move up group '%s'", linkGroup.getCaption())); btnUpGroup.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroups.moveUp(linkGroup); renderIfModified(); } }); } // down if (groupsIdx < groupsSize - 1) { btnDownGroup = new Button("down"); btnDownGroup.setStyleName(Button.STYLE_LINK); btnDownGroup.addStyleName(STYLE_BUTTON_GROUPACTION); btnDownGroup.setDescription(String.format("Move down group '%s'", linkGroup.getCaption())); btnDownGroup.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroups.moveDown(linkGroup); renderIfModified(); } }); } // remove btnRemoveGroup = new Button("remove"); btnRemoveGroup.setStyleName(Button.STYLE_LINK); btnRemoveGroup.addStyleName(STYLE_BUTTON_GROUPACTION); btnRemoveGroup.setDescription(String.format("Remove group '%s'", linkGroup.getCaption())); btnRemoveGroup.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroups.remove(linkGroup); renderIfModified(); } }); HorizontalLayout toolbar = getToolbar(btnUpGroup, btnDownGroup, btnRemoveGroup); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.TOP_RIGHT); } layout.newLine(); Collection<Link> links = linkGroup.getItems(); int linksIdx = 0; int linksSize = links.size(); for (final Link link : links) { if (readOnly) { // view Label linkLabel = new Label(link.getLabel()); linkLabel.addStyleName(STYLE_LABEL_LINK); linkLabel.setDescription(StringUtils.abbreviate(link.getUrl(), 50)); layout.addComponent(linkLabel); layout.setComponentAlignment(linkLabel, Alignment.TOP_LEFT); } else { // edit Button btnEditLink = new Button(link.getLabel()); btnEditLink.setStyleName(Button.STYLE_LINK); btnEditLink.addStyleName(STYLE_LABEL_LINK); btnEditLink.setDescription(String.format("Edit link '%s' %s", link.getLabel(), StringUtils.isBlank(link.getUrl()) ? "" : "[" + link.getUrl() + "]")); btnEditLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { LinkWindow editLinkWindow = new LinkWindow(MultiLinkField.this, linkGroups.getItems(), linkGroup, link, MultiLinkField.this); editLinkWindow.show(); } }); layout.addComponent(btnEditLink); layout.setComponentAlignment(btnEditLink, Alignment.TOP_LEFT); } if (!readOnly) { Button btnUpLink = null; Button btnDownLink = null; Button btnRemoveLink = null; // up if (linksIdx > 0) { btnUpLink = new Button("up"); btnUpLink.setStyleName(Button.STYLE_LINK); btnUpLink.addStyleName(STYLE_BUTTON_LINKACTION); btnUpLink.setDescription(String.format("Move up link '%s'", link.getLabel())); btnUpLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroup.moveUp(link); renderIfModified(); } }); } // down if (linksIdx < linksSize - 1) { btnDownLink = new Button("down"); btnDownLink.setStyleName(Button.STYLE_LINK); btnDownLink.addStyleName(STYLE_BUTTON_LINKACTION); btnDownLink.setDescription(String.format("Move down link '%s'", link.getLabel())); btnDownLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroup.moveDown(link); renderIfModified(); } }); } // remove btnRemoveLink = new Button("remove"); btnRemoveLink.setStyleName(Button.STYLE_LINK); btnRemoveLink.addStyleName(STYLE_BUTTON_LINKACTION); btnRemoveLink.setDescription(String.format("Remove link '%s'", link.getLabel())); btnRemoveLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroup.remove(link); if (linkGroup.getItems().isEmpty()) { linkGroups.remove(linkGroup); } renderIfModified(); } }); HorizontalLayout toolbar = getToolbar(btnUpLink, btnDownLink, btnRemoveLink); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.TOP_RIGHT); } layout.newLine(); linksIdx++; } groupsIdx++; } if (!readOnly) { Button btnAddLink = new Button(buttonCaption, new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { LinkWindow addLinkWindow = new LinkWindow(MultiLinkField.this, linkGroups.getItems(), MultiLinkField.this); addLinkWindow.show(); } }); btnAddLink.setStyleName(Button.STYLE_LINK); btnAddLink.addStyleName(STYLE_BUTTON_ADD); btnAddLink.setDescription("Add Link"); layout.addComponent(btnAddLink); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.DepositEndpointSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); final String addNewItemProperty = "Add new..."; if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;//w w w . j a v a2 s . c o m } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { final BeanItemContainer<String> itemContainer = new BeanItemContainer<String>(String.class); for (Iterator<String> iterator = ELabsCache.getDepositEndpoints().iterator(); iterator.hasNext();) { String element = iterator.next(); itemContainer.addItem(element); } itemContainer.addItem(addNewItemProperty); final Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInvestigation( this.labsInvestigationAction, null, null, itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); if (newComponent instanceof ComboBox) { ((ComboBox) newComponent).addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 310234702020385025L; private Window addOnWindow = null; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue().equals(addNewItemProperty) && addOnWindow == null) { DepositEndpointSelectionLayoutListener.this.labsPanel.getReference() .getApplication().getMainWindow() .addWindow(addOnWindow = new AddNewEndpointURIWindow( new AddNewEndpointURIWindow.Callback() { @Override public void onAcceptAction(String inputURLText) { itemContainer.removeItem(addNewItemProperty); itemContainer.addItem(inputURLText); itemContainer.addItem(addNewItemProperty); ((ComboBox) newComponent).select(inputURLText); addOnWindow = null; } @Override public void onRefuseAction() { ((ComboBox) newComponent) .select(ELabsCache.getDefaultDepositEndpoint()); } }, false)); } } }); } } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.DepositorSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;/*from w w w . ja va 2 s . c o m*/ } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { BeanItemContainer<UserBean> itemContainer = new BeanItemContainer<UserBean>(UserBean.class); for (Iterator<UserBean> iterator = ELabsCache.getUsers().iterator(); iterator.hasNext();) { UserBean bean = iterator.next(); itemContainer.addItem(bean); } Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInvestigation( this.labsInvestigationAction, null, ELabsViewContants.P_COMPLEX_ID, itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.DeviceSupervisorSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;//from w ww. java 2 s .com } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { BeanItemContainer<UserBean> itemContainer = new BeanItemContainer<UserBean>(UserBean.class); for (Iterator<UserBean> iterator = ELabsCache.getUsers().iterator(); iterator.hasNext();) { UserBean bean = iterator.next(); itemContainer.addItem(bean); } Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInstrument( this.labsInstrumentAction, null, ELabsViewContants.P_COMPLEX_ID, itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.ESyncDaemonEndpointSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); final String addNewItemProperty = "Add new..."; if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;/*from www .jav a 2 s . c o m*/ } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { final BeanItemContainer<String> itemContainer = new BeanItemContainer<String>(String.class); for (Iterator<String> iterator = ELabsCache.getEsyncEndpoints().iterator(); iterator.hasNext();) { String element = iterator.next(); itemContainer.addItem(element); } itemContainer.addItem(addNewItemProperty); final Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInstrument( this.labsInstrumentAction, null, null, itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); if (newComponent instanceof ComboBox) { ((ComboBox) newComponent).addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2199131339856573112L; private Window addOnWindow = null; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue().equals(addNewItemProperty) && addOnWindow == null) { ESyncDaemonEndpointSelectionLayoutListener.this.labsPanel.getReference() .getApplication().getMainWindow() .addWindow(addOnWindow = new AddNewEndpointURIWindow( new AddNewEndpointURIWindow.Callback() { @Override public void onAcceptAction(String inputURLText) { itemContainer.removeItem(addNewItemProperty); itemContainer.addItem(inputURLText); itemContainer.addItem(addNewItemProperty); ((ComboBox) newComponent).select(inputURLText); addOnWindow = null; } @Override public void onRefuseAction() { ((ComboBox) newComponent).select( ELabsCache.getDefaultEsyncDaemonEndpoint()); } }, true)); } } }); } } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.FileFormatSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;/*from w w w . java2 s . co m*/ } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { BeanItemContainer<FileFormatBean> itemContainer = new BeanItemContainer<FileFormatBean>( FileFormatBean.class); for (Iterator<FileFormatBean> iterator = ELabsCache.getFileFormats().iterator(); iterator .hasNext();) { FileFormatBean bean = iterator.next(); itemContainer.addItem(bean); } Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInstrument( this.labsInstrumentAction, null, "title", itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.InstituteSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;//www . j a va 2 s . c o m } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { BeanItemContainer<OrgUnitBean> itemContainer = new BeanItemContainer<OrgUnitBean>( OrgUnitBean.class); for (Iterator<OrgUnitBean> iterator = ELabsCache.getOrgUnits().iterator(); iterator.hasNext();) { OrgUnitBean bean = iterator.next(); itemContainer.addItem(bean); } Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInstrument( this.labsInstrumentAction, null, ELabsViewContants.P_COMPLEX_ID, itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }
From source file:org.escidoc.browser.elabsmodul.views.listeners.RigSelectionLayoutListener.java
License:Open Source License
@Override public void layoutClick(LayoutClickEvent event) { final Component component = event.getComponent(); if (!(component instanceof HorizontalLayout)) { LOG.error("This listener is defined only for horizontalLayout"); return;/*from w w w . j a va2s .co m*/ } Component dataComponent = null; try { if ((dataComponent = ((HorizontalLayout) component).getComponent(1)) == null) { return; } if (dataComponent instanceof Label) { BeanItemContainer<RigBean> itemContainer = new BeanItemContainer<RigBean>(RigBean.class); for (Iterator iterator = this.controller.getAvailableRigs().iterator(); iterator.hasNext();) { RigBean bean = (RigBean) iterator.next(); itemContainer.addItem(bean); } Component newComponent = LabsLayoutHelper.createDynamicComboBoxFieldForInvestigation( this.labsInvestigationAction, null, ELabsViewContants.P_COMPLEX_ID, itemContainer); if (newComponent != null) { ((HorizontalLayout) component).replaceComponent(dataComponent, newComponent); ((HorizontalLayout) component).setComponentAlignment( ((HorizontalLayout) component).getComponent(1), Alignment.TOP_RIGHT); ((HorizontalLayout) component).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE); ((Label) ((HorizontalLayout) component).getComponent(0)) .setDescription(USER_DESCR_ON_LABEL_TO_SAVE); } } else if (dataComponent instanceof ComboBox) { if (!event.getChildComponent().equals(dataComponent)) { LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) component); } } else { LOG.error("Listener is not bound to this type of UI component: " + dataComponent.getClass().getSimpleName()); } } catch (IndexOutOfBoundsException e) { LOG.error(e.getLocalizedMessage()); } }