List of usage examples for com.vaadin.ui Panel setWidth
@Override public void setWidth(String width)
From source file:org.ikasan.dashboard.ui.topology.component.ExclusionsTab.java
License:BSD License
public Layout createLayout() { this.exclusionsTable = new Table(); this.exclusionsTable.setSizeFull(); this.exclusionsTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); this.exclusionsTable.addContainerProperty("Module Name", String.class, null); this.exclusionsTable.addContainerProperty("Flow Name", String.class, null); this.exclusionsTable.addContainerProperty("Timestamp", String.class, null); this.exclusionsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override//w w w. j av a 2s .c o m public void itemClick(ItemClickEvent itemClickEvent) { ExclusionEvent exclusionEvent = (ExclusionEvent) itemClickEvent.getItemId(); ErrorOccurrence errorOccurrence = (ErrorOccurrence) errorReportingService .find(exclusionEvent.getErrorUri()); ExclusionEventAction action = hospitalManagementService .getExclusionEventActionByErrorUri(exclusionEvent.getErrorUri()); ExclusionEventViewWindow exclusionEventViewWindow = new ExclusionEventViewWindow(exclusionEvent, errorOccurrence, serialiserFactory, action, hospitalManagementService, topologyService); exclusionEventViewWindow.addCloseListener(new Window.CloseListener() { // inline close-listener public void windowClose(CloseEvent e) { refreshExcludedEventsTable(); } }); UI.getCurrent().addWindow(exclusionEventViewWindow); } }); Button searchButton = new Button("Search"); searchButton.setStyleName(ValoTheme.BUTTON_SMALL); searchButton.addClickListener(new Button.ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { exclusionsTable.removeAllItems(); ArrayList<String> modulesNames = null; if (exclusionModules.getItemIds().size() > 0) { modulesNames = new ArrayList<String>(); for (Object module : exclusionModules.getItemIds()) { modulesNames.add(((Module) module).getName()); } } ArrayList<String> flowNames = null; if (exclusionFlows.getItemIds().size() > 0) { flowNames = new ArrayList<String>(); for (Object flow : exclusionFlows.getItemIds()) { flowNames.add(((Flow) flow).getName()); } } if (modulesNames == null && flowNames == null && !((BusinessStream) businessStreamCombo.getValue()).getName().equals("All")) { BusinessStream businessStream = ((BusinessStream) businessStreamCombo.getValue()); modulesNames = new ArrayList<String>(); for (BusinessStreamFlow flow : businessStream.getFlows()) { modulesNames.add(flow.getFlow().getModule().getName()); } } List<ExclusionEvent> exclusionEvents = exclusionManagementService.find(modulesNames, flowNames, fromDate.getValue(), toDate.getValue(), null); for (ExclusionEvent exclusionEvent : exclusionEvents) { Date date = new Date(exclusionEvent.getTimestamp()); SimpleDateFormat format = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); String timestamp = format.format(date); exclusionsTable.addItem(new Object[] { exclusionEvent.getModuleName(), exclusionEvent.getFlowName(), timestamp }, exclusionEvent); } } }); Button clearButton = new Button("Clear"); clearButton.setStyleName(ValoTheme.BUTTON_SMALL); clearButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { exclusionModules.removeAllItems(); exclusionFlows.removeAllItems(); } }); GridLayout layout = new GridLayout(1, 6); layout.setMargin(false); layout.setHeight(270, Unit.PIXELS); GridLayout listSelectLayout = new GridLayout(2, 1); listSelectLayout.setSpacing(true); listSelectLayout.setSizeFull(); exclusionModules.setIcon(VaadinIcons.ARCHIVE); exclusionModules.addContainerProperty("Module Name", String.class, null); exclusionModules.addContainerProperty("", Button.class, null); exclusionModules.setSizeFull(); exclusionModules.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); exclusionModules.setDragMode(TableDragMode.ROW); exclusionModules.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Module) { final Module module = (Module) t.getItemId(); logger.info("sourceContainer.getText(): " + module.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { exclusionModules.removeItem(module); } }); exclusionModules.addItem(new Object[] { module.getName(), deleteButton }, module); for (final Flow flow : module.getFlows()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { exclusionFlows.removeItem(flow); } }); exclusionFlows.addItem(new Object[] { flow.getName(), deleteButton }, flow); } } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(exclusionModules, 0, 0); exclusionFlows.setIcon(VaadinIcons.AUTOMATION); exclusionFlows.addContainerProperty("Flow Name", String.class, null); exclusionFlows.addContainerProperty("", Button.class, null); exclusionFlows.setSizeFull(); exclusionFlows.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); exclusionFlows.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Flow) { final Flow flow = (Flow) t.getItemId(); logger.info("sourceContainer.getText(): " + flow.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { exclusionFlows.removeItem(flow); } }); exclusionFlows.addItem(new Object[] { flow.getName(), deleteButton }, flow); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(exclusionFlows, 1, 0); GridLayout dateSelectLayout = new GridLayout(2, 1); dateSelectLayout.setSizeFull(); fromDate = new PopupDateField("From date"); fromDate.setResolution(Resolution.MINUTE); fromDate.setValue(this.getMidnightToday()); dateSelectLayout.addComponent(fromDate, 0, 0); toDate = new PopupDateField("To date"); toDate.setResolution(Resolution.MINUTE); toDate.setValue(this.getTwentyThreeFixtyNineToday()); dateSelectLayout.addComponent(toDate, 1, 0); final VerticalSplitPanel vSplitPanel = new VerticalSplitPanel(); vSplitPanel.setHeight("95%"); GridLayout searchLayout = new GridLayout(2, 1); searchLayout.setSpacing(true); searchLayout.addComponent(searchButton, 0, 0); searchLayout.addComponent(clearButton, 1, 0); final Button hideFilterButton = new Button(); hideFilterButton.setIcon(VaadinIcons.MINUS); hideFilterButton.setCaption("Hide Filter"); hideFilterButton.setStyleName(ValoTheme.BUTTON_LINK); hideFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); final Button showFilterButton = new Button(); showFilterButton.setIcon(VaadinIcons.PLUS); showFilterButton.setCaption("Show Filter"); showFilterButton.addStyleName(ValoTheme.BUTTON_LINK); showFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); showFilterButton.setVisible(false); final HorizontalLayout hListSelectLayout = new HorizontalLayout(); hListSelectLayout.setHeight(150, Unit.PIXELS); hListSelectLayout.setWidth("100%"); hListSelectLayout.addComponent(listSelectLayout); final HorizontalLayout hDateSelectLayout = new HorizontalLayout(); hDateSelectLayout.setHeight(40, Unit.PIXELS); hDateSelectLayout.setWidth("100%"); hDateSelectLayout.addComponent(dateSelectLayout); final HorizontalLayout hSearchLayout = new HorizontalLayout(); hSearchLayout.setHeight(30, Unit.PIXELS); hSearchLayout.setWidth("100%"); hSearchLayout.addComponent(searchLayout); hSearchLayout.setComponentAlignment(searchLayout, Alignment.MIDDLE_CENTER); hideFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(false); showFilterButton.setVisible(true); splitPosition = vSplitPanel.getSplitPosition(); splitUnit = vSplitPanel.getSplitPositionUnit(); vSplitPanel.setSplitPosition(0, Unit.PIXELS); } }); showFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(true); showFilterButton.setVisible(false); vSplitPanel.setSplitPosition(splitPosition, splitUnit); } }); GridLayout filterButtonLayout = new GridLayout(2, 1); filterButtonLayout.setHeight(25, Unit.PIXELS); filterButtonLayout.addComponent(hideFilterButton, 0, 0); filterButtonLayout.addComponent(showFilterButton, 1, 0); Label filterHintLabel = new Label(); filterHintLabel.setCaptionAsHtml(true); filterHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drag items from the topology tree to the tables below in order to narrow your search."); filterHintLabel.addStyleName(ValoTheme.LABEL_TINY); filterHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(filterHintLabel); layout.addComponent(hListSelectLayout); layout.addComponent(hDateSelectLayout); layout.addComponent(hSearchLayout); layout.setSizeFull(); Panel filterPanel = new Panel(); filterPanel.setHeight(300, Unit.PIXELS); filterPanel.setWidth("100%"); filterPanel.setContent(layout); filterPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); vSplitPanel.setFirstComponent(filterPanel); CssLayout hErrorTable = new CssLayout(); hErrorTable.setSizeFull(); hErrorTable.addComponent(this.exclusionsTable); vSplitPanel.setSecondComponent(hErrorTable); vSplitPanel.setSplitPosition(310, Unit.PIXELS); GridLayout wrapper = new GridLayout(1, 2); wrapper.setRowExpandRatio(0, .01f); wrapper.setRowExpandRatio(1, .99f); wrapper.setSizeFull(); wrapper.addComponent(filterButtonLayout); wrapper.setComponentAlignment(filterButtonLayout, Alignment.MIDDLE_RIGHT); wrapper.addComponent(vSplitPanel); return wrapper; }
From source file:org.ikasan.dashboard.ui.topology.component.WiretapTab.java
License:BSD License
public Layout createWiretapLayout() { this.wiretapTable = new Table(); this.wiretapTable.setSizeFull(); this.wiretapTable.addStyleName(ValoTheme.TABLE_SMALL); this.wiretapTable.addStyleName("ikasan"); this.wiretapTable.addContainerProperty("Module Name", String.class, null); this.wiretapTable.addContainerProperty("Flow Name", String.class, null); this.wiretapTable.addContainerProperty("Component Name", String.class, null); this.wiretapTable.addContainerProperty("Event Id / Payload Id", String.class, null); this.wiretapTable.addContainerProperty("Timestamp", String.class, null); this.wiretapTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); this.wiretapTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override/* ww w . j a v a 2 s . co m*/ public void itemClick(ItemClickEvent itemClickEvent) { WiretapEvent<String> wiretapEvent = (WiretapEvent<String>) itemClickEvent.getItemId(); WiretapPayloadViewWindow wiretapPayloadViewWindow = new WiretapPayloadViewWindow(wiretapEvent); UI.getCurrent().addWindow(wiretapPayloadViewWindow); } }); final Button searchButton = new Button("Search"); searchButton.setStyleName(ValoTheme.BUTTON_SMALL); searchButton.addClickListener(new Button.ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { ProgressBarWindow pbWindow = new ProgressBarWindow(); UI.getCurrent().addWindow(pbWindow); wiretapTable.removeAllItems(); HashSet<String> modulesNames = null; if (modules.getItemIds().size() > 0) { modulesNames = new HashSet<String>(); for (Object module : modules.getItemIds()) { modulesNames.add(((Module) module).getName()); } } HashSet<String> flowNames = null; if (flows.getItemIds().size() > 0) { flowNames = new HashSet<String>(); for (Object flow : flows.getItemIds()) { flowNames.add(((Flow) flow).getName()); } } HashSet<String> componentNames = null; if (components.getItemIds().size() > 0) { componentNames = new HashSet<String>(); for (Object component : components.getItemIds()) { componentNames.add("before " + ((Component) component).getName()); componentNames.add("after " + ((Component) component).getName()); } } if (modulesNames == null && flowNames == null && componentNames == null && !((BusinessStream) businessStreamCombo.getValue()).getName().equals("All")) { BusinessStream businessStream = ((BusinessStream) businessStreamCombo.getValue()); modulesNames = new HashSet<String>(); for (BusinessStreamFlow flow : businessStream.getFlows()) { modulesNames.add(flow.getFlow().getModule().getName()); } } String errorCategory = null; // TODO Need to take a proper look at the wiretap search interface. We do not need to worry about paging search // results with Vaadin. PagedSearchResult<WiretapEvent> events = wiretapDao.findWiretapEvents(0, 10000, "timestamp", false, modulesNames, flowNames, componentNames, eventId.getValue(), null, fromDate.getValue(), toDate.getValue(), payloadContent.getValue()); for (WiretapEvent<String> wiretapEvent : events.getPagedResults()) { Date date = new Date(wiretapEvent.getTimestamp()); SimpleDateFormat format = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); String timestamp = format.format(date); wiretapTable .addItem( new Object[] { wiretapEvent.getModuleName(), wiretapEvent.getFlowName(), wiretapEvent.getComponentName(), ((WiretapFlowEvent) wiretapEvent).getEventId(), timestamp }, wiretapEvent); } pbWindow.close(); } }); Button clearButton = new Button("Clear"); clearButton.setStyleName(ValoTheme.BUTTON_SMALL); clearButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { modules.removeAllItems(); flows.removeAllItems(); components.removeAllItems(); } }); GridLayout layout = new GridLayout(1, 6); layout.setMargin(false); layout.setHeight(270, Unit.PIXELS); GridLayout listSelectLayout = new GridLayout(3, 1); listSelectLayout.setSpacing(true); listSelectLayout.setSizeFull(); modules.setIcon(VaadinIcons.ARCHIVE); modules.addContainerProperty("Module Name", String.class, null); modules.addContainerProperty("", Button.class, null); modules.setSizeFull(); modules.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); modules.setDragMode(TableDragMode.ROW); modules.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Module) { final Module module = (Module) t.getItemId(); logger.info("sourceContainer.getText(): " + module.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { modules.removeItem(module); } }); modules.addItem(new Object[] { module.getName(), deleteButton }, module); for (final Flow flow : module.getFlows()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { flows.removeItem(flow); } }); flows.addItem(new Object[] { flow.getName(), deleteButton }, flow); for (final Component component : flow.getComponents()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { components.removeItem(component); } }); components.addItem(new Object[] { component.getName(), deleteButton }, component); } } } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(modules, 0, 0); flows.setIcon(VaadinIcons.AUTOMATION); flows.addContainerProperty("Flow Name", String.class, null); flows.addContainerProperty("", Button.class, null); flows.setSizeFull(); flows.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); flows.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Flow) { final Flow flow = (Flow) t.getItemId(); logger.info("sourceContainer.getText(): " + flow.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { flows.removeItem(flow); } }); flows.addItem(new Object[] { flow.getName(), deleteButton }, flow); for (final Component component : flow.getComponents()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { components.removeItem(component); } }); components.addItem(new Object[] { component.getName(), deleteButton }, component); } } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(flows, 1, 0); components.setIcon(VaadinIcons.COG); components.setSizeFull(); components.addContainerProperty("Component Name", String.class, null); components.addContainerProperty("", Button.class, null); components.setCellStyleGenerator(new IkasanCellStyleGenerator()); components.setSizeFull(); components.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); components.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Component) { final Component component = (Component) t.getItemId(); logger.info("sourceContainer.getText(): " + component.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { components.removeItem(component); } }); components.addItem(new Object[] { component.getName(), deleteButton }, component); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(this.components, 2, 0); GridLayout dateSelectLayout = new GridLayout(2, 2); dateSelectLayout.setColumnExpandRatio(0, 0.25f); dateSelectLayout.setColumnExpandRatio(1, 0.75f); dateSelectLayout.setSizeFull(); this.fromDate = new PopupDateField("From date"); this.fromDate.setResolution(Resolution.MINUTE); this.fromDate.setValue(this.getMidnightToday()); dateSelectLayout.addComponent(this.fromDate, 0, 0); this.toDate = new PopupDateField("To date"); this.toDate.setResolution(Resolution.MINUTE); this.toDate.setValue(this.getTwentyThreeFixtyNineToday()); dateSelectLayout.addComponent(this.toDate, 0, 1); this.eventId = new TextField("Event Id"); this.eventId.setWidth("80%"); this.payloadContent = new TextField("Payload Content"); this.payloadContent.setWidth("80%"); this.eventId.setNullSettingAllowed(true); this.payloadContent.setNullSettingAllowed(true); dateSelectLayout.addComponent(this.eventId, 1, 0); dateSelectLayout.addComponent(this.payloadContent, 1, 1); final VerticalSplitPanel vSplitPanel = new VerticalSplitPanel(); vSplitPanel.setHeight("95%"); GridLayout searchLayout = new GridLayout(2, 1); searchLayout.setSpacing(true); searchLayout.addComponent(searchButton, 0, 0); searchLayout.addComponent(clearButton, 1, 0); final Button hideFilterButton = new Button(); hideFilterButton.setIcon(VaadinIcons.MINUS); hideFilterButton.setCaption("Hide Filter"); hideFilterButton.setStyleName(ValoTheme.BUTTON_LINK); hideFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); final Button showFilterButton = new Button(); showFilterButton.setIcon(VaadinIcons.PLUS); showFilterButton.setCaption("Show Filter"); showFilterButton.addStyleName(ValoTheme.BUTTON_LINK); showFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); showFilterButton.setVisible(false); final HorizontalLayout hListSelectLayout = new HorizontalLayout(); hListSelectLayout.setHeight(150, Unit.PIXELS); hListSelectLayout.setWidth("100%"); hListSelectLayout.addComponent(listSelectLayout); final HorizontalLayout hDateSelectLayout = new HorizontalLayout(); hDateSelectLayout.setHeight(80, Unit.PIXELS); hDateSelectLayout.setWidth("100%"); hDateSelectLayout.addComponent(dateSelectLayout); final HorizontalLayout hSearchLayout = new HorizontalLayout(); hSearchLayout.setHeight(30, Unit.PIXELS); hSearchLayout.setWidth("100%"); hSearchLayout.addComponent(searchLayout); hSearchLayout.setComponentAlignment(searchLayout, Alignment.MIDDLE_CENTER); hideFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(false); showFilterButton.setVisible(true); splitPosition = vSplitPanel.getSplitPosition(); splitUnit = vSplitPanel.getSplitPositionUnit(); vSplitPanel.setSplitPosition(0, Unit.PIXELS); } }); showFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(true); showFilterButton.setVisible(false); vSplitPanel.setSplitPosition(splitPosition, splitUnit); } }); GridLayout filterButtonLayout = new GridLayout(2, 1); filterButtonLayout.setHeight(25, Unit.PIXELS); filterButtonLayout.addComponent(hideFilterButton, 0, 0); filterButtonLayout.addComponent(showFilterButton, 1, 0); Label filterHintLabel = new Label(); filterHintLabel.setCaptionAsHtml(true); filterHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drag items from the topology tree to the tables below in order to narrow your search."); filterHintLabel.addStyleName(ValoTheme.LABEL_TINY); filterHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(filterHintLabel); layout.addComponent(hListSelectLayout); layout.addComponent(hDateSelectLayout); layout.addComponent(hSearchLayout); layout.setSizeFull(); Panel filterPanel = new Panel(); filterPanel.setHeight(340, Unit.PIXELS); filterPanel.setWidth("100%"); filterPanel.setContent(layout); filterPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); vSplitPanel.setFirstComponent(filterPanel); CssLayout hErrorTable = new CssLayout(); hErrorTable.setSizeFull(); hErrorTable.addComponent(this.wiretapTable); vSplitPanel.setSecondComponent(hErrorTable); vSplitPanel.setSplitPosition(350, Unit.PIXELS); GridLayout wrapper = new GridLayout(1, 2); wrapper.setRowExpandRatio(0, .01f); wrapper.setRowExpandRatio(1, .99f); wrapper.setSizeFull(); wrapper.addComponent(filterButtonLayout); wrapper.setComponentAlignment(filterButtonLayout, Alignment.MIDDLE_RIGHT); wrapper.addComponent(vSplitPanel); return wrapper; }
From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java
License:BSD License
protected Panel createTextAreaPanel(ConfigurationParameter parameter, Validator validator) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);//w w w . ja v a2 s .c om paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); logger.info(parameter.getName() + " " + parameter.getValue()); Label valueLabel = new Label("Value:"); valueLabel.setSizeUndefined(); TextArea textField = new TextArea(); textField.addValidator(validator); textField.setNullSettingAllowed(true); textField.setNullRepresentation(""); textField.setValidationVisible(false); textField.setRows(4); textField.setWidth("80%"); textField.setId(parameter.getName()); if (parameter instanceof ConfigurationParameterIntegerImpl) { StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() { protected java.text.NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; }; }; // either set for the field or in your field factory for multiple fields textField.setConverter(plainIntegerConverter); } else if (parameter instanceof ConfigurationParameterLongImpl) { StringToLongConverter plainLongConverter = new StringToLongConverter() { protected java.text.NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(locale); format.setGroupingUsed(false); return format; }; }; // either set for the field or in your field factory for multiple fields textField.setConverter(plainLongConverter); } textFields.put(parameter.getName(), textField); BeanItem<ConfigurationParameter> parameterItem = new BeanItem<ConfigurationParameter>(parameter); if (parameter.getValue() != null) { textField.setPropertyDataSource(parameterItem.getItemProperty("value")); } paramLayout.addComponent(valueLabel, 0, 1); paramLayout.addComponent(textField, 1, 1); paramLayout.setComponentAlignment(valueLabel, Alignment.TOP_RIGHT); Label paramDescriptionLabel = new Label("Description:"); paramDescriptionLabel.setSizeUndefined(); TextArea descriptionTextField = new TextArea(); descriptionTextField.setRows(4); descriptionTextField.setWidth("80%"); descriptionTextField.setId(parameter.getName()); paramLayout.addComponent(paramDescriptionLabel, 0, 2); paramLayout.addComponent(descriptionTextField, 1, 2); paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT); descriptionTextFields.put(parameter.getName(), descriptionTextField); if (parameter.getDescription() != null) { descriptionTextField.setValue(parameter.getDescription()); } paramPanel.setContent(paramLayout); return paramPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java
License:BSD License
protected Panel createMapPanel(final ConfigurationParameterMapImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);// w w w . jav a2s. co m paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final Map<String, String> valueMap = parameter.getValue(); final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1); mapLayout.setMargin(true); mapLayout.setSpacing(true); int i = 0; for (final String key : valueMap.keySet()) { final Label keyLabel = new Label("Key"); final Label valueLabel = new Label("Value"); final TextField keyField = new TextField(); keyField.setValue(key); final TextField valueField = new TextField(); valueField.setValue(valueMap.get(key)); mapLayout.addComponent(keyLabel, 0, i); mapLayout.addComponent(keyField, 1, i); mapLayout.addComponent(valueLabel, 2, i); mapLayout.addComponent(valueField, 3, i); final String mapKey = parameter.getName() + i; TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; this.mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueMap.remove(key); mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label keyLabel = new Label("Key"); final Label valueLabel = new Label("Value"); final TextField keyField = new TextField(); final TextField valueField = new TextField(); mapLayout.insertRow(mapLayout.getRows()); mapLayout.removeComponent(addButton); mapLayout.addComponent(keyLabel, 0, mapLayout.getRows() - 2); mapLayout.addComponent(keyField, 1, mapLayout.getRows() - 2); mapLayout.addComponent(valueLabel, 2, mapLayout.getRows() - 2); mapLayout.addComponent(valueField, 3, mapLayout.getRows() - 2); final String mapKey = parameter.getName() + mapTextFields.size(); TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, mapLayout.getRows() - 2); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); } }); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName("dashboard"); mapPanel.setContent(mapLayout); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); Label paramDescriptionLabel = new Label("Description:"); paramDescriptionLabel.setSizeUndefined(); TextArea descriptionTextField = new TextArea(); descriptionTextField.setRows(4); descriptionTextField.setWidth("80%"); descriptionTextField.setId(parameter.getName()); paramLayout.addComponent(paramDescriptionLabel, 0, 2); paramLayout.addComponent(descriptionTextField, 1, 2); paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT); descriptionTextFields.put(parameter.getName(), descriptionTextField); if (parameter.getDescription() != null) { descriptionTextField.setValue(parameter.getDescription()); } return paramPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java
License:BSD License
protected Panel createListPanel(final ConfigurationParameterListImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);/* www .j a v a 2 s . c om*/ paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final List<String> valueList = parameter.getValue(); final GridLayout listLayout = new GridLayout(3, (valueList.size() != 0 ? valueList.size() : 1) + 1); listLayout.setWidth("450px"); listLayout.setMargin(true); listLayout.setSpacing(true); listLayout.setColumnExpandRatio(0, 0.25f); listLayout.setColumnExpandRatio(1, 0.5f); listLayout.setColumnExpandRatio(2, 0.25f); int i = 0; for (final String value : valueList) { final Label valueLabel = new Label("Value"); final TextField valueField = new TextField(); valueField.setValue(value); valueField.setWidth("90%"); listLayout.addComponent(valueLabel, 0, i); listLayout.addComponent(valueField, 1, i); final String mapKey = parameter.getName() + i; this.valueTextFields.put(mapKey, valueField); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueList.remove(value); listLayout.removeComponent(valueLabel); listLayout.removeComponent(valueField); listLayout.removeComponent(removeButton); valueTextFields.remove(mapKey); } }); listLayout.addComponent(removeButton, 2, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label valueLabel = new Label("Value"); final TextField valueField = new TextField(); valueField.setWidth("90%"); listLayout.insertRow(listLayout.getRows()); listLayout.removeComponent(addButton); listLayout.addComponent(valueLabel, 0, listLayout.getRows() - 2); listLayout.addComponent(valueField, 1, listLayout.getRows() - 2); final String mapKey = parameter.getName() + valueTextFields.size(); valueTextFields.put(mapKey, valueField); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { listLayout.removeComponent(valueLabel); listLayout.removeComponent(valueField); listLayout.removeComponent(removeButton); valueTextFields.remove(mapKey); } }); listLayout.addComponent(removeButton, 2, listLayout.getRows() - 2); listLayout.addComponent(addButton, 0, listLayout.getRows() - 1); } }); listLayout.addComponent(addButton, 0, listLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName("dashboard"); mapPanel.setContent(listLayout); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); Label paramDescriptionLabel = new Label("Description:"); paramDescriptionLabel.setSizeUndefined(); TextArea descriptionTextField = new TextArea(); descriptionTextField.setRows(4); descriptionTextField.setWidth("80%"); descriptionTextField.setId(parameter.getName()); paramLayout.addComponent(paramDescriptionLabel, 0, 2); paramLayout.addComponent(descriptionTextField, 1, 2); paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT); descriptionTextFields.put(parameter.getName(), descriptionTextField); if (parameter.getDescription() != null) { descriptionTextField.setValue(parameter.getDescription()); } return paramPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.ErrorCategorisationWindow.java
License:BSD License
/** * Helper method to initialise this object. * //w w w .ja va 2 s .c o m * @param message */ protected void init() { setModal(true); setHeight("90%"); setWidth("90%"); this.existingCategorisedErrorsTable = new Table(); this.existingCategorisedErrorsTable.setWidth("100%"); this.existingCategorisedErrorsTable.setHeight(200, Unit.PIXELS); this.existingCategorisedErrorsTable.addContainerProperty("Module Name", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Module Name", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Flow Name", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Flow Name", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Component Name", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Component Name", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Action", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Action", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Error Category", Label.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Error Category", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Error Message", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Error Message", .5f); this.existingCategorisedErrorsTable.addStyleName("wordwrap-table"); this.existingCategorisedErrorsTable.addStyleName(ValoTheme.TABLE_NO_STRIPES); this.existingCategorisedErrorsTable.setCellStyleGenerator(new Table.CellStyleGenerator() { @Override public String getStyle(Table source, Object itemId, Object propertyId) { ErrorCategorisationLink errorCategorisationLink = (ErrorCategorisationLink) itemId; if (propertyId == null) { // Styling for row if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.TRIVIAL)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.MAJOR)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.CRITICAL)) { return "ikasan-orange-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.BLOCKER)) { return "ikasan-red-small"; } } if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.TRIVIAL)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.MAJOR)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.CRITICAL)) { return "ikasan-orange-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.BLOCKER)) { return "ikasan-red-small"; } return "ikasan-small"; } }); this.existingCategorisedErrorsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent itemClickEvent) { logger.info("table item slected: " + (ErrorCategorisationLink) itemClickEvent.getItemId()); errorCategorisationLink = (ErrorCategorisationLink) itemClickEvent.getItemId(); errorCategorisation = errorCategorisationLink.getErrorCategorisation(); errorCategorisationItem = new BeanItem<ErrorCategorisation>(errorCategorisation); errorCategorisationLinkItem = new BeanItem<ErrorCategorisationLink>(errorCategorisationLink); moduleNameTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("moduleName")); flowNameTextField.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowName")); componentNameTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowElementName")); errorCategoryCombo.setPropertyDataSource(errorCategorisationItem.getItemProperty("errorCategory")); errorMessageTextArea .setPropertyDataSource(errorCategorisationItem.getItemProperty("errorDescription")); actionCombo.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("action")); exceptionClassTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("exceptionClass")); errorMessageTextArea.markAsDirty(); actionCombo.markAsDirty(); errorCategoryCombo.markAsDirty(); componentNameTextField.markAsDirty(); flowNameTextField.markAsDirty(); moduleNameTextField.markAsDirty(); } }); refreshExistingCategorisedErrorsTable(); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); layout.setColumnExpandRatio(0, .25f); layout.setColumnExpandRatio(1, .75f); if (this.errorCategorisationLink == null) { clear(); } Label configuredResourceIdLabel = new Label("Error Categorisation"); configuredResourceIdLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(configuredResourceIdLabel, 0, 0, 1, 0); if (this.module == null && this.flow == null && this.component == null) { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation for server wide errors. This categorisation will be applied" + " against errors that occur server wide, that do not have a more focused error categorisation."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } else if (this.flow == null && this.component == null) { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation for module wide errors. This categorisation will be applied" + " against errors that occur within this module, that do not have a more focused error categorisation."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } else if (this.component == null) { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation for flow wide errors. This categorisation will be applied" + " against errors that occur within this flow, that do not have a more focused error categorisation."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } else { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation against a component. This is the most focused error categorisation" + " that can be applied. This categorisation will be applied against errors that occur on this component."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } if (this.module != null) { Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); layout.addComponent(moduleNameLabel, 0, 2); layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); moduleNameTextField.setRequired(true); moduleNameTextField.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("moduleName")); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("80%"); layout.addComponent(moduleNameTextField, 1, 2); } if (this.flow != null) { Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); layout.addComponent(flowNameLabel, 0, 3); layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); flowNameTextField.setRequired(true); flowNameTextField.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowName")); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("80%"); layout.addComponent(flowNameTextField, 1, 3); } if (this.component != null) { Label componentNameLabel = new Label(); componentNameLabel.setContentMode(ContentMode.HTML); componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:"); componentNameLabel.setSizeUndefined(); layout.addComponent(componentNameLabel, 0, 4); layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT); componentNameTextField.setRequired(true); componentNameTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowElementName")); componentNameTextField.setReadOnly(true); componentNameTextField.setWidth("80%"); layout.addComponent(componentNameTextField, 1, 4); } Label exceptionClassLabel = new Label(); exceptionClassLabel.setContentMode(ContentMode.HTML); exceptionClassLabel.setValue("Exception Class:"); exceptionClassLabel.setSizeUndefined(); layout.addComponent(exceptionClassLabel, 0, 5); layout.setComponentAlignment(exceptionClassLabel, Alignment.MIDDLE_RIGHT); this.exceptionClassTextField.setWidth("80%"); exceptionClassTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("exceptionClass")); layout.addComponent(exceptionClassTextField, 1, 5); Label actionLabel = new Label(); actionLabel.setContentMode(ContentMode.HTML); actionLabel.setValue("Action:"); actionLabel.setSizeUndefined(); layout.addComponent(actionLabel, 0, 6); layout.setComponentAlignment(actionLabel, Alignment.MIDDLE_RIGHT); Label errorCategoryLabel = new Label("Error Category:"); errorCategoryLabel.setSizeUndefined(); layout.addComponent(errorCategoryLabel, 0, 7); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT); this.setupComboBoxesAndItems(); Label errorMessageLabel = new Label("Error Message:"); errorMessageLabel.setSizeUndefined(); layout.addComponent(errorMessageLabel, 0, 8); layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT); errorMessageTextArea.addValidator(new StringLengthValidator( "You must define an error message between 1 and 2048 characters in length!", 1, 2048, false)); errorMessageTextArea.setValidationVisible(false); errorMessageTextArea.setPropertyDataSource(errorCategorisationItem.getItemProperty("errorDescription")); errorMessageTextArea.setRequired(true); errorMessageTextArea.setWidth("650px"); errorMessageTextArea.setRows(8); errorMessageTextArea.setRequiredError("An error message is required!"); layout.addComponent(errorMessageTextArea, 1, 8); GridLayout buttonLayouts = new GridLayout(4, 1); buttonLayouts.setSpacing(true); Button saveButton = new Button("Save"); saveButton.setStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { errorCategoryCombo.validate(); errorMessageTextArea.validate(); actionCombo.validate(); } catch (InvalidValueException e) { errorCategoryCombo.setValidationVisible(true); errorMessageTextArea.setValidationVisible(true); actionCombo.setValidationVisible(true); errorCategoryCombo.markAsDirty(); errorMessageTextArea.markAsDirty(); actionCombo.markAsDirty(); return; } try { errorCategorisationService.save(errorCategorisationItem.getBean()); errorCategorisationLink.setErrorCategorisation(errorCategorisationItem.getBean()); errorCategorisationService.save(errorCategorisationLink); } catch (Exception e) { if (e.getCause() instanceof ConstraintViolationException) { Notification.show( "An error occurred trying to save an error categorisation: Action type must be unique for a given node!", Type.ERROR_MESSAGE); } else { Notification.show( "An error occurred trying to save an error categorisation: " + e.getMessage(), Type.ERROR_MESSAGE); } } refreshExistingCategorisedErrorsTable(); Notification.show("Saved!"); } }); Button clearButton = new Button("Clear"); clearButton.setStyleName(ValoTheme.BUTTON_SMALL); clearButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { clear(); } }); Button deleteButton = new Button("Delete"); deleteButton.setStyleName(ValoTheme.BUTTON_SMALL); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { ErrorCategorisation ec = errorCategorisationLink.getErrorCategorisation(); errorCategorisationService.delete(errorCategorisationLink); errorCategorisationService.delete(ec); existingCategorisedErrorsTable.removeItem(errorCategorisationLink); clear(); } }); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); buttonLayouts.addComponent(saveButton); buttonLayouts.addComponent(clearButton); buttonLayouts.addComponent(deleteButton); buttonLayouts.addComponent(cancelButton); layout.addComponent(buttonLayouts, 0, 9, 1, 9); layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER); Label existingCategorisationLabel = new Label("Existing Error Categorisations"); existingCategorisationLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(existingCategorisationLabel, 0, 10, 1, 10); Label uniquenessHintLabel = new Label(); uniquenessHintLabel.setCaptionAsHtml(true); uniquenessHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You can only create one error categorisation per Action type for a give node. If you attempt to create more you will receive an error when" + " trying to save."); uniquenessHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); uniquenessHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(uniquenessHintLabel, 0, 11, 1, 11); Label editHintLabel = new Label(); editHintLabel.setCaptionAsHtml(true); editHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You can can click on a row in the table below to edit an error categorisation."); editHintLabel.addStyleName(ValoTheme.LABEL_BOLD); editHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(editHintLabel, 0, 12, 1, 12); layout.addComponent(this.existingCategorisedErrorsTable, 0, 13, 1, 13); layout.setComponentAlignment(this.existingCategorisedErrorsTable, Alignment.MIDDLE_CENTER); Panel paramPanel = new Panel(); paramPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); paramPanel.setWidth("100%"); paramPanel.setContent(layout); GridLayout wrapper = new GridLayout(); // wrapper.setMargin(true); wrapper.setSizeFull(); wrapper.addComponent(paramPanel); this.setContent(wrapper); }
From source file:org.ikasan.dashboard.ui.topology.window.WiretapConfigurationWindow.java
License:BSD License
/** * Helper method to initialise this object. * /* w w w. ja v a 2 s . c o m*/ * @param message */ protected void init() { setModal(true); setHeight("90%"); setWidth("90%"); GridLayout layout = new GridLayout(2, 10); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); layout.setColumnExpandRatio(0, .25f); layout.setColumnExpandRatio(1, .75f); Label wiretapLabel = new Label("Wiretap Configuration"); wiretapLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(wiretapLabel); Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); layout.addComponent(moduleNameLabel, 0, 1); layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); TextField moduleNameTextField = new TextField(); moduleNameTextField.setRequired(true); moduleNameTextField.setValue(this.component.getFlow().getModule().getName()); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("80%"); layout.addComponent(moduleNameTextField, 1, 1); Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); layout.addComponent(flowNameLabel, 0, 2); layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); TextField flowNameTextField = new TextField(); flowNameTextField.setRequired(true); flowNameTextField.setValue(this.component.getFlow().getName()); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("80%"); layout.addComponent(flowNameTextField, 1, 2); Label componentNameLabel = new Label(); componentNameLabel.setContentMode(ContentMode.HTML); componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:"); componentNameLabel.setSizeUndefined(); layout.addComponent(componentNameLabel, 0, 3); layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT); TextField componentNameTextField = new TextField(); componentNameTextField.setRequired(true); componentNameTextField.setValue(this.component.getName()); componentNameTextField.setReadOnly(true); componentNameTextField.setWidth("80%"); layout.addComponent(componentNameTextField, 1, 3); Label errorCategoryLabel = new Label("Relationship:"); errorCategoryLabel.setSizeUndefined(); layout.addComponent(errorCategoryLabel, 0, 4); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT); final ComboBox relationshipCombo = new ComboBox(); // relationshipCombo.addValidator(new StringLengthValidator( // "An relationship must be selected!", 1, -1, false)); relationshipCombo.setImmediate(false); relationshipCombo.setValidationVisible(false); relationshipCombo.setRequired(true); relationshipCombo.setRequiredError("A relationship must be selected!"); relationshipCombo.setHeight("30px"); relationshipCombo.setNullSelectionAllowed(false); layout.addComponent(relationshipCombo, 1, 4); relationshipCombo.addItem("before"); relationshipCombo.setItemCaption("before", "Before"); relationshipCombo.addItem("after"); relationshipCombo.setItemCaption("after", "After"); Label jobTypeLabel = new Label("Job Type:"); jobTypeLabel.setSizeUndefined(); layout.addComponent(jobTypeLabel, 0, 5); layout.setComponentAlignment(jobTypeLabel, Alignment.MIDDLE_RIGHT); final ComboBox jobTopCombo = new ComboBox(); // jobTopCombo.addValidator(new StringLengthValidator( // "A job type must be selected!", 1, -1, false)); jobTopCombo.setImmediate(false); jobTopCombo.setValidationVisible(false); jobTopCombo.setRequired(true); jobTopCombo.setRequiredError("A job type must be selected!"); jobTopCombo.setHeight("30px"); jobTopCombo.setNullSelectionAllowed(false); layout.addComponent(jobTopCombo, 1, 5); jobTopCombo.addItem("loggingJob"); jobTopCombo.setItemCaption("loggingJob", "Logging Job"); jobTopCombo.addItem("wiretapJob"); jobTopCombo.setItemCaption("wiretapJob", "Wiretap Job"); final Label timeToLiveLabel = new Label("Time to Live:"); timeToLiveLabel.setSizeUndefined(); timeToLiveLabel.setVisible(false); layout.addComponent(timeToLiveLabel, 0, 6); layout.setComponentAlignment(timeToLiveLabel, Alignment.MIDDLE_RIGHT); final TextField timeToLiveTextField = new TextField(); timeToLiveTextField.setRequired(true); timeToLiveTextField.setValidationVisible(false); jobTopCombo.setRequiredError("A time to live value must be entered!"); timeToLiveTextField.setVisible(false); timeToLiveTextField.setWidth("40%"); layout.addComponent(timeToLiveTextField, 1, 6); jobTopCombo.addValueChangeListener(new ComboBox.ValueChangeListener() { /* (non-Javadoc) * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent) */ @Override public void valueChange(ValueChangeEvent event) { String value = (String) event.getProperty().getValue(); if (value.equals("wiretapJob")) { timeToLiveLabel.setVisible(true); timeToLiveTextField.setVisible(true); } else { timeToLiveLabel.setVisible(false); timeToLiveTextField.setVisible(false); } } }); GridLayout buttonLayouts = new GridLayout(3, 1); buttonLayouts.setSpacing(true); Button saveButton = new Button("Save"); saveButton.setStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { relationshipCombo.validate(); jobTopCombo.validate(); if (timeToLiveTextField.isVisible()) { timeToLiveTextField.validate(); } } catch (InvalidValueException e) { relationshipCombo.setValidationVisible(true); relationshipCombo.markAsDirty(); jobTopCombo.setValidationVisible(true); jobTopCombo.markAsDirty(); if (timeToLiveTextField.isVisible()) { timeToLiveTextField.setValidationVisible(true); timeToLiveTextField.markAsDirty(); } Notification.show("There are errors on the wiretap creation form!", Type.ERROR_MESSAGE); return; } createWiretap((String) relationshipCombo.getValue(), (String) jobTopCombo.getValue(), timeToLiveTextField.getValue()); } }); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); buttonLayouts.addComponent(saveButton); buttonLayouts.addComponent(cancelButton); layout.addComponent(buttonLayouts, 0, 7, 1, 7); layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER); Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); paramPanel.setContent(layout); triggerTable = new Table(); Label existingWiretapLabel = new Label("Existing Wiretaps"); existingWiretapLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(existingWiretapLabel, 0, 8, 1, 8); layout.addComponent(triggerTable, 0, 9, 1, 9); layout.setComponentAlignment(triggerTable, Alignment.TOP_CENTER); this.triggerTable.setWidth("80%"); this.triggerTable.setHeight(150, Unit.PIXELS); this.triggerTable.setCellStyleGenerator(new IkasanCellStyleGenerator()); this.triggerTable.addStyleName(ValoTheme.TABLE_SMALL); this.triggerTable.addStyleName("ikasan"); this.triggerTable.addContainerProperty("Job Type", String.class, null); this.triggerTable.addContainerProperty("Relationship", String.class, null); this.triggerTable.addContainerProperty("Trigger Parameters", String.class, null); this.triggerTable.addContainerProperty("", Button.class, null); refreshTriggerTable(); GridLayout wrapper = new GridLayout(1, 1); wrapper.setMargin(true); wrapper.setSizeFull(); wrapper.addComponent(paramPanel); this.setContent(wrapper); }
From source file:org.lunifera.vaaclipse.ui.preferences.addon.internal.impexp.BasicImpExp.java
License:Open Source License
protected void createPreferencesTable(CssLayout layout, List<PreferencesPage> pageList) { container = new BeanItemContainer<>(PreferencesPage.class); container.addNestedContainerProperty("category.name"); refreshPreferences(pageList);/*from w w w . j a v a2 s .co m*/ table = new Table(); table.setSizeFull(); table.setContainerDataSource(container); table.addGeneratedColumn("description", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { PreferencesPage page = (PreferencesPage) itemId; String d = page.getDescription(); if (d.length() > MAX_DESCRIPTION_LENGTH) { d = d.substring(0, MAX_DESCRIPTION_LENGTH).trim() + "..."; } return d; } }); table.addGeneratedColumn("include", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { CheckBox cb = new CheckBox(); cb.setData(itemId); checkBoxes.add(cb); return cb; } }); table.setColumnHeader("include", " "); table.setColumnHeader("category.name", "Name"); table.setColumnHeader("description", "Description"); table.setVisibleColumns("include", "category.name", "description"); Panel panel = new Panel(table); panel.setWidth("100%"); panel.setHeight("200px"); layout.addComponent(panel); }
From source file:org.opencms.ui.CmsVaadinUtils.java
License:Open Source License
/** * Shows an alert box to the user with the given information, which will perform the given action after the user clicks on OK.<p> * * @param title the title// w ww . ja va 2 s . co m * @param message the message * * @param callback the callback to execute after clicking OK */ public static void showAlert(String title, String message, final Runnable callback) { final Window window = new Window(); window.setModal(true); Panel panel = new Panel(); panel.setCaption(title); panel.setWidth("500px"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); panel.setContent(layout); layout.addComponent(new Label(message)); Button okButton = new Button(); okButton.addClickListener(new ClickListener() { /** The serial version id. */ private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { window.close(); if (callback != null) { callback.run(); } } }); layout.addComponent(okButton); layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT); okButton.setCaption(org.opencms.workplace.Messages.get().getBundle(A_CmsUI.get().getLocale()) .key(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0)); window.setContent(panel); window.setClosable(false); window.setResizable(false); A_CmsUI.get().addWindow(window); }
From source file:org.opencms.ui.dialogs.history.diff.CmsTextDiff.java
License:Open Source License
/** * @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean) *//*ww w. j a v a 2s . com*/ public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) throws CmsException { CmsResource resource1 = A_CmsAttributeDiff.readResource(cms, v1); String encoding = CmsLocaleManager.getResourceEncoding(cms, resource1); I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource1); if ((type instanceof CmsResourceTypeXmlContent) || (type instanceof CmsResourceTypePlain) || (type instanceof CmsResourceTypeJsp) || (type instanceof CmsResourceTypeXmlPage) || (type instanceof CmsResourceTypePointer) || (type instanceof CmsResourceTypeBinary)) { CmsResource resource2 = A_CmsAttributeDiff.readResource(cms, v2); String path1 = resource1.getRootPath(); String path2 = resource2.getRootPath(); CmsFile file1 = cms.readFile(resource1); CmsFile file2 = cms.readFile(resource2); byte[] content1 = file1.getContents(); byte[] content2 = file2.getContents(); String originalSource = null; String copySource = null; I_CmsTextExtractor textExtractor = null; // only if both files have contents if ((content1.length > 0) && (content2.length > 0)) { if (path1.endsWith(".pdf") && path2.endsWith(".pdf")) { textExtractor = CmsExtractorPdf.getExtractor(); } else if (path1.endsWith(".doc") && path2.endsWith(".doc")) { textExtractor = CmsExtractorMsOfficeOLE2.getExtractor(); } else if (path1.endsWith(".xls") && path2.endsWith(".xls")) { textExtractor = CmsExtractorMsOfficeOLE2.getExtractor(); } else if (path1.endsWith(".rtf") && path2.endsWith(".rtf")) { textExtractor = CmsExtractorRtf.getExtractor(); } else if (path1.endsWith(".ppt") && path2.endsWith(".ppt")) { textExtractor = CmsExtractorMsOfficeOLE2.getExtractor(); } } if (textExtractor != null) { try { // extract the content originalSource = textExtractor.extractText(content1).getContent(); copySource = textExtractor.extractText(content2).getContent(); } catch (Exception e) { // something goes wrong on extracting content // set the content to null, so the content dialog will not be shown originalSource = null; copySource = null; LOG.error(e.getMessage(), e); } } else if ((type instanceof CmsResourceTypePlain) || (type instanceof CmsResourceTypeJsp) || (type instanceof CmsResourceTypePointer)) { try { originalSource = new String(content1, encoding); copySource = new String(content2, encoding); } catch (UnsupportedEncodingException e) { LOG.error(e.getLocalizedMessage(), e); } } if ((copySource == null) || (originalSource == null)) { return Optional.absent(); } try { CmsTextDiffPanel diffPanel = new CmsTextDiffPanel(originalSource, copySource, false, true); diffPanel.setWidth("100%"); Panel panel = new Panel( CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_TEXT_COMPARISON_CAPTION_0)); panel.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); vl.setMargin(true); vl.addComponent(diffPanel); panel.setContent(vl); return Optional.<Component>fromNullable(panel); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return Optional.absent(); } } else { return Optional.absent(); } }