List of usage examples for com.vaadin.ui VerticalSplitPanel addStyleName
@Override public void addStyleName(String style)
From source file:com.cavisson.gui.dashboard.components.controls.SplitPanels.java
License:Apache License
public SplitPanels() { setMargin(true);//ww w . j a v a2 s.co m Label h1 = new Label("Split Panels"); h1.addStyleName("h1"); addComponent(h1); addComponent(new Label( "Outlines are just to show the areas of the SplitPanels. They are not part of the actual component style.")); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); row.setMargin(new MarginInfo(true, false, false, false)); addComponent(row); HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setCaption("Default style"); sp.setWidth("400px"); sp.setHeight(null); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); VerticalSplitPanel sp2 = new VerticalSplitPanel(); sp2.setCaption("Default style"); sp2.setWidth("300px"); sp2.setHeight("200px"); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); sp = new HorizontalSplitPanel(); sp.setCaption("Large style"); sp.setWidth("300px"); sp.setHeight("200px"); sp.addStyleName("large"); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); sp2 = new VerticalSplitPanel(); sp2.setCaption("Large style"); sp2.setWidth("300px"); sp2.setHeight("200px"); sp2.addStyleName("large"); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); }
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);// w w 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); 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.ExclusionEventViewWindow.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);//from w ww . j ava2 s . c o m layout.setColumnExpandRatio(0, .10f); layout.setColumnExpandRatio(1, .30f); layout.setColumnExpandRatio(2, .05f); layout.setColumnExpandRatio(3, .30f); layout.setWidth("100%"); Label exclusionEvenDetailsLabel = new Label("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.exclusionEvent.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.exclusionEvent.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.exclusionEvent.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(exclusionEvent.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); final Button resubmitButton = new Button("Re-submit"); final Button ignoreButton = new Button("Ignore"); resubmitButton.addClickListener(new Button.ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(authentication.getName(), (String) authentication.getCredentials()); ClientConfig clientConfig = new ClientConfig(); clientConfig.register(feature); Client client = ClientBuilder.newClient(clientConfig); Module module = topologyService.getModuleByName(exclusionEvent.getModuleName()); if (module == null) { Notification .show("Unable to find server information for module we are attempting to re-submit to: " + exclusionEvent.getModuleName(), Type.ERROR_MESSAGE); return; } Server server = module.getServer(); String url = "http://" + server.getUrl() + ":" + server.getPort() + module.getContextRoot() + "/rest/resubmission/resubmit/" + exclusionEvent.getModuleName() + "/" + exclusionEvent.getFlowName() + "/" + exclusionEvent.getErrorUri(); logger.info("Resubmission Url: " + url); WebTarget webTarget = client.target(url); Response response = webTarget.request() .put(Entity.entity(exclusionEvent.getEvent(), MediaType.APPLICATION_OCTET_STREAM)); if (response.getStatus() != 200) { response.bufferEntity(); String responseMessage = response.readEntity(String.class); Notification.show("An error was received trying to resubmit event: " + responseMessage, Type.ERROR_MESSAGE); } else { Notification.show("Event resumitted successfully."); resubmitButton.setVisible(false); ignoreButton.setVisible(false); ExclusionEventAction action = hospitalManagementService .getExclusionEventActionByErrorUri(exclusionEvent.getErrorUri()); tf6.setReadOnly(false); tf7.setReadOnly(false); tf8.setReadOnly(false); tf6.setValue(action.getAction()); tf7.setValue(action.getActionedBy()); tf8.setValue(new Date(action.getTimestamp()).toString()); tf6.setReadOnly(true); tf7.setReadOnly(true); tf8.setReadOnly(true); } } }); ignoreButton.addClickListener(new Button.ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(authentication.getName(), (String) authentication.getCredentials()); ClientConfig clientConfig = new ClientConfig(); clientConfig.register(feature); Client client = ClientBuilder.newClient(clientConfig); Module module = topologyService.getModuleByName(exclusionEvent.getModuleName()); if (module == null) { Notification .show("Unable to find server information for module we are submitting the ignore to: " + exclusionEvent.getModuleName(), Type.ERROR_MESSAGE); return; } Server server = module.getServer(); String url = "http://" + server.getUrl() + ":" + server.getPort() + module.getContextRoot() + "/rest/resubmission/ignore/" + exclusionEvent.getModuleName() + "/" + exclusionEvent.getFlowName() + "/" + exclusionEvent.getErrorUri(); logger.info("Ignore Url: " + url); WebTarget webTarget = client.target(url); Response response = webTarget.request() .put(Entity.entity(exclusionEvent.getEvent(), MediaType.APPLICATION_OCTET_STREAM)); if (response.getStatus() != 200) { response.bufferEntity(); String responseMessage = response.readEntity(String.class); Notification.show("An error was received trying to resubmit event: " + responseMessage, Type.ERROR_MESSAGE); } else { Notification.show("Event ignored successfully."); resubmitButton.setVisible(false); ignoreButton.setVisible(false); ExclusionEventAction action = hospitalManagementService .getExclusionEventActionByErrorUri(exclusionEvent.getErrorUri()); tf6.setReadOnly(false); tf7.setReadOnly(false); tf8.setReadOnly(false); tf6.setValue(action.getAction()); tf7.setValue(action.getActionedBy()); tf8.setValue(new Date(action.getTimestamp()).toString()); tf6.setReadOnly(true); tf7.setReadOnly(true); tf8.setReadOnly(true); } } }); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setHeight("100%"); buttonLayout.setSpacing(true); buttonLayout.setWidth(200, Unit.PIXELS); buttonLayout.setMargin(true); buttonLayout.addComponent(resubmitButton); buttonLayout.addComponent(ignoreButton); if (this.action == null) { layout.addComponent(buttonLayout, 0, 6, 3, 6); layout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); } final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority(SecurityConstants.ACTION_EXCLUSIONS_AUTHORITY))) { resubmitButton.setVisible(false); ignoreButton.setVisible(false); } AceEditor eventEditor = new AceEditor(); eventEditor.setCaption("Event Payload"); logger.info("Setting exclusion event to: " + new String(this.exclusionEvent.getEvent())); Object event = this.serialiserFactory.getDefaultSerialiser().deserialise(this.exclusionEvent.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); HorizontalLayout h1 = new HorizontalLayout(); h1.setSizeFull(); h1.setMargin(true); h1.addComponent(eventEditorLayout); splitPanel.setFirstComponent(eventEditorLayout); HorizontalLayout h2 = new HorizontalLayout(); h2.setSizeFull(); h2.setMargin(true); h2.addComponent(errorEditorLayout); splitPanel.setSecondComponent(errorEditorLayout); HorizontalLayout formLayout = new HorizontalLayout(); formLayout.setWidth("100%"); formLayout.setHeight(240, 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; }