List of usage examples for com.vaadin.ui GridLayout setColumnExpandRatio
public void setColumnExpandRatio(int columnIndex, float ratio)
From source file:org.ikasan.dashboard.ui.framework.window.AdminPasswordDialog.java
License:BSD License
/** * Helper method to initialise this object. * /*from ww w. j av a2 s. c om*/ * @param userService * @param authProvider * @param visibilityGroup * @param userDetailsHelper * @param commitHandler */ protected void init() { super.setModal(true); super.setResizable(false); super.center(); this.setWidth(300, Unit.PIXELS); this.setHeight(220, Unit.PIXELS); super.setClosable(false); GridLayout form = new GridLayout(2, 4); form.setColumnExpandRatio(0, .15f); form.setColumnExpandRatio(1, .85f); form.setWidth(100, Unit.PERCENTAGE); form.setMargin(true); form.setSpacing(true); Label newTypeLabel = new Label("Initial Administration Password"); newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE); form.addComponent(newTypeLabel, 0, 0, 1, 0); Label passwordLabel = new Label("Password:"); passwordLabel.setSizeUndefined(); form.addComponent(passwordLabel, 0, 1); form.setComponentAlignment(passwordLabel, Alignment.MIDDLE_RIGHT); final PasswordField passwordField = new PasswordField(); passwordField.addValidator(new StringLengthValidator("The username must not be empty", 1, null, true)); passwordField.setValidationVisible(false); passwordField.setStyleName("ikasan"); form.addComponent(passwordField, 1, 1); Label passwordConfirmLabel = new Label("Confirm Password:"); passwordConfirmLabel.setSizeUndefined(); form.addComponent(passwordConfirmLabel, 0, 2); form.setComponentAlignment(passwordConfirmLabel, Alignment.MIDDLE_RIGHT); final PasswordField passwordConfirmField = new PasswordField(); passwordConfirmField.setStyleName("ikasan"); passwordConfirmField .addValidator(new StringLengthValidator("The password must not be empty", 1, null, true)); passwordConfirmField.setValidationVisible(false); form.addComponent(passwordConfirmField, 1, 2); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button saveButton = new Button("Save"); saveButton.addStyleName(ValoTheme.BUTTON_SMALL); saveButton.setClickShortcut(KeyCode.ENTER); saveButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { passwordField.validate(); passwordConfirmField.validate(); if (!passwordField.getValue().equals(passwordConfirmField.getValue())) { Notification.show("Password and confirmation must be the same!", Type.ERROR_MESSAGE); return; } } catch (InvalidValueException e) { passwordField.setValidationVisible(true); passwordConfirmField.setValidationVisible(true); return; } password = passwordField.getValue(); passwordField.setValue(""); passwordConfirmField.setValue(""); close(); } }); buttons.addComponent(saveButton); form.addComponent(buttons, 0, 3, 1, 3); form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); this.setContent(form); }
From source file:org.ikasan.dashboard.ui.framework.window.LoginDialog.java
License:BSD License
/** * Helper method to initialise this object. * /*w ww . j a v a2 s . co m*/ * @param userService * @param authProvider * @param visibilityGroup * @param userDetailsHelper * @param commitHandler */ protected void init(AuthenticationService authenticationService, VisibilityGroup visibilityGroup, final NavigationPanel commitHandler) { super.setModal(true); super.setResizable(false); super.center(); this.setWidth(300, Unit.PIXELS); this.setHeight(200, Unit.PIXELS); PropertysetItem item = new PropertysetItem(); item.addItemProperty(LoginFieldGroup.USERNAME, new ObjectProperty<String>("")); item.addItemProperty(LoginFieldGroup.PASSWORD, new ObjectProperty<String>("")); GridLayout form = new GridLayout(2, 4); form.setColumnExpandRatio(0, .15f); form.setColumnExpandRatio(1, .85f); form.setWidth(100, Unit.PERCENTAGE); form.setMargin(true); form.setSpacing(true); Label newTypeLabel = new Label("Login"); newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE); form.addComponent(newTypeLabel, 0, 0, 1, 0); Label usernameLabel = new Label("Username:"); usernameLabel.setSizeUndefined(); form.addComponent(usernameLabel, 0, 1); form.setComponentAlignment(usernameLabel, Alignment.MIDDLE_RIGHT); final TextField userNameField = new TextField(); userNameField.addValidator(new StringLengthValidator("The username must not be empty", 1, null, true)); userNameField.setValidationVisible(false); userNameField.setStyleName("ikasan"); form.addComponent(userNameField, 1, 1); Label passwordLabel = new Label("Password:"); passwordLabel.setSizeUndefined(); form.addComponent(passwordLabel, 0, 2); form.setComponentAlignment(passwordLabel, Alignment.MIDDLE_RIGHT); final PasswordField passwordField = new PasswordField(); passwordField.setStyleName("ikasan"); passwordField.addValidator(new StringLengthValidator("The password must not be empty", 1, null, true)); passwordField.setValidationVisible(false); form.addComponent(passwordField, 1, 2); final LoginFieldGroup binder = new LoginFieldGroup(item, visibilityGroup, authenticationService); binder.bind(userNameField, LoginFieldGroup.USERNAME); binder.bind(passwordField, LoginFieldGroup.PASSWORD); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button loginButton = new Button("Login"); loginButton.addStyleName(ValoTheme.BUTTON_SMALL); loginButton.setClickShortcut(KeyCode.ENTER); loginButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { userNameField.validate(); passwordField.validate(); } catch (InvalidValueException e) { userNameField.setValidationVisible(true); passwordField.setValidationVisible(true); return; } try { binder.commit(); userNameField.setValue(""); passwordField.setValue(""); close(); commitHandler.postCommit(); } catch (CommitException e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } } }); buttons.addComponent(loginButton); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); binder.discard(); } }); buttons.addComponent(cancelButton); form.addComponent(buttons, 0, 3, 1, 3); form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); this.setContent(form); }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.panel.MappingConfigurationSearchPanel.java
License:BSD License
/** * Helper method to initialise this object. *//*from ww w. j ava2 s. c o m*/ @SuppressWarnings("serial") protected void init() { this.addStyleName(ValoTheme.PANEL_BORDERLESS); final Label typeLabel = new Label("Type:"); final Label sourceContextLabel = new Label("Source Context:"); final Label targetContextLabel = new Label("Target Context:"); final GridLayout contentLayout = new GridLayout(4, 6); contentLayout.setColumnExpandRatio(0, .15f); contentLayout.setColumnExpandRatio(1, .35f); contentLayout.setColumnExpandRatio(2, .05f); contentLayout.setColumnExpandRatio(3, .45f); contentLayout.setWidth("100%"); contentLayout.setSpacing(true); Label errorOccurrenceDetailsLabel = new Label("Mapping Configuration Search"); errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE); contentLayout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 1, 0); Label clientLabel = new Label("Client:"); clientLabel.setSizeUndefined(); contentLayout.addComponent(clientLabel, 0, 1); contentLayout.setComponentAlignment(clientLabel, Alignment.MIDDLE_RIGHT); this.clientComboBox.setWidth(80, Unit.PERCENTAGE); this.clientComboBox.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (event.getProperty() != null && event.getProperty().getValue() != null) { typeComboBox.refresh(((ConfigurationServiceClient) event.getProperty().getValue()).getName()); sourceContextComboBox .refresh(((ConfigurationServiceClient) event.getProperty().getValue()).getName(), null); targetContextComboBox.refresh( ((ConfigurationServiceClient) event.getProperty().getValue()).getName(), null, null); typeLabel.setVisible(true); typeComboBox.setVisible(true); } } }); contentLayout.addComponent(clientComboBox, 1, 1); typeLabel.setSizeUndefined(); contentLayout.addComponent(typeLabel, 0, 2); contentLayout.setComponentAlignment(typeLabel, Alignment.MIDDLE_RIGHT); typeLabel.setVisible(false); this.typeComboBox.setWidth(80, Unit.PERCENTAGE); this.typeComboBox.setVisible(false); this.typeComboBox.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { String client = null; if (clientComboBox.getValue() != null) { client = ((ConfigurationServiceClient) clientComboBox.getValue()).getName(); } if (event.getProperty() != null && event.getProperty().getValue() != null) { sourceContextComboBox.refresh(client, ((ConfigurationType) event.getProperty().getValue()).getName()); targetContextComboBox.refresh(client, ((ConfigurationType) event.getProperty().getValue()).getName(), null); sourceContextLabel.setVisible(true); sourceContextComboBox.setVisible(true); } } }); contentLayout.addComponent(this.typeComboBox, 1, 2); sourceContextLabel.setSizeUndefined(); contentLayout.addComponent(sourceContextLabel, 0, 3); contentLayout.setComponentAlignment(sourceContextLabel, Alignment.MIDDLE_RIGHT); sourceContextLabel.setVisible(false); this.sourceContextComboBox.setWidth(80, Unit.PERCENTAGE); this.sourceContextComboBox.setVisible(false); this.sourceContextComboBox.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { String type = null; String client = null; if (typeComboBox.getValue() != null) { type = ((ConfigurationType) typeComboBox.getValue()).getName(); } if (clientComboBox.getValue() != null) { client = ((ConfigurationServiceClient) clientComboBox.getValue()).getName(); } if (event.getProperty() != null && event.getProperty().getValue() != null) { targetContextComboBox.refresh(client, type, ((ConfigurationContext) event.getProperty().getValue()).getName()); targetContextLabel.setVisible(true); targetContextComboBox.setVisible(true); } } }); contentLayout.addComponent(this.sourceContextComboBox, 1, 3); targetContextLabel.setSizeUndefined(); contentLayout.addComponent(targetContextLabel, 0, 4); contentLayout.setComponentAlignment(targetContextLabel, Alignment.MIDDLE_RIGHT); targetContextLabel.setVisible(false); this.targetContextComboBox.setWidth(80, Unit.PERCENTAGE); this.targetContextComboBox.setVisible(false); contentLayout.addComponent(this.targetContextComboBox, 1, 4); Label actionsLabel = newActions.getActionsLabel(); actionsLabel.setStyleName(ValoTheme.LABEL_HUGE); contentLayout.addComponent(actionsLabel, 2, 0, 3, 0); Label createNewClientLabel = newActions.getNewClientLabel(); createNewClientLabel.setSizeUndefined(); contentLayout.addComponent(createNewClientLabel, 2, 1); contentLayout.setComponentAlignment(createNewClientLabel, Alignment.MIDDLE_RIGHT); contentLayout.addComponent(newActions.getNewClientButton(), 3, 1); contentLayout.setComponentAlignment(newActions.getNewClientButton(), Alignment.MIDDLE_LEFT); Label createNewTypeLabel = newActions.getNewTypeLabel(); createNewTypeLabel.setSizeUndefined(); contentLayout.addComponent(createNewTypeLabel, 2, 2); contentLayout.setComponentAlignment(createNewTypeLabel, Alignment.MIDDLE_RIGHT); contentLayout.addComponent(newActions.getNewTypeButton(), 3, 2); contentLayout.setComponentAlignment(newActions.getNewTypeButton(), Alignment.MIDDLE_LEFT); Label createContextTypeLabel = newActions.getNewContextLabel(); createContextTypeLabel.setSizeUndefined(); contentLayout.addComponent(createContextTypeLabel, 2, 3); contentLayout.setComponentAlignment(createContextTypeLabel, Alignment.MIDDLE_RIGHT); contentLayout.addComponent(newActions.getNewContextButton(), 3, 3); contentLayout.setComponentAlignment(newActions.getNewContextButton(), Alignment.MIDDLE_LEFT); Label createMappingConfigurationLabel = newActions.getNewMappingConfigurationLabel(); createMappingConfigurationLabel.setSizeUndefined(); contentLayout.addComponent(createMappingConfigurationLabel, 2, 4); contentLayout.setComponentAlignment(createMappingConfigurationLabel, Alignment.MIDDLE_RIGHT); contentLayout.addComponent(newActions.getNewMappingConfigurationButton(), 3, 4); contentLayout.setComponentAlignment(newActions.getNewMappingConfigurationButton(), Alignment.MIDDLE_LEFT); Label importMappingConfigurationLabel = newActions.getImportMappingConfigurationLabel(); importMappingConfigurationLabel.setSizeUndefined(); contentLayout.addComponent(importMappingConfigurationLabel, 2, 5); contentLayout.setComponentAlignment(importMappingConfigurationLabel, Alignment.MIDDLE_RIGHT); contentLayout.addComponent(newActions.getImportMappingConfigurationButton(), 3, 5); contentLayout.setComponentAlignment(newActions.getImportMappingConfigurationButton(), Alignment.MIDDLE_LEFT); Button button = new Button("Search"); button.setStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener(searchButtonClickListener); contentLayout.addComponent(button, 1, 5); this.setContent(contentLayout); }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.window.NewMappingConfigurationContextWindow.java
License:BSD License
/** * Helper method to initialise this object. *///from w w w .j a va 2 s.c o m protected void init() { this.setStyleName("dashboard"); this.setModal(true); this.setWidth(500, Unit.PIXELS); this.setHeight(250, Unit.PIXELS); PropertysetItem item = new PropertysetItem(); item.addItemProperty(NewContextFieldGroup.NAME, new ObjectProperty<String>("")); item.addItemProperty(NewContextFieldGroup.DESCRIPTION, new ObjectProperty<String>("")); GridLayout form = new GridLayout(2, 4); form.setColumnExpandRatio(0, .15f); form.setColumnExpandRatio(1, .85f); form.setWidth(100, Unit.PERCENTAGE); form.setMargin(true); form.setSpacing(true); Label newTypeLabel = new Label("New Mapping Configuration Context"); newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE); form.addComponent(newTypeLabel, 0, 0, 1, 0); Label nameLabel = new Label("Name:"); nameLabel.setSizeUndefined(); form.addComponent(nameLabel, 0, 1); form.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT); nameField.setStyleName("ikasan"); nameField.addValidator(new StringLengthValidator("The name must not be blank!", 1, 256, true)); nameField.setValidationVisible(false); nameField.setWidth(70, Unit.PERCENTAGE); form.addComponent(nameField, 1, 1); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); form.addComponent(descriptionLabel, 0, 2); form.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); descriptionField.setStyleName("ikasan"); descriptionField .addValidator(new StringLengthValidator("The description must not be blank!", 1, 256, true)); descriptionField.setValidationVisible(false); descriptionField.setWidth(90, Unit.PERCENTAGE); descriptionField.setRows(5); form.addComponent(descriptionField, 1, 2); final NewContextFieldGroup binder = new NewContextFieldGroup(item, this.refreshGroup, this.mappingConfigurationService, this.systemEventService); binder.bind(nameField, NewContextFieldGroup.NAME); binder.bind(descriptionField, NewContextFieldGroup.DESCRIPTION); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button saveButton = new Button("Save"); saveButton.setStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { nameField.validate(); descriptionField.validate(); } catch (InvalidValueException e) { nameField.setValidationVisible(true); descriptionField.setValidationVisible(true); return; } try { binder.commit(); UI.getCurrent().getNavigator().navigateTo("emptyPanel"); nameField.setValue(""); descriptionField.setValue(""); Notification.show("New Mapping Configuration Context Successfully Created!"); saveRequiredMonitor.setSaveRequired(false); close(); } catch (CommitException e) { Notification.show("An error occurred saving a new context! " + e.getMessage(), Type.ERROR_MESSAGE); } } }); buttons.addComponent(saveButton); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().getNavigator().navigateTo("emptyPanel"); binder.discard(); saveRequiredMonitor.setSaveRequired(false); close(); } }); buttons.addComponent(cancelButton); form.addComponent(buttons, 0, 3, 1, 3); form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); this.setContent(form); }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.window.NewMappingConfigurationTypeWindow.java
License:BSD License
/** * Helper method to initialise this object. *///from w w w . j a va2s .c o m protected void init() { this.setStyleName("dashboard"); this.setModal(true); this.setWidth(500, Unit.PIXELS); this.setHeight(180, Unit.PIXELS); PropertysetItem item = new PropertysetItem(); item.addItemProperty(NewContextFieldGroup.NAME, new ObjectProperty<String>("")); GridLayout form = new GridLayout(2, 3); form.setColumnExpandRatio(0, .15f); form.setColumnExpandRatio(1, .85f); form.setWidth(100, Unit.PERCENTAGE); form.setMargin(true); form.setSpacing(true); Label newTypeLabel = new Label("New Mapping Configuration Type"); newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE); form.addComponent(newTypeLabel, 0, 0, 1, 0); Label nameLabel = new Label("Name:"); nameLabel.setSizeUndefined(); form.addComponent(nameLabel, 0, 1); form.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT); nameField.setStyleName("ikasan"); nameField.addValidator(new StringLengthValidator("The name must not be blank!", 1, 256, true)); nameField.setValidationVisible(false); nameField.setWidth(70, Unit.PERCENTAGE); form.addComponent(nameField, 1, 1); final NewConfigurationTypeFieldGroup binder = new NewConfigurationTypeFieldGroup(item, this.refreshGroup, this.mappingConfigurationService, systemEventService); binder.bind(nameField, NewContextFieldGroup.NAME); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button saveButton = new Button("Save"); saveButton.setStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { nameField.validate(); } catch (InvalidValueException e) { nameField.setValidationVisible(true); return; } try { binder.commit(); UI.getCurrent().getNavigator().navigateTo("emptyPanel"); nameField.setValue(""); Notification.show("New Mapping Configuration Type Successfully Created!"); saveRequiredMonitor.setSaveRequired(false); close(); } catch (CommitException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Cauget exception trying to save a new Mapping Configuration Type!", sw.toString(), Notification.Type.ERROR_MESSAGE); } } }); buttons.addComponent(saveButton); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().getNavigator().navigateTo("emptyPanel"); binder.discard(); saveRequiredMonitor.setSaveRequired(false); close(); } }); buttons.addComponent(cancelButton); form.addComponent(buttons, 0, 2, 1, 2); form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); this.setContent(form); }
From source file:org.ikasan.dashboard.ui.topology.component.BusinessStreamTab.java
License:BSD License
public Layout createBusinessStreamLayout() { this.businessStreamTable = new Table(); this.businessStreamTable.addContainerProperty("Server Name", String.class, null); this.businessStreamTable.addContainerProperty("Module Name", String.class, null); this.businessStreamTable.addContainerProperty("Flow Name", String.class, null); this.businessStreamTable.addContainerProperty("", Button.class, null); this.businessStreamTable.setWidth("100%"); this.businessStreamTable.setHeight(600, Unit.PIXELS); this.businessStreamTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); this.businessStreamTable.setDragMode(TableDragMode.ROW); this.businessStreamTable.setDropHandler(new DropHandler() { @Override//from w w w. j a v a2 s.com public void drop(final DragAndDropEvent dropEvent) { final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication .hasGrantedAuthority(SecurityConstants.MODIFY_BUSINESS_STREAM_AUTHORITY))) { Notification.show("You do not have the privilege to modify a business stream."); return; } final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Flow) { final Flow flow = (Flow) t.getItemId(); final BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue(); BusinessStreamFlowKey key = new BusinessStreamFlowKey(); key.setBusinessStreamId(businessStream.getId()); key.setFlowId(flow.getId()); final BusinessStreamFlow businessStreamFlow = new BusinessStreamFlow(key); businessStreamFlow.setFlow(flow); businessStreamFlow.setOrder(businessStreamTable.getItemIds().size()); if (!businessStream.getFlows().contains(businessStreamFlow)) { businessStream.getFlows().add(businessStreamFlow); topologyService.saveBusinessStream(businessStream); Button deleteButton = new Button(); Resource deleteIcon = VaadinIcons.TRASH; deleteButton.setIcon(deleteIcon); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the flow from the business stream."); deleteButton.setData(businessStreamFlow); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { businessStream.getFlows().remove(businessStreamFlow); topologyService.deleteBusinessStreamFlow(businessStreamFlow); topologyService.saveBusinessStream(businessStream); businessStreamTable.removeItem(businessStreamFlow.getFlow()); } }); businessStreamTable .addItem( new Object[] { flow.getModule().getServer().getName(), flow.getModule().getName(), flow.getName(), deleteButton }, businessStreamFlow); } } else if (t.getItemId() instanceof Module) { final Module sourceContainer = (Module) t.getItemId(); for (Flow flow : sourceContainer.getFlows()) { final BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue(); BusinessStreamFlowKey key = new BusinessStreamFlowKey(); key.setBusinessStreamId(businessStream.getId()); key.setFlowId(flow.getId()); final BusinessStreamFlow businessStreamFlow = new BusinessStreamFlow(key); businessStreamFlow.setFlow(flow); businessStreamFlow.setOrder(businessStreamTable.getItemIds().size()); if (!businessStream.getFlows().contains(businessStreamFlow)) { businessStream.getFlows().add(businessStreamFlow); topologyService.saveBusinessStream(businessStream); Button deleteButton = new Button(); Resource deleteIcon = VaadinIcons.TRASH; deleteButton.setIcon(deleteIcon); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the flow from the business stream."); deleteButton.setData(businessStreamFlow); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { businessStream.getFlows().remove(businessStreamFlow); topologyService.deleteBusinessStreamFlow(businessStreamFlow); topologyService.saveBusinessStream(businessStream); businessStreamTable.removeItem(businessStreamFlow.getFlow()); } }); businessStreamTable.addItem( new Object[] { flow.getModule().getServer().getName(), flow.getModule().getName(), flow.getName(), deleteButton }, businessStreamFlow); } } } else { Notification.show("Only modules or flows can be dragged to this table."); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); GridLayout layout = new GridLayout(1, 6); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); Label tableDropHintLabel = new Label(); tableDropHintLabel.setCaptionAsHtml(true); tableDropHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drag modules or flows from the topology tree to the table below to build a business stream."); tableDropHintLabel.addStyleName(ValoTheme.LABEL_TINY); tableDropHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(tableDropHintLabel); GridLayout controlsLayout = new GridLayout(3, 3); controlsLayout.setColumnExpandRatio(0, .05f); controlsLayout.setColumnExpandRatio(1, .65f); controlsLayout.setColumnExpandRatio(2, .3f); controlsLayout.setWidth("100%"); controlsLayout.setSpacing(true); Label newBusinessStreamLabel = new Label("New Business Stream:"); newBusinessStreamLabel.setSizeUndefined(); controlsLayout.addComponent(newBusinessStreamLabel, 0, 0); controlsLayout.setComponentAlignment(newBusinessStreamLabel, Alignment.MIDDLE_RIGHT); Button newButton = new Button(); newButton.setIcon(VaadinIcons.PLUS); newButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); newButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); newButton.setDescription("Create a new business stream."); newButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final NewBusinessStreamWindow newBusinessStreamWindow = new NewBusinessStreamWindow(); UI.getCurrent().addWindow(newBusinessStreamWindow); newBusinessStreamWindow.addCloseListener(new Window.CloseListener() { // inline close-listener public void windowClose(CloseEvent e) { topologyService.saveBusinessStream(newBusinessStreamWindow.getBusinessStream()); businessStreamCombo.addItem(newBusinessStreamWindow.getBusinessStream()); businessStreamCombo.setItemCaption(newBusinessStreamWindow.getBusinessStream(), newBusinessStreamWindow.getBusinessStream().getName()); businessStreamCombo.select(newBusinessStreamWindow.getBusinessStream()); businessStreamTable.removeAllItems(); } }); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority(SecurityConstants.CREATE_BUSINESS_STREAM_AUTHORITY))) { newButton.setVisible(false); } controlsLayout.addComponent(newButton, 1, 0); Label businessStreamLabel = new Label("Business Stream:"); businessStreamLabel.setSizeUndefined(); final TextArea descriptionTextArea = new TextArea(); descriptionTextArea.setReadOnly(true); this.businessStreamCombo.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (event.getProperty() != null && event.getProperty().getValue() != null) { final BusinessStream businessStream = (BusinessStream) event.getProperty().getValue(); descriptionTextArea.setReadOnly(false); descriptionTextArea.setValue(businessStream.getDescription()); descriptionTextArea.setReadOnly(true); businessStreamTable.removeAllItems(); for (final BusinessStreamFlow businessStreamFlow : businessStream.getFlows()) { logger.info("Adding flow: " + businessStreamFlow); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the flow from the business stream."); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { businessStream.getFlows().remove(businessStreamFlow); topologyService.deleteBusinessStreamFlow(businessStreamFlow); topologyService.saveBusinessStream(businessStream); businessStreamTable.removeItem(businessStreamFlow.getFlow()); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService .getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority( SecurityConstants.MODIFY_BUSINESS_STREAM_AUTHORITY))) { deleteButton.setVisible(false); } businessStreamTable.addItem( new Object[] { businessStreamFlow.getFlow().getModule().getServer().getName(), businessStreamFlow.getFlow().getName(), businessStreamFlow.getFlow().getName(), deleteButton }, businessStreamFlow); } } } }); businessStreamCombo.setWidth("100%"); controlsLayout.addComponent(businessStreamLabel, 0, 1); controlsLayout.setComponentAlignment(businessStreamLabel, Alignment.MIDDLE_RIGHT); controlsLayout.addComponent(businessStreamCombo, 1, 1); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the selected business stream."); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Collection<BusinessStreamFlow> businessStreamFlows = (Collection<BusinessStreamFlow>) businessStreamTable .getItemIds(); for (BusinessStreamFlow businessStreamFlow : businessStreamFlows) { topologyService.deleteBusinessStreamFlow(businessStreamFlow); } BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue(); topologyService.deleteBusinessStream(businessStream); businessStreamTable.removeAllItems(); List<BusinessStream> businessStreams = topologyService.getAllBusinessStreams(); businessStreamCombo.removeItem(businessStream); descriptionTextArea.setValue(""); } }); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority(SecurityConstants.DELETE_BUSINESS_STREAM_AUTHORITY))) { deleteButton.setVisible(false); } controlsLayout.addComponent(deleteButton, 2, 1); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); descriptionTextArea.setRows(4); descriptionTextArea.setWidth("100%"); controlsLayout.addComponent(descriptionLabel, 0, 2); controlsLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); controlsLayout.addComponent(descriptionTextArea, 1, 2); layout.addComponent(controlsLayout); layout.addComponent(this.businessStreamTable); return layout; }
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 ava2 s. com*/ 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.panel.TopologyViewPanel.java
License:BSD License
protected Layout createSystemEventPanel() { this.systemEventTable = new Table(); this.systemEventTable.setSizeFull(); this.systemEventTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); this.systemEventTable.addContainerProperty("Subject", String.class, null); this.systemEventTable.setColumnExpandRatio("Subject", .3f); this.systemEventTable.addContainerProperty("Action", String.class, null); this.systemEventTable.setColumnExpandRatio("Action", .4f); this.systemEventTable.addContainerProperty("Actioned By", String.class, null); this.systemEventTable.setColumnExpandRatio("Actioned By", .15f); this.systemEventTable.addContainerProperty("Timestamp", String.class, null); this.systemEventTable.setColumnExpandRatio("Timestamp", .15f); this.systemEventTable.setStyleName("wordwrap-table"); this.systemEventTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override/*from w w w . j a v a 2 s. c om*/ 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) { systemEventTable.removeAllItems(); PagedSearchResult<SystemEvent> systemEvents = systemEventService.listSystemEvents(0, 10000, "timestamp", true, null, null, systemEventFromDate.getValue(), systemEventToDate.getValue(), null); for (SystemEvent systemEvent : systemEvents.getPagedResults()) { SimpleDateFormat format = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); String timestamp = format.format(systemEvent.getTimestamp()); systemEventTable.addItem(new Object[] { systemEvent.getSubject(), systemEvent.getAction(), systemEvent.getActor(), timestamp }, systemEvent); } } }); GridLayout layout = new GridLayout(1, 2); GridLayout dateSelectLayout = new GridLayout(2, 2); dateSelectLayout.setColumnExpandRatio(0, 0.25f); dateSelectLayout.setSpacing(true); dateSelectLayout.setWidth("50%"); this.systemEventFromDate = new PopupDateField("From date"); this.systemEventFromDate.setResolution(Resolution.MINUTE); this.systemEventFromDate.setValue(this.getMidnightToday()); dateSelectLayout.addComponent(this.systemEventFromDate, 0, 0); this.systemEventToDate = new PopupDateField("To date"); this.systemEventToDate.setResolution(Resolution.MINUTE); this.systemEventToDate.setValue(this.getTwentyThreeFixtyNineToday()); dateSelectLayout.addComponent(this.systemEventToDate, 1, 0); dateSelectLayout.addComponent(searchButton, 0, 1, 1, 1); HorizontalLayout hSearchLayout = new HorizontalLayout(); hSearchLayout.setHeight(75, Unit.PIXELS); hSearchLayout.setWidth("100%"); hSearchLayout.addComponent(dateSelectLayout); layout.addComponent(hSearchLayout); HorizontalLayout hErrorTable = new HorizontalLayout(); hErrorTable.setWidth("100%"); hErrorTable.setHeight(600, Unit.PIXELS); hErrorTable.addComponent(this.systemEventTable); layout.addComponent(hErrorTable); layout.setSizeFull(); return layout; }
From source file:org.ikasan.dashboard.ui.topology.window.ActionedExclusionEventViewWindow.java
License:BSD License
protected Panel createExclusionEventDetailsPanel() { Panel exclusionEventDetailsPanel = new Panel(); exclusionEventDetailsPanel.setSizeFull(); exclusionEventDetailsPanel.setStyleName("dashboard"); GridLayout layout = new GridLayout(4, 7); layout.setSpacing(true);// ww w . j a v a 2s .c om layout.setColumnExpandRatio(0, .10f); layout.setColumnExpandRatio(1, .30f); layout.setColumnExpandRatio(2, .05f); layout.setColumnExpandRatio(3, .30f); layout.setWidth("100%"); Label exclusionEvenDetailsLabel = new Label("Actioned Exclusion Event Details"); exclusionEvenDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(exclusionEvenDetailsLabel, 0, 0, 3, 0); Label label = new Label("Module Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 1); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf1 = new TextField(); tf1.setValue(this.action.getModuleName()); tf1.setReadOnly(true); tf1.setWidth("80%"); layout.addComponent(tf1, 1, 1); label = new Label("Flow Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 2); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf2 = new TextField(); tf2.setValue(this.action.getFlowName()); tf2.setReadOnly(true); tf2.setWidth("80%"); layout.addComponent(tf2, 1, 2); label = new Label("Event Id:"); label.setSizeUndefined(); layout.addComponent(label, 0, 3); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf3 = new TextField(); tf3.setValue(this.errorOccurrence.getEventLifeIdentifier()); tf3.setReadOnly(true); tf3.setWidth("80%"); layout.addComponent(tf3, 1, 3); label = new Label("Date/Time:"); label.setSizeUndefined(); layout.addComponent(label, 0, 4); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf4 = new TextField(); tf4.setValue(new Date(this.action.getTimestamp()).toString()); tf4.setReadOnly(true); tf4.setWidth("80%"); layout.addComponent(tf4, 1, 4); label = new Label("Error URI:"); label.setSizeUndefined(); layout.addComponent(label, 0, 5); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf5 = new TextField(); tf5.setValue(this.action.getErrorUri()); tf5.setReadOnly(true); tf5.setWidth("80%"); layout.addComponent(tf5, 1, 5); label = new Label("Action:"); label.setSizeUndefined(); layout.addComponent(label, 2, 1); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); final TextField tf6 = new TextField(); if (this.action != null) { tf6.setValue(action.getAction()); } tf6.setReadOnly(true); tf6.setWidth("80%"); layout.addComponent(tf6, 3, 1); label = new Label("Actioned By:"); label.setSizeUndefined(); layout.addComponent(label, 2, 2); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); final TextField tf7 = new TextField(); if (this.action != null) { tf7.setValue(action.getActionedBy()); } tf7.setReadOnly(true); tf7.setWidth("80%"); layout.addComponent(tf7, 3, 2); label = new Label("Actioned Time:"); label.setSizeUndefined(); layout.addComponent(label, 2, 3); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); final TextField tf8 = new TextField(); if (this.action != null) { tf8.setValue(new Date(action.getTimestamp()).toString()); } tf8.setReadOnly(true); tf8.setWidth("80%"); layout.addComponent(tf8, 3, 3); AceEditor eventEditor = new AceEditor(); eventEditor.setCaption("Event Payload"); Object event = this.serialiserFactory.getDefaultSerialiser().deserialise(this.action.getEvent()); eventEditor.setValue(event.toString()); eventEditor.setReadOnly(true); eventEditor.setMode(AceMode.java); eventEditor.setTheme(AceTheme.eclipse); eventEditor.setWidth("100%"); eventEditor.setHeight(600, Unit.PIXELS); HorizontalLayout eventEditorLayout = new HorizontalLayout(); eventEditorLayout.setSizeFull(); eventEditorLayout.setMargin(true); eventEditorLayout.addComponent(eventEditor); AceEditor errorEditor = new AceEditor(); errorEditor.setCaption("Error Details"); errorEditor.setValue(this.errorOccurrence.getErrorDetail()); errorEditor.setReadOnly(true); errorEditor.setMode(AceMode.xml); errorEditor.setTheme(AceTheme.eclipse); errorEditor.setWidth("100%"); errorEditor.setHeight(600, Unit.PIXELS); HorizontalLayout errorEditorLayout = new HorizontalLayout(); errorEditorLayout.setSizeFull(); errorEditorLayout.setMargin(true); errorEditorLayout.addComponent(errorEditor); VerticalSplitPanel splitPanel = new VerticalSplitPanel(); splitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE); splitPanel.setWidth("100%"); splitPanel.setHeight(800, Unit.PIXELS); splitPanel.setFirstComponent(eventEditorLayout); splitPanel.setSecondComponent(errorEditorLayout); HorizontalLayout formLayout = new HorizontalLayout(); formLayout.setWidth("100%"); formLayout.setHeight(220, Unit.PIXELS); formLayout.addComponent(layout); GridLayout wrapperLayout = new GridLayout(1, 4); wrapperLayout.setMargin(true); wrapperLayout.setWidth("100%"); wrapperLayout.addComponent(formLayout); wrapperLayout.addComponent(splitPanel); exclusionEventDetailsPanel.setContent(wrapperLayout); return exclusionEventDetailsPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.CategorisedErrorOccurrenceViewWindow.java
License:BSD License
protected Panel createErrorOccurrenceDetailsPanel() { Panel errorOccurrenceDetailsPanel = new Panel(); GridLayout layout = new GridLayout(4, 7); layout.setWidth("100%"); layout.setSpacing(true);//from ww w. j a v a 2 s . c o m layout.setColumnExpandRatio(0, .10f); layout.setColumnExpandRatio(1, .30f); layout.setColumnExpandRatio(2, .05f); layout.setColumnExpandRatio(3, .30f); Label errorOccurrenceDetailsLabel = new Label(" Categorised Error Occurence Details", ContentMode.HTML); Label errorCategoryLabel = new Label(); if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.BLOCKER)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.BAN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.BAN.getHtml() + " Blocker", ContentMode.HTML); } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.CRITICAL)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.EXCLAMATION.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.EXCLAMATION.getHtml() + " Critical", ContentMode.HTML); } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.MAJOR)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.ARROW_UP.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.ARROW_UP.getHtml() + " Major", ContentMode.HTML); } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.TRIVIAL)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.ARROW_DOWN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.ARROW_DOWN.getHtml() + " Trivial", ContentMode.HTML); } errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 3, 0); Label label = new Label("Module Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 1); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf1 = new TextField(); tf1.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getModuleName()); tf1.setReadOnly(true); tf1.setWidth("80%"); layout.addComponent(tf1, 1, 1); label = new Label("Flow Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 2); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf2 = new TextField(); tf2.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowName()); tf2.setReadOnly(true); tf2.setWidth("80%"); layout.addComponent(tf2, 1, 2); label = new Label("Component Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 3); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf3 = new TextField(); tf3.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowElementName()); tf3.setReadOnly(true); tf3.setWidth("80%"); layout.addComponent(tf3, 1, 3); label = new Label("Date/Time:"); label.setSizeUndefined(); layout.addComponent(label, 0, 4); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf4 = new TextField(); tf4.setValue(new Date(this.categorisedErrorOccurrence.getErrorOccurrence().getTimestamp()).toString()); tf4.setReadOnly(true); tf4.setWidth("80%"); layout.addComponent(tf4, 1, 4); GridLayout wrapperLayout = new GridLayout(1, 4); wrapperLayout.setMargin(true); wrapperLayout.setWidth("100%"); Label errorMessageLabel = new Label("Error Message:"); errorMessageLabel.setSizeUndefined(); layout.addComponent(errorMessageLabel, 0, 5); layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT); final TextArea errorMessageTextArea = new TextArea(); errorMessageTextArea.setWidth("650px"); errorMessageTextArea.setRows(6); errorMessageTextArea .setValue(this.categorisedErrorOccurrence.getErrorCategorisation().getErrorDescription()); layout.addComponent(errorMessageTextArea, 1, 5, 3, 5); AceEditor editor = new AceEditor(); editor.setCaption("Error Details"); editor.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getErrorDetail()); editor.setReadOnly(true); editor.setMode(AceMode.xml); editor.setTheme(AceTheme.eclipse); editor.setHeight(470, Unit.PIXELS); editor.setWidth("100%"); label = new Label("Error Category:"); label.setSizeUndefined(); layout.addComponent(label, 2, 1); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); layout.addComponent(errorCategoryLabel, 3, 1); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_LEFT); label = new Label("System Action:"); label.setSizeUndefined(); layout.addComponent(label, 2, 2); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField systemAction = new TextField(); systemAction.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getAction()); systemAction.setReadOnly(true); systemAction.setWidth("80%"); layout.addComponent(systemAction, 3, 2); label = new Label("User Action:"); label.setSizeUndefined(); layout.addComponent(label, 2, 3); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField userAction = new TextField(); userAction.setValue(""); userAction.setReadOnly(true); userAction.setWidth("80%"); layout.addComponent(userAction, 3, 3); label = new Label("User Action By:"); label.setSizeUndefined(); layout.addComponent(label, 2, 4); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); Label userActionBy = new Label(); userActionBy.setValue(""); userActionBy.setReadOnly(true); userActionBy.setWidth("80%"); layout.addComponent(userActionBy, 3, 4); AceEditor eventEditor = new AceEditor(); eventEditor.setCaption("Event Payload"); if (this.categorisedErrorOccurrence.getErrorOccurrence().getEvent() != null) { eventEditor .setValue(new String((byte[]) this.categorisedErrorOccurrence.getErrorOccurrence().getEvent())); } eventEditor.setReadOnly(true); eventEditor.setMode(AceMode.java); eventEditor.setTheme(AceTheme.eclipse); eventEditor.setHeight(470, Unit.PIXELS); eventEditor.setWidth("100%"); HorizontalLayout formLayout = new HorizontalLayout(); formLayout.setWidth("100%"); formLayout.setHeight(300, Unit.PIXELS); formLayout.addComponent(layout); wrapperLayout.addComponent(formLayout, 0, 0); // VerticalSplitPanel vSplitPanel = new VerticalSplitPanel(); // vSplitPanel.setWidth("100%"); // vSplitPanel.setHeight(800, Unit.PIXELS); // vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE); TabSheet tabsheet = new TabSheet(); tabsheet.setSizeFull(); HorizontalLayout h1 = new HorizontalLayout(); h1.setSizeFull(); h1.setMargin(true); h1.addComponent(eventEditor); // vSplitPanel.setFirstComponent(h1); HorizontalLayout h2 = new HorizontalLayout(); h2.setSizeFull(); h2.setMargin(true); h2.addComponent(editor); // vSplitPanel.setSecondComponent(h2); tabsheet.addTab(h2, "Error Details"); tabsheet.addTab(h1, "Event Payload"); wrapperLayout.addComponent(tabsheet, 0, 1); // wrapperLayout.addComponent(vSplitPanel, 0, 1); errorOccurrenceDetailsPanel.setContent(wrapperLayout); return errorOccurrenceDetailsPanel; }