List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:org.milleni.dunning.ui.prcstart.TaskViewPanel.java
License:Apache License
protected void initSettingsProperties() { detailLayout.setMargin(true, true, true, false); panelLayout = new VerticalLayout(); detailLayout.addComponent(panelLayout); queryActionLayout = createHorizontalLayout(); panelLayout.addComponent(queryActionLayout); queryLayout = new VerticalLayout(); queryLayout.setSpacing(true);/* w w w . j a v a 2s . c o m*/ actionLayout = new VerticalLayout(); actionLayout.setSpacing(true); queryActionLayout.addComponent(queryLayout); queryActionLayout.addComponent(actionLayout); panelLayout.setSpacing(true); queryLayout.addComponent(taskDefCombo); Button cmdRetrieve = new Button("Getir"); final Button cmdRetrieveCustomers = new Button("Sonuclari Getir"); lblEntityCount = new Label("Kayit Sayisi"); lblEntityCount.addStyleName(ExplorerLayout.STYLE_H3); lblEntityCount.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); cmdRetrieveCustomers.setIcon(Images.EXECUTE); cmdRetrieve.setIcon(Images.EXECUTE); cmdRetrieve.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { long entityCount = runtimeService.createNativeExecutionQuery().sql( "SELECT count([PROC_INST_ID_]) FROM [dunning_migration].[dbo].[ACT_RU_TASK] where [TASK_DEF_KEY_] ='taskYasalProblemli'") .count(); lblEntityCount.setValue(entityCount); if (entityCount > 0) { queryLayout.addComponent(cmdRetrieveCustomers); } else { queryLayout.removeComponent(cmdRetrieveCustomers); } } }); cmdRetrieveCustomers.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { addDunningProcessMaster(); } catch (Exception ex) { notificationManager.showErrorNotification("Hata", "" + ex.getMessage()); } } }); queryLayout.addComponent(cmdRetrieve); queryLayout.addComponent(lblEntityCount); }
From source file:org.milleni.dunning.ui.prcstart.TaskViewPanel.java
License:Apache License
protected void addDunningProcessMaster() { List<Object[]> objects = dunningProcessMasterRepository.listTaskAndProcDefs(); // dunningProcessLayout.addComponent(tasksHeader); lastChangesTable = new Table(); lastChangesTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST); lastChangesTable.setWidth(100, UNITS_PERCENTAGE); lastChangesTable.setHeight(250, UNITS_PIXELS); lastChangesTable.setEditable(false); lastChangesTable.setImmediate(true); lastChangesTable.setSelectable(true); lastChangesTable.setNullSelectionAllowed(false); lastChangesTable.setSortDisabled(true); lastChangesTable.addContainerProperty("CustomerId", String.class, null, "Musteri", null, Table.ALIGN_LEFT); lastChangesTable.addContainerProperty("Desc", String.class, null, "Durum", null, Table.ALIGN_LEFT); for (Object[] obj : objects) { Object newItemId = lastChangesTable.addItem(); Item row1 = lastChangesTable.getItem(newItemId); row1.getItemProperty("CustomerId").setValue(obj[0]); row1.getItemProperty("Desc").setValue(obj[1]); }// w w w. j av a 2 s . c om /* List<Map<String, Object>> rows = query.toArray(); List<Item> items = new ArrayList<Item>(); for (Map<String, Object> row : query) { Item tbItem = lastChangesTable.addItem(row); HashMap<String, Object> newRow = new HashMap<String, Object>(); System.out.println(newRow); } panelLayout.addComponent(lastChangesTable); */ final ThemeResource export = new ThemeResource("../images/table-excel.png"); final Button excelExportButton = new Button(); excelExportButton.setIcon(export); excelExportButton.setStyleName(BaseTheme.BUTTON_LINK); excelExportButton.addListener(new ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; public void buttonClick(final ClickEvent event) { excelExport = new ExcelExport(lastChangesTable); excelExport.excludeCollapsedColumns(); excelExport.setDisplayTotals(false); excelExport.setRowHeaders(true); CellStyle cs = excelExport.getTitleStyle(); cs.setFillBackgroundColor(HSSFColor.GREY_25_PERCENT.index); excelExport.setTitleStyle(cs); excelExport.setDoubleDataFormat("0.00"); excelExport.setExcelFormatOfProperty("konto", "0"); excelExport.export(); } }); panelLayout.addComponent(excelExportButton); panelLayout.addComponent(lastChangesTable); }
From source file:org.openeos.erp.sales.ui.VaadinPrintDocumentUsertaskUI.java
License:Apache License
@SuppressWarnings("unchecked") @Override/*from w w w . j av a 2 s . c o m*/ protected VerticalLayout createVaadinComponent(UserTask userTask, UIApplication<IUnoVaadinApplication> application) { EntityInfo info = extractEntity(userTask); String documentName = userTask.getMetaData(METADATA_PRINT_DOCUMENT_NAME); if (documentName == null || documentName.trim().length() == 0) { throw new IllegalArgumentException("The user task has not document meta data"); } System.out.print(info.classDefinition); final EntityDocument document = entityDocumentService .findDocument((Class<Object>) info.classDefinition.getClassDefined(), info.entity, documentName); if (document == null) { throw new RuntimeException("Document not found"); } final StreamSource streamSource = new StreamSource() { @Override public InputStream getStream() { try { return document.openInputStream(); } catch (IOException e) { throw new RuntimeException(e); } } }; final StreamResource resource = new StreamResource(streamSource, document.getName(), application.getConcreteApplication().getMainWindow().getApplication()); VerticalLayout layout = super.createVaadinComponent(userTask, application); Panel panel = createPanel("Documents"); panel.setWidth("100%"); Button buttonDocument = new Button(); buttonDocument.setStyleName(Reindeer.BUTTON_LINK); buttonDocument.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { event.getButton().getWindow().open(resource, document.getName()); } }); buttonDocument.setCaption(documentName); panel.addComponent(buttonDocument); layout.addComponent(panel); return layout; }
From source file:org.openeos.services.ui.vaadin.internal.DefaultVaadinERPWindowFactory.java
License:Apache License
protected Component createToolBarButton(final WindowAction action, final IWindow window) { final Button button = new Button(); button.setCaption(action.getCaption()); button.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// w w w .j ava 2 s . c o m public void buttonClick(ClickEvent event) { action.run(window); } }); button.setEnabled(action.isEnabledForWindow(window)); window.addSelectionChangeListener(new SelectionChangeListener() { @Override public void selectionChange(SelectionChangeEvent selectionChangeEvent) { button.setEnabled(action.isEnabledForWindow(window)); } }); window.addTabChangeListener(new TabChangeListener() { @Override public void tabChange(TabChangeEvent tabChangeEvent) { button.setEnabled(action.isEnabledForWindow(window)); } }); window.addViewChangeListener(new ViewChangeListener() { @Override public void viewChange(ViewChangeEvent viewChangeEvent) { button.setEnabled(action.isEnabledForWindow(window)); } }); return button; }
From source file:org.openeos.services.ui.vaadin.internal.notifications.VaadinNotificationManager.java
License:Apache License
private void refreshLayout(final IUnoVaadinApplication application, HorizontalLayout layout) { layout.removeAllComponents();/*w ww .j a v a2 s . c o m*/ for (final Notification notification : resolveAndSortNotifications(application)) { VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(false); vLayout.setSpacing(false); Button button = new Button(); button.addListener(new Button.ClickListener() { private static final long serialVersionUID = 3202745949615598633L; @Override public void buttonClick(ClickEvent event) { notification.onClick(applicationFactory.createApplication(application)); ; } }); button.setStyleName(Reindeer.BUTTON_LINK); button.setIcon(createIconResource(application, notification)); button.setDescription(notification.getText()); //createOverlay(application, notification, button, layout); vLayout.addComponent(button); if (notification.getNumber() != null) { Label label = new Label(notification.getNumber().toString()); label.setSizeUndefined(); vLayout.addComponent(label); vLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); } layout.addComponent(vLayout); } }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private void addToolbarButtons(HorizontalLayout hLayout) { HorizontalLayout newLayout = new HorizontalLayout(); newLayout.setMargin(false);/*from w w w.j a v a 2 s.c om*/ Button buttonRefresh = new Button(); buttonRefresh.setStyleName(Reindeer.BUTTON_LINK); buttonRefresh.setIcon(Resources.ICON_32_REFRESH); buttonRefresh.setDescription("Refresh"); buttonRefresh.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { refresh(); } }); newLayout.addComponent(buttonRefresh); Button buttonNew = new Button(); buttonNew.setStyleName(Reindeer.BUTTON_LINK); buttonNew.setIcon(Resources.ICON_32_NEW); buttonNew.setDescription("New task"); buttonNew.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { newTask(); } }); newLayout.addComponent(buttonNew); hLayout.addComponent(newLayout); }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private ComponentContainer createSummaryButtons(final UserTask task) { Button completeButton = new Button("Task completed"); completeButton.setWidth("100%"); completeButton.addListener(new Button.ClickListener() { @Override/*from w w w . ja v a 2s. c o m*/ public void buttonClick(ClickEvent event) { completeTask(task); } }); VerticalLayout buttonsLayout = new VerticalLayout(); buttonsLayout.addComponent(completeButton); buttonsLayout.setWidth(16, VerticalLayout.UNITS_EM); return buttonsLayout; }
From source file:org.opennms.features.jmxconfiggenerator.webui.ui.UIHelper.java
License:Open Source License
public static Button createButton(final String buttonCaption, final String iconName, final ClickListener clickListener) { Button button = new Button(); button.setCaption(buttonCaption);/*from www . j ava 2s . com*/ button.setIcon(IconProvider.getIcon(iconName)); if (clickListener != null) button.addListener(clickListener); return button; }
From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java
License:Open Source License
@SuppressWarnings("serial") @Override//w ww.jav a2s .co m public void init() { setTheme("topo_default"); m_rootLayout = new AbsoluteLayout(); m_rootLayout.setSizeFull(); m_window = new Window("OpenNMS Topology"); m_window.setContent(m_rootLayout); setMainWindow(m_window); m_uriFragUtil = new UriFragmentUtility(); m_window.addComponent(m_uriFragUtil); m_uriFragUtil.addListener(this); m_layout = new AbsoluteLayout(); m_layout.setSizeFull(); m_rootLayout.addComponent(m_layout); if (m_showHeader) { HEADER_HEIGHT = 100; Panel header = new Panel("header"); header.setCaption(null); header.setSizeUndefined(); header.addStyleName("onmsheader"); m_rootLayout.addComponent(header, "top: 0px; left: 0px; right:0px;"); try { CustomLayout customLayout = new CustomLayout(getHeaderLayout()); header.setContent(customLayout); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { HEADER_HEIGHT = 0; } Refresher refresher = new Refresher(); refresher.setRefreshInterval(5000); getMainWindow().addComponent(refresher); m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm()); final Property scale = m_graphContainer.getScaleProperty(); m_topologyComponent = new TopologyComponent(m_graphContainer, m_iconRepositoryManager, m_selectionManager, this); m_topologyComponent.setSizeFull(); m_topologyComponent.addMenuItemStateListener(this); m_topologyComponent.addVertexUpdateListener(this); final Slider slider = new Slider(0, 1); slider.setPropertyDataSource(scale); slider.setResolution(1); slider.setHeight("300px"); slider.setOrientation(Slider.ORIENTATION_VERTICAL); slider.setImmediate(true); final Button zoomInBtn = new Button(); zoomInBtn.setIcon(new ThemeResource("images/plus.png")); zoomInBtn.setDescription("Expand Semantic Zoom Level"); zoomInBtn.setStyleName("semantic-zoom-button"); zoomInBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) m_graphContainer.getSemanticZoomLevel(); szl++; m_graphContainer.setSemanticZoomLevel(szl); setSemanticZoomLevel(szl); saveHistory(); } }); Button zoomOutBtn = new Button(); zoomOutBtn.setIcon(new ThemeResource("images/minus.png")); zoomOutBtn.setDescription("Collapse Semantic Zoom Level"); zoomOutBtn.setStyleName("semantic-zoom-button"); zoomOutBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) m_graphContainer.getSemanticZoomLevel(); if (szl > 0) { szl--; m_graphContainer.setSemanticZoomLevel(szl); setSemanticZoomLevel(szl); saveHistory(); } } }); final Button panBtn = new Button(); panBtn.setIcon(new ThemeResource("images/cursor_drag_arrow.png")); panBtn.setDescription("Pan Tool"); panBtn.setStyleName("toolbar-button down"); final Button selectBtn = new Button(); selectBtn.setIcon(new ThemeResource("images/selection.png")); selectBtn.setDescription("Selection Tool"); selectBtn.setStyleName("toolbar-button"); selectBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { selectBtn.setStyleName("toolbar-button down"); panBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("select"); } }); panBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { panBtn.setStyleName("toolbar-button down"); selectBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("pan"); } }); VerticalLayout toolbar = new VerticalLayout(); toolbar.setWidth("31px"); toolbar.addComponent(panBtn); toolbar.addComponent(selectBtn); HorizontalLayout semanticLayout = new HorizontalLayout(); semanticLayout.addComponent(zoomInBtn); semanticLayout.addComponent(m_zoomLevelLabel); semanticLayout.addComponent(zoomOutBtn); semanticLayout.setComponentAlignment(m_zoomLevelLabel, Alignment.MIDDLE_CENTER); AbsoluteLayout mapLayout = new AbsoluteLayout(); mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;"); mapLayout.addComponent(slider, "top: 5px; left: 20px; z-index:1000;"); mapLayout.addComponent(toolbar, "top: 324px; left: 12px;"); mapLayout.addComponent(semanticLayout, "top: 380px; left: 2px;"); mapLayout.setSizeFull(); m_treeMapSplitPanel = new HorizontalSplitPanel(); m_treeMapSplitPanel.setFirstComponent(createWestLayout()); m_treeMapSplitPanel.setSecondComponent(mapLayout); m_treeMapSplitPanel.setSplitPosition(222, Sizeable.UNITS_PIXELS); m_treeMapSplitPanel.setSizeFull(); m_commandManager.addCommandUpdateListener(this); menuBarUpdated(m_commandManager); if (m_widgetManager.widgetCount() != 0) { updateWidgetView(m_widgetManager); } else { m_layout.addComponent(m_treeMapSplitPanel, getBelowMenuPosition()); } if (m_treeWidgetManager.widgetCount() != 0) { updateAccordionView(m_treeWidgetManager); } }
From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java
License:Open Source License
/** * Creates the west area layout including the * accordion and tree views./*from w ww .j a v a 2 s. c o m*/ * * @return */ @SuppressWarnings("serial") private Layout createWestLayout() { m_tree = createTree(); final TextField filterField = new TextField("Filter"); filterField.setTextChangeTimeout(200); final Button filterBtn = new Button("Filter"); filterBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { GCFilterableContainer container = m_tree.getContainerDataSource(); container.removeAllContainerFilters(); String filterString = (String) filterField.getValue(); if (!filterString.equals("") && filterBtn.getCaption().toLowerCase().equals("filter")) { container.addContainerFilter(LABEL_PROPERTY, (String) filterField.getValue(), true, false); filterBtn.setCaption("Clear"); } else { filterField.setValue(""); filterBtn.setCaption("Filter"); } } }); HorizontalLayout filterArea = new HorizontalLayout(); filterArea.addComponent(filterField); filterArea.addComponent(filterBtn); filterArea.setComponentAlignment(filterBtn, Alignment.BOTTOM_CENTER); m_treeAccordion = new Accordion(); m_treeAccordion.addTab(m_tree, m_tree.getTitle()); m_treeAccordion.setWidth("100%"); m_treeAccordion.setHeight("100%"); AbsoluteLayout absLayout = new AbsoluteLayout(); absLayout.setWidth("100%"); absLayout.setHeight("100%"); absLayout.addComponent(filterArea, "top: 25px; left: 15px;"); absLayout.addComponent(m_treeAccordion, "top: 75px; left: 15px; right: 15px; bottom:25px;"); return absLayout; }