List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:org.escidoc.browser.elabsmodul.views.helpers.StartInvestigationViewHelper.java
License:Open Source License
public void createStartButton(Panel panel) { Button startBtn = new Button(ELabsViewContants.BTN_START); startBtn.setWidth("100%"); startBtn.addListener(new Button.ClickListener() { private static final long serialVersionUID = -7563393988056484131L; @Override/*from w w w .j av a2s. c om*/ public void buttonClick(final ClickEvent event) { if (event.getButton().getCaption().equals(ELabsViewContants.BTN_START)) { labsPanel.getReference().getApplication().getMainWindow() .addWindow(new YesNoDialog("Start investigation", "Really want to start the investigation?", new YesNoDialog.Callback() { @Override public void onDialogResult(boolean resultIsYes) { if (resultIsYes) { try { investigationAction.getLabsService().start(); event.getButton().setCaption(ELabsViewContants.BTN_STOP); labsPanel.getReference().getApplication().getMainWindow() .getWindow().showNotification("Starting", "Starting process...", Notification.TYPE_TRAY_NOTIFICATION); } catch (EscidocBrowserException e) { event.getButton().setCaption(ELabsViewContants.BTN_START); labsPanel.getReference().getApplication().getMainWindow() .getWindow().showNotification("Problem", "Starting process... cancelled", Notification.TYPE_TRAY_NOTIFICATION); } } } })); } else if (event.getButton().getCaption().equals(ELabsViewContants.BTN_STOP)) { try { investigationAction.getLabsService().stop(); event.getButton().setCaption(ELabsViewContants.BTN_START); labsPanel.getReference().getApplication().getMainWindow().getWindow().showNotification( "Stopping", "Halting process...", Notification.TYPE_TRAY_NOTIFICATION); } catch (EscidocBrowserException e) { event.getButton().setCaption(ELabsViewContants.BTN_STOP); labsPanel.getReference().getApplication().getMainWindow().getWindow().showNotification( "Problem", "Halting process... cancelled", Notification.TYPE_TRAY_NOTIFICATION); } } else { LOG.error("There is no such button!"); } } }); HorizontalLayout layout = new HorizontalLayout(); layout.addComponent(startBtn); layout.setWidth("100%"); layout.setComponentAlignment(startBtn, Alignment.MIDDLE_CENTER); panel.addComponent(layout); }
From source file:org.escidoc.browser.layout.NavigationSimpleLayout.java
License:Open Source License
private CssLayout newHeaderButton(final TreeDataSource ds) { CssLayout cssLayout = new CssLayout(); cssLayout.setWidth("97%"); cssLayout.setMargin(false);/*from w w w . j a v a2s .co m*/ ThemeResource plusIcon = new ThemeResource("images/assets/plus.png"); final Button createGroupButton = new Button(); createGroupButton.setStyleName(BaseTheme.BUTTON_LINK); createGroupButton.addStyleName("floatright paddingtop3"); createGroupButton.setWidth("20px"); createGroupButton.setIcon(plusIcon); createGroupButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) { showCreateGroupView(); } private void showCreateGroupView() { router.getMainWindow().addWindow( new CreateGroupView(repositories.group(), router.getMainWindow(), ds).modalWindow()); } }); cssLayout.addComponent(createGroupButton); return cssLayout; }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
@SuppressWarnings("serial") private Panel lblAddtionalResources() { final Panel pnl = new Panel(); pnl.setSizeFull();//from ww w .j a v a2 s . c o m VerticalLayout hl = new VerticalLayout(); hl.setSizeFull(); final Button btnVersionHistoryContainer = new Button("Container Version History", new VersionHistoryClickListener(resourceProxy, mainWindow, repositories)); btnVersionHistoryContainer.setStyleName(BaseTheme.BUTTON_LINK); btnVersionHistoryContainer.setDescription("Show Version history in a Pop-up"); final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, "Additional Resources"); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(ICON); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { final Window subwindow = new Window("A modal subwindow"); subwindow.setModal(true); subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); subwindow.addComponent(new Label("Not yet implemented")); Button close = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); router.getMainWindow().addWindow(subwindow); } }); cssLayout.addComponent(addResourceButton); hl.addComponent(cssLayout); hl.addComponent(btnVersionHistoryContainer); pnl.setContent(hl); return pnl; }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
private Panel lblMetadaRecs() { panel.setSizeFull();//ww w .j a va 2 s . c o m VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); cssLayout.setHeight("20px"); buildPanelHeader(cssLayout, ViewConstants.METADATA); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (containerController.hasAccess()) { final Button btnAddNew = new Button(); btnAddNew.addListener(new OnAddContainerMetadata(mainWindow, repositories, resourceProxy)); btnAddNew.setStyleName(BaseTheme.BUTTON_LINK); btnAddNew.addStyleName("floatright paddingtop3"); btnAddNew.setWidth("20px"); btnAddNew.setIcon(ICON); cssLayout.addComponent(btnAddNew); } vl.addComponent(cssLayout); ContainerMetadataTable metadataTable = new ContainerMetadataTable(resourceProxy.getMetadataRecords(), containerController, router, resourceProxy, repositories); metadataTable.buildTable(); vl.addComponent(metadataTable); vl.setComponentAlignment(metadataTable, Alignment.TOP_LEFT); vl.setExpandRatio(metadataTable, 0.9f); panel.setContent(vl); return panel; }
From source file:org.escidoc.browser.ui.maincontent.ContextRightPanel.java
License:Open Source License
@SuppressWarnings("serial") private Panel buildAdminDescription() { final Panel admDescriptors = new Panel(); admDescriptors.setWidth("100%"); admDescriptors.setHeight("100%"); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull();/*from w w w. j a v a2 s . com*/ final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, ViewConstants.ADMIN_DESCRIPTION); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (contextController.canUpdateContext()) { final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(ICON); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { new OnContextAdminDescriptor(router, contextController).adminDescriptorForm(); } }); cssLayout.addComponent(addResourceButton); } vl.addComponent(cssLayout); VerticalLayout vl2 = new VerticalLayout(); final AdminDescriptors admDesc = resourceProxy.getAdminDescription(); final AdminDescriptorsTable adminDescriptorTable = new AdminDescriptorsTable(contextController, admDesc, router); adminDescriptorTable.buildTable(); vl2.addComponent(adminDescriptorTable); vl.addComponent(vl2); vl.setExpandRatio(vl2, 9); admDescriptors.setContent(vl); return admDescriptors; }
From source file:org.escidoc.browser.ui.maincontent.ContextRightPanel.java
License:Open Source License
@SuppressWarnings("serial") private Panel buildOrganizationUnit() { final Panel pnlOrgUnit = new Panel(); pnlOrgUnit.setSizeFull();//from ww w . ja va2s. co m VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, ViewConstants.ORGANIZATIONAL_UNIT); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (contextController.canAddOUs()) { final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(ICON); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) { final Window subwindow = new Window("A modal subwindow"); subwindow.setModal(true); subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); try { subwindow.addComponent(new AddOrgUnitstoContext(router, resourceProxy, contextController, resourceProxy.getOrganizationalUnit())); } catch (EscidocClientException e) { contextController.showError(e); } Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { subwindow.getParent().removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); router.getMainWindow().addWindow(subwindow); } }); cssLayout.addComponent(addResourceButton); } vl.addComponent(cssLayout); OrganizationalUnitsTableVH orgUnitTable = new OrganizationalUnitsTableVH(contextController, resourceProxy.getOrganizationalUnit(), router, resourceProxy); orgUnitTable.buildTable(); vl.addComponent(orgUnitTable); vl.setComponentAlignment(orgUnitTable, Alignment.TOP_LEFT); vl.setExpandRatio(orgUnitTable, 9f); pnlOrgUnit.setContent(vl); return pnlOrgUnit; }
From source file:org.escidoc.browser.ui.maincontent.CreateOrgUnitView.java
License:Open Source License
@SuppressWarnings("serial") private void buildForm() { form.setImmediate(true);// w w w. ja v a 2 s. c o m // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); form.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); form.addField("txtDescContext", txtDescContext); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final OrgUnitModel child = storeInRepository(txtNameContext, txtDescContext); updateTree(child); form.commit(); resetFields(); showSuccesfullMessage(txtNameContext); } catch (final EmptyValueException e) { mainWindow.showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { mainWindow.showNotification(ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } finally { closeSubWindow(); } } private void updateTree(final OrgUnitModel child) { dataSource.addChild(parent, child); } private void showSuccesfullMessage(final TextField txtNameContext) { mainWindow.showNotification( "Organizational Unit " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); } private void resetFields() { form.getField("txtNameContext").setValue(""); form.getField("txtDescContext").setValue(""); } private void closeSubWindow() { mainWindow.removeWindow(subwindow); } private OrgUnitModel storeInRepository(final TextField txtNameContext, final TextField txtDescContext) throws EscidocClientException, ParserConfigurationException, SAXException, IOException { final OrgUnitBuilder orgBuilder = new OrgUnitBuilder(); OrganizationalUnit orgUnit = orgBuilder .with(txtNameContext.getValue().toString(), txtDescContext.getValue().toString()).build(); if (parent != null) { Set set = new HashSet(); set.add(parent.getId()); orgBuilder.parents(set); } return repo.create(orgUnit); } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); form.getLayout().addComponent(btnAddContext); form.getField("txtNameContext").setRequired(true); form.getField("txtNameContext").setRequiredError("Name is missing"); form.getField("txtDescContext").setRequired(true); form.getField("txtDescContext").setRequiredError("Description is missing"); }
From source file:org.escidoc.browser.ui.maincontent.ItemContent.java
License:Open Source License
private void initView() { final CssLayout cssLayout = new CssLayout(); cssLayout.setHeight("20px"); buildPanelHeader(cssLayout, ViewConstants.COMPONENTS); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (true) {/*from ww w .j a va2 s. co m*/ final Button btnAddNew = new Button(); btnAddNew.addListener(new Button.ClickListener() { @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { Window modalWindow = new Window("Select a file to add."); modalWindow.setWidth("25%"); modalWindow.setHeight("20%"); modalWindow.setModal(true); modalWindow.addComponent(new ComponentUploadView(repositories, controller, itemProxy, ItemContent.this, mainWindow)); mainWindow.addWindow(modalWindow); } }); btnAddNew.setStyleName(BaseTheme.BUTTON_LINK); btnAddNew.addStyleName("floatright paddingtop3"); btnAddNew.setWidth("20px"); btnAddNew.setIcon(ICON); cssLayout.addComponent(btnAddNew); } verticalLayout.addComponent(cssLayout); wrap(verticalLayout); if (controller.hasComponents()) { verticalLayout.addComponent(buildTable()); } else { final Label lblNoComponents = new Label( "No components in this Item. You can drag n'drop some file from your computer to this box to add new components!"); lblNoComponents.setWidth("90%"); lblNoComponents.setStyleName("skybluetext"); verticalLayout.addComponent(lblNoComponents); } }
From source file:org.escidoc.browser.ui.maincontent.MetadataRecsItem.java
License:Open Source License
private Panel lblMetadaRecs() { pnl.setSizeFull();//from ww w . ja v a 2s . c om VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); cssLayout.setHeight("20px"); buildPanelHeader(cssLayout, ViewConstants.METADATA); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); ItemMetadataTable metadataItem = new ItemMetadataTable(itemController, router, resourceProxy, repositories); metadataItem.buildTable(); if (itemController.hasAccess()) { final Button btnAddNew = new Button(); btnAddNew.addListener(new AddMetaDataFileItemBehaviour(mainWindow, repositories, resourceProxy)); btnAddNew.setStyleName(BaseTheme.BUTTON_LINK); btnAddNew.addStyleName("floatright paddingtop3"); btnAddNew.setWidth("20px"); btnAddNew.setIcon(ICON); cssLayout.addComponent(btnAddNew); } vl.addComponent(cssLayout); vl.addComponent(metadataItem); vl.setExpandRatio(metadataItem, 9f); pnl.setContent(vl); return pnl; }
From source file:org.escidoc.browser.ui.maincontent.OrgUnitMetadataRecordsView.java
License:Open Source License
@SuppressWarnings("serial") private Component buildMetaDataTab() { Panel innerPanel = new Panel(); innerPanel.setSizeFull();//from w ww.j a va2s .c o m VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); cssLayout.setHeight("20px"); buildPanelHeader(cssLayout, ViewConstants.METADATA); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (canAddMetadata()) { final Button addNewOrgUnitBtn = new Button(); addNewOrgUnitBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { OnAddOrgUnitMetadata view = new OnAddOrgUnitMetadata(controller, router.getMainWindow()); view.showAddWindow(); } }); addNewOrgUnitBtn.setStyleName(BaseTheme.BUTTON_LINK); addNewOrgUnitBtn.addStyleName("floatright paddingtop3"); addNewOrgUnitBtn.setWidth("20px"); addNewOrgUnitBtn.setIcon(ICON); cssLayout.addComponent(addNewOrgUnitBtn); } vl.addComponent(cssLayout); OrgUnitMetadataTable metadataTable = new OrgUnitMetadataTable(orgUnit.getMetadataRecords(), controller, router); metadataTable.buildTable(); vl.addComponent(metadataTable); vl.setExpandRatio(metadataTable, 9); innerPanel.setContent(vl); return innerPanel; }