List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:my.vaadin.profile.MainLayout.java
public void addMenuOption(String caption, final Component component) { Button button = new Button(caption); button.setWidth("100%"); button.setStyleName("borderless"); menuLayout.addComponent(button);//from w ww . ja v a 2 s.c om button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { contentLayout.removeAllComponents(); contentLayout.addComponent(component); } }); }
From source file:nl.amc.biolab.nsg.display.component.ProcessingForm.java
License:Open Source License
public void setButtons() { HorizontalLayout buttons = new HorizontalLayout(); buttons.setHeight("40px"); buttons.setSpacing(true);// w w w.java2 s . c o m getLayout().addComponent(buttons); final Button startButton = new NativeButton(); startButton.setCaption(SUBMIT); startButton.setImmediate(true); startButton.setWidth("-1px"); startButton.setHeight("-1px"); startButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1906358615316029946L; public void buttonClick(ClickEvent event) { System.out.println(app.getValue()); Set<Long> inputDbIds = new HashSet<Long>(); for (Object iid : inputData.getItemIds()) { inputData.select(iid); inputDbIds.add(((DataElement) iid).getDbId()); } ((VaadinTestApplication) getApplication()).getUserDataService().setDataElementDbIds(inputDbIds); form.commit(); processing.setApplication((Application) app.getValue()); startButton.setData(processing); form.fireEvent(new Event(startButton)); } }); buttons.addComponent(startButton); buttons.setComponentAlignment(startButton, Alignment.TOP_RIGHT); final Button delButton = new NativeButton(); delButton.setCaption("remove inputs"); delButton.setImmediate(true); delButton.setWidth("-1px"); delButton.setHeight("-1px"); delButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -3377452914254101817L; @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { if (inputData.getValue() != null) { for (DataElement de : (Set<DataElement>) inputData.getValue()) { inputData.removeItem(de); dataElements.remove(de); } } } }); buttons.addComponent(delButton); buttons.setComponentAlignment(delButton, Alignment.TOP_RIGHT); }
From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java
License:Open Source License
private void createSubmissionButtons(final VaadinTestApplication app, final SubmissionIO submissionIO, final nl.amc.biolab.datamodel.objects.Error error) { final Link statusLink = new Link("download", new StreamResource(new StreamSource() { private static final long serialVersionUID = 2010850543250392280L; public InputStream getStream() { String status;//from w w w . j a v a2 s . c om if (error != null) { status = error.getCode() + "\n" + error.getMessage() + "\n" + error.getDescription(); } else { status = "No message"; } return new ByteArrayInputStream(status.getBytes()); } }, "status", getApplication()), "", 400, 300, 2); viewStatusButton = new NativeButton("Details"); viewStatusButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -8337533736203519683L; @Override public void buttonClick(ClickEvent event) { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = 1520192489661790818L; { center(); setWidth("700px"); setHeight("500px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent(statusLink); String status; if (error != null) { status = error.getCode() + "\n" + error.getMessage() + "\n" + error.getDescription(); } else { status = "No message"; } //status += "<img src=\"images/prov.png\""; vl.addComponent(new Label(status, Label.CONTENT_PREFORMATTED)); addComponent(vl); } }); } }); resubmitButton = new NativeButton("Resume"); resubmitButton.setData(processingStatusForm); resubmitButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -6410875548044234734L; @Override public void buttonClick(ClickEvent event) { long dbId = processingStatus.getProcessing().getDbId(); long liferayID = app.getLiferayId(processingStatus.getProcessing().getUser().getLiferayID()); processingService.resubmit(dbId, submissionIO.getSubmission().getDbId(), userDataService.getUserId(), liferayID); processingStatusForm.attach(); } }); markFailButton = new NativeButton("Abort"); markFailButton.setData(processingStatusForm); markFailButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -5019762936706219454L; @Override public void buttonClick(ClickEvent event) { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = 3852384470521127702L; { final Window window = this; center(); setWidth("500px"); setHeight("300px"); VerticalLayout vl = new VerticalLayout(); final TextField text = new TextField("Remarks to the user"); text.setWidth("97%"); text.setHeight("150px"); vl.addComponent(text); final Button okButton = new NativeButton(); okButton.setCaption("Save"); okButton.setImmediate(true); okButton.setWidth("-1px"); okButton.setHeight("-1px"); okButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1754437322024958253L; public void buttonClick(ClickEvent event) { long dbId = processingStatus.getProcessing().getDbId(); long userID = processingStatus.getProcessing().getUser().getDbId(); long liferayID = app .getLiferayId(processingStatus.getProcessing().getUser().getLiferayID()); processingService.markFailed(submissionIO.getSubmission().getDbId(), (String) text.getValue()); processingStatus = processingService.getProcessingStatus( userDataService.getProcessing(dbId), userID, liferayID, false); refreshButton.setData(processingStatus); processingStatusForm.fireValueChange(false);//fireEvent(new Event(refreshButton)); window.getParent().removeWindow(window); } }); vl.addComponent(okButton); addComponent(vl); } }); } }); // } remarksButton = new NativeButton("Why?"); remarksButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -267778012100029422L; @Override public void buttonClick(ClickEvent event) { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = -5026454769214596711L; { List<nl.amc.biolab.datamodel.objects.Error> temp = submissionIO.getSubmission().getErrors(); center(); setWidth("700px"); setHeight("500px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent( new Label(temp.get(temp.size() - 1).getMessage(), Label.CONTENT_PREFORMATTED)); addComponent(vl); } }); } }); }
From source file:org.activiti.editor.ui.NewModelPopupWindow.java
License:Apache License
protected void addButtons() { // Create/*from ww w . j a v a2s .c o m*/ Button createButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW_POPUP_CREATE_BUTTON)); createButton.setWidth("200px"); createButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (StringUtils.isEmpty((String) nameTextField.getValue())) { nameTextField.setComponentError(new UserError("The name field is required.")); return; } if (selectEditorComponent.isModelerPreferred()) { try { ObjectMapper objectMapper = new ObjectMapper(); ObjectNode editorNode = objectMapper.createObjectNode(); editorNode.put("id", "canvas"); editorNode.put("resourceId", "canvas"); ObjectNode stencilSetNode = objectMapper.createObjectNode(); stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#"); editorNode.put("stencilset", stencilSetNode); Model modelData = repositoryService.newModel(); ObjectNode modelObjectNode = objectMapper.createObjectNode(); modelObjectNode.put(MODEL_NAME, (String) nameTextField.getValue()); modelObjectNode.put(MODEL_REVISION, 1); String description = null; if (StringUtils.isNotEmpty((String) descriptionTextArea.getValue())) { description = (String) descriptionTextArea.getValue(); } else { description = ""; } modelObjectNode.put(MODEL_DESCRIPTION, description); modelData.setMetaInfo(modelObjectNode.toString()); modelData.setName((String) nameTextField.getValue()); repositoryService.saveModel(modelData); repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8")); close(); ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(modelData.getId()); URL explorerURL = ExplorerApp.get().getURL(); URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "modeler.html?modelId=" + modelData.getId()); ExplorerApp.get().getMainWindow().open(new ExternalResource(url)); } catch (Exception e) { notificationManager.showErrorNotification("error", e); } } else { close(); ExplorerApp.get().getViewManager().showSimpleTableProcessEditor( (String) nameTextField.getValue(), (String) descriptionTextArea.getValue()); } } }); // Alignment HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(createButton); addComponent(buttonLayout); windowLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); }
From source file:org.activiti.kickstart.ui.panel.ActionsPanel.java
License:Apache License
public ActionsPanel(ViewManager viewManager) { setStyleName(Reindeer.PANEL_LIGHT);/*from w w w . ja v a 2s .c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); Button createAdhocWorkflowButton = new Button(CREATE_WORKFLOW); createAdhocWorkflowButton.setWidth("132px"); createAdhocWorkflowButton.addListener(new CreateKickstartWorkflowClickListener(viewManager)); Button enhanceWorkflowButton = new Button(ENHANCE_WORKFLOW); enhanceWorkflowButton.setWidth("132px"); enhanceWorkflowButton.addListener(new EnhanceWorkflowClickListener(viewManager)); layout.addComponent(createAdhocWorkflowButton); layout.addComponent(enhanceWorkflowButton); addComponent(layout); }
From source file:org.apache.usergrid.chop.webapp.view.log.LogLayout.java
License:Apache License
private void addRefreshButton() { Button button = new Button("Refresh"); button.setWidth("100px"); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { loadData();/*from w w w. jav a2s . co m*/ } }); addComponent(button); setComponentAlignment(button, Alignment.BOTTOM_CENTER); this.setExpandRatio(button, 0.05f); }
From source file:org.apache.usergrid.chop.webapp.view.runner.RunnersLayout.java
License:Apache License
private void addRefreshButton() { Button button = new Button("Refresh"); button.setWidth("100px"); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { loadData();/*from w w w .j a v a2 s . c o m*/ } }); addComponent(button); this.setComponentAlignment(button, Alignment.BOTTOM_CENTER); }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static Button addButton(AbsoluteLayout layout, String caption, String position, String width) { Button button = new Button(caption); button.setWidth(width); layout.addComponent(button, position); return button; }
From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java
License:Open Source License
private Button createBulkUploadStatusButton() { final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.BULK_UPLOAD_STATUS_BUTTON, "", "", "", false, null, SPUIButtonStyleSmall.class); button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON); button.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE); button.setWidth("100px"); button.setHtmlContentAllowed(true);/*www . j ava 2s . co m*/ button.addClickListener(event -> onClickBulkUploadNotificationButton()); button.setVisible(false); return button; }
From source file:org.eclipse.skalli.view.component.UsersPicker.java
License:Open Source License
@SuppressWarnings({ "serial", "deprecation" }) private void renderTable() { table = new Table(); table.addStyleName(STYLE_TABLE);/*from w w w .ja v a2 s . c om*/ table.setSelectable(true); table.setContainerDataSource(tableDateSource); table.addGeneratedColumn(COLUMN_USER, new Table.ColumnGenerator() { @Override public Component generateCell(Table source, Object itemId, Object columnId) { String userId = itemId.toString(); User user = UserServices.getUser(userId); PeopleComponent peopleComponent = new PeopleComponent(user); return peopleComponent; } }); if (!readOnly) { table.addGeneratedColumn(COLUMN_REMOVE, new Table.ColumnGenerator() { @Override public Component generateCell(Table source, final Object itemId, Object columnId) { Button b = new Button("remove"); b.setStyleName(Button.STYLE_LINK); b.addStyleName(STYLE_BUTTON); b.setDescription("Remove this member"); b.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { removeItem(itemId); adjustPageLength(table); } }); return b; } }); } table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); if (!readOnly) { table.setVisibleColumns(new String[] { COLUMN_USER, COLUMN_REMOVE }); table.setColumnExpandRatio(COLUMN_USER, 0.5f); table.setColumnWidth(COLUMN_REMOVE, 50); table.setColumnHeaders(new String[] { "User", "Remove" }); } else { table.setVisibleColumns(new String[] { COLUMN_USER }); table.setColumnHeaders(new String[] { "User", }); } table.setSelectable(false); table.setWidth("100%"); // do not change that! otherwise right border of table is hidden in IE! table.setReadOnly(readOnly); adjustPageLength(table); layout.addComponent(table); layout.setExpandRatio(table, 1.0f); if (!readOnly) { Button searchButton = new Button("Add user", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { PeopleSearchWindow search = new PeopleSearchWindow(UsersPicker.this, UsersPicker.this); search.show(); adjustPageLength(table); } }); searchButton.setStyle(Button.STYLE_LINK); searchButton.setDescription("Add user"); searchButton.setWidth("80px"); layout.addComponent(searchButton); } }