List of usage examples for com.vaadin.ui Button setData
public void setData(Object data)
From source file:nl.kpmg.lcm.ui.view.transfer.SchedulePanel.java
License:Apache License
public Button createViewButton(MetaDataRepresentation item) { Button viewButton = new Button("view"); viewButton.setData(item); viewButton.addClickListener((event) -> { MetadataEditWindow metadataEditWindow = new MetadataEditWindow(restClientService, (MetaDataRepresentation) event.getButton().getData()); UI.getCurrent().addWindow(metadataEditWindow); });/*from ww w .j a v a 2s .c o m*/ viewButton.addStyleName("link"); return viewButton; }
From source file:nl.kpmg.lcm.ui.view.transfer.SchedulePanel.java
License:Apache License
public Button createTransferButton(MetaDataRepresentation item) { Button transferButton = new Button("transfer"); transferButton.setData(item); transferButton.addClickListener(new ClickListener() { @Override/* w w w.ja v a 2s. c om*/ public void buttonClick(Button.ClickEvent event) { MetaDataRepresentation data = (MetaDataRepresentation) event.getButton().getData(); String url = remoteLcmUrlMap.get(lastRemoteLcmId); StartTransferWindow storageCreateWindow = new StartTransferWindow(restClientService, lastRemoteLcmId, url, data.getItem()); UI.getCurrent().addWindow(storageCreateWindow); } }); transferButton.addStyleName("link"); return transferButton; }
From source file:nl.kpmg.lcm.ui.view.transfer.SchedulePanel.java
License:Apache License
public Button createDeleteButton(MetaDataRepresentation item) { String currentLcmId = null;//from w w w. j a v a2s. com try { currentLcmId = restClientService.getLcmId().getItem().getLcmId(); } catch (Exception ex) { LOGGER.warn("Unable to get the local LCM id. Error message: " + ex.getMessage()); return null; } MetaData metadata = item.getItem(); MetaDataWrapper wrapper = new MetaDataWrapper(metadata); List<String> transferHistory = wrapper.getTransferHistory().getTransferHistory(); if (transferHistory == null) { LOGGER.info("The metadata with id: " + metadata.getId() + " does not have transfer history."); return null; } String lastLcmIdInTransferHistory = transferHistory.get(transferHistory.size() - 1); if (!lastLcmIdInTransferHistory.equals(currentLcmId)) { LOGGER.info("The local LCM id is not the last LCM id in the transfer history of the metadata with id: " + metadata.getId()); return null; } Button deleteButton = new Button("delete"); deleteButton.setData(item); deleteButton.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { restClientService.deleteRemoteData(metadata.getId(), lastRemoteLcmId); Notification.show("Remote data deletion started successfully."); } catch (Exception ex) { Notification.show("Unable to delete the remote data."); LOGGER.warn("Unable to delete the remote data. Error message: " + ex.getMessage()); } } }); deleteButton.addStyleName("link"); return deleteButton; }
From source file:nz.co.senanque.vaadinsupport.MaduraForm.java
License:Apache License
protected Button createButton(String name, ButtonPainter painter, ClickListener listener, Object data) { Button ret = m_maduraFieldFactory.createButton(name, listener, painter); painter.setForm(this); m_myButtons.add(ret);/*w ww .ja va2 s . co m*/ if (data != null) { ret.setData(data); } return ret; }
From source file:nz.co.senanque.workflowui.LaunchWizard.java
License:Apache License
@SuppressWarnings("serial") private Component getFinalLayout(String processName, final long processId, final boolean launcher) { VerticalLayout ret = new VerticalLayout(); Button okay = new Button(m_messageSourceAccessor.getMessage("OK", "Okay")); HorizontalLayout actions = new HorizontalLayout(); Label label = new Label( m_messageSourceAccessor.getMessage("launched.processid", new Object[] { processName, processId })); ret.addComponent(label);/*from w w w . ja v a 2 s . co m*/ actions.setMargin(true); actions.setSpacing(true); actions.addComponent(okay); okay.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); Button button = (com.vaadin.ui.Button) (event.getSource()); button.setData((launcher ? WorkflowForm.LAUNCH : WorkflowForm.OK) + processId); fireEvent(event); } }); ret.addComponent(actions); Button attachments = new Button(m_messageSourceAccessor.getMessage("attachments", "Attachments")); actions.addComponent(attachments); attachments.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { m_attachmentsPopup.load(processId); } }); return ret; }
From source file:org.activiti.explorer.ui.process.simple.editor.table.PropertyTable.java
License:Apache License
protected void addPropertyRow(Object itemId, String propertyName, String propertyType, Boolean required) { Object newItemId = null;/* w w w . j a v a 2 s.c o m*/ if (itemId == null) { // add at the end of list newItemId = addItem(); } else { newItemId = addItemAfter(itemId); } Item newItem = getItem(newItemId); // name newItem.getItemProperty(ID_PROPERTY_NAME) .setValue(propertyName == null ? DEFAULT_PROPERTY_NAME : propertyName); // type ComboBox typeComboBox = new ComboBox("", Arrays.asList("text", "number", "date")); typeComboBox.setNullSelectionAllowed(false); if (propertyType == null) { typeComboBox.setValue(typeComboBox.getItemIds().iterator().next()); } else { typeComboBox.setValue(propertyType); } newItem.getItemProperty(ID_PROPERTY_TYPE).setValue(typeComboBox); // required CheckBox requiredCheckBox = new CheckBox(); requiredCheckBox.setValue(required == null ? false : required); newItem.getItemProperty(ID_PROPERTY_REQUIRED).setValue(requiredCheckBox); // actions HorizontalLayout actionButtons = new HorizontalLayout(); Button deleteRowButton = new Button("-"); deleteRowButton.setData(newItemId); deleteRowButton.addListener(new DeletePropertyClickListener(this)); actionButtons.addComponent(deleteRowButton); Button addRowButton = new Button("+"); addRowButton.setData(newItemId); addRowButton.addListener(new AddPropertyClickListener(this)); actionButtons.addComponent(addRowButton); newItem.getItemProperty(ID_PROPERTY_ACTIONS).setValue(actionButtons); }
From source file:org.activiti.explorer.ui.process.simple.editor.table.TaskTable.java
License:Apache License
protected HorizontalLayout generateActionButtons(Object taskItemId) { HorizontalLayout actionButtons = new HorizontalLayout(); FormDefinition form = taskFormModel.getForm(taskItemId); Button formButton = new Button( form == null ? i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_FORM_CREATE) : i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_FORM_EDIT)); formButton.addListener(new ShowFormClickListener(taskFormModel, taskItemId)); formButton.setData(taskItemId); actionButtons.addComponent(formButton); Button deleteTaskButton = new Button("-"); deleteTaskButton.setData(taskItemId); deleteTaskButton.addListener(new DeleteTaskClickListener(this)); actionButtons.addComponent(deleteTaskButton); Button addTaskButton = new Button("+"); addTaskButton.setData(taskItemId);//from w ww . j av a 2 s . c o m addTaskButton.addListener(new AddTaskClickListener(this)); actionButtons.addComponent(addTaskButton); return actionButtons; }
From source file:org.activiti.kickstart.ui.panel.SelectAdhocWorkflowPanel.java
License:Apache License
protected void initWorkflowTableContents() { List<KickstartWorkflowInfo> processDefinitions = adhocWorkflowService.findKickstartWorkflowInformation(); for (final KickstartWorkflowInfo infoDto : processDefinitions) { Item workflowItem = workflowTable.getItem(workflowTable.addItem()); Button nameButton = new Button(infoDto.getName()); nameButton.setStyleName("link"); nameButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 5671158538486627690L; public void buttonClick(ClickEvent event) { viewManager.showPopupWindow(new ProcessImagePopupWindow(viewManager, infoDto.getId())); }/*from w ww . j a v a 2 s .c o m*/ }); workflowItem.getItemProperty("name").setValue(nameButton); workflowItem.getItemProperty("key").setValue(infoDto.getKey()); workflowItem.getItemProperty("version").setValue(infoDto.getVersion()); workflowItem.getItemProperty("createTime").setValue(infoDto.getCreateTime()); workflowItem.getItemProperty("nrOfRunningInstance").setValue(infoDto.getNrOfRuntimeInstances()); workflowItem.getItemProperty("nrOfHistoricInstances").setValue(infoDto.getNrOfHistoricInstances()); HorizontalLayout actions = new HorizontalLayout(); actions.setSpacing(true); Button editButton = new Button("edit"); editButton.setStyleName("link"); // editButton.setIcon(editImage); editButton.setData(infoDto.getId()); editButton .addListener(new EditExistingKickstartWorkflowClickListener(viewManager, adhocWorkflowService)); actions.addComponent(editButton); StreamResource.StreamSource streamSource = new StreamSource() { private static final long serialVersionUID = -8875067466181823014L; public InputStream getStream() { return ServiceLocator.getAdhocWorkflowService().getProcessBpmnXml(infoDto.getId()); } }; Link bpmnXmlLink = new Link("get xml", new StreamResource(streamSource, infoDto.getKey() + ".bpmn20.xml", viewManager.getApplication())); // bpmnXmlLink.setIcon(xmlImage); actions.addComponent(bpmnXmlLink); workflowItem.getItemProperty("actions").setValue(actions); } workflowTable.setPageLength(workflowTable.size()); }
From source file:org.activiti.kickstart.ui.panel.SelectWorkflowPanel.java
License:Apache License
protected void initWorkflowTableContents() { List<KickstartWorkflowInfo> processDefinitions = kickstartService.findWorkflowInformation(true); for (final KickstartWorkflowInfo infoDto : processDefinitions) { Item workflowItem = workflowTable.getItem(workflowTable.addItem()); Button nameButton = new Button(infoDto.getName()); nameButton.setStyleName("link"); nameButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 5671158538486627690L; public void buttonClick(ClickEvent event) { KickstartApplication.get().getViewManager() .showPopupWindow(new ProcessImagePopupWindow(infoDto.getId())); }//w w w . j av a2 s. c om }); workflowItem.getItemProperty("name").setValue(nameButton); workflowItem.getItemProperty("key").setValue(infoDto.getKey()); workflowItem.getItemProperty("version").setValue(infoDto.getVersion()); workflowItem.getItemProperty("createTime").setValue(infoDto.getCreateTime()); workflowItem.getItemProperty("nrOfRunningInstance").setValue(infoDto.getNrOfRuntimeInstances()); workflowItem.getItemProperty("nrOfHistoricInstances").setValue(infoDto.getNrOfHistoricInstances()); HorizontalLayout actions = new HorizontalLayout(); actions.setSpacing(true); Button editButton = new Button("edit"); editButton.setStyleName("link"); // editButton.setIcon(editImage); editButton.setData(infoDto.getId()); editButton.addListener(new EditExistingKickstartWorkflowClickListener(kickstartService)); actions.addComponent(editButton); StreamResource.StreamSource streamSource = new StreamSource() { private static final long serialVersionUID = -8875067466181823014L; public InputStream getStream() { return KickstartApplication.get().getKickstartService().getBpmnXml(infoDto.getId()); } }; Link bpmnXmlLink = new Link("get xml", new StreamResource(streamSource, infoDto.getKey() + ".bpmn20.xml", KickstartApplication.get())); // bpmnXmlLink.setIcon(xmlImage); actions.addComponent(bpmnXmlLink); workflowItem.getItemProperty("actions").setValue(actions); } workflowTable.setPageLength(workflowTable.size()); }
From source file:org.activiti.kickstart.ui.table.PropertyTable.java
License:Apache License
protected void addPropertyRow(Object itemId, String propertyName, String propertyType, Boolean required) { Object newItemId = null;/*from w ww .jav a 2 s . co m*/ if (itemId == null) { // add at the end of list newItemId = addItem(); } else { newItemId = addItemAfter(itemId); } Item newItem = getItem(newItemId); // name newItem.getItemProperty("property").setValue(propertyName == null ? "My Property" : propertyName); // type ComboBox typeComboBox = new ComboBox("types", Arrays.asList("text", "number", "date")); if (propertyType == null) { typeComboBox.setValue(typeComboBox.getItemIds().iterator().next()); typeComboBox.setNullSelectionAllowed(false); } else { typeComboBox.setValue(propertyType); } newItem.getItemProperty("type").setValue(typeComboBox); // required CheckBox requiredCheckBox = new CheckBox(); requiredCheckBox.setValue(required == null ? false : required); newItem.getItemProperty("required").setValue(requiredCheckBox); // actions HorizontalLayout actionButtons = new HorizontalLayout(); Button deleteRowButton = new Button("-"); deleteRowButton.setData(newItemId); deleteRowButton.addListener(new DeletePropertyClickListener(this)); actionButtons.addComponent(deleteRowButton); Button addRowButton = new Button("+"); addRowButton.setData(newItemId); addRowButton.addListener(new AddPropertyClickListener(this)); actionButtons.addComponent(addRowButton); newItem.getItemProperty("actions").setValue(actionButtons); }