List of usage examples for com.vaadin.ui VerticalSplitPanel VerticalSplitPanel
public VerticalSplitPanel()
From source file:org.jumpmind.metl.ui.views.manage.ExecutionRunPanel.java
License:Open Source License
public ExecutionRunPanel(String executionId, ApplicationContext context, TabbedPanel parentTabSheet, IFlowRunnable flowRunnable) {/* w w w . j a va 2s . c o m*/ this.executionService = context.getExecutionService(); this.executionId = executionId; this.context = context; this.parentTabSheet = parentTabSheet; this.flowRunnable = flowRunnable; Execution execution = executionService.findExecution(executionId); this.flow = context.getConfigurationService().findFlow(execution.getFlowId()); HorizontalLayout topBar = new HorizontalLayout(); topBar.setMargin(new MarginInfo(true, true, false, true)); topBar.setWidth(100, Unit.PERCENTAGE); HorizontalLayout left = new HorizontalLayout(); topBar.addComponent(left); HorizontalLayout right = new HorizontalLayout(); right.setSpacing(true); topBar.addComponent(right); topBar.setComponentAlignment(right, Alignment.MIDDLE_RIGHT); Label limitLabel = new Label("Max Log Messages To Show :"); right.addComponent(limitLabel); right.setComponentAlignment(limitLabel, Alignment.MIDDLE_RIGHT); limitField = new ImmediateUpdateTextField(null) { private static final long serialVersionUID = 1L; @Override protected void save(String text) { Setting setting = context.getUser().findSetting(UserSetting.SETTING_MAX_LOG_MESSAGE_TO_SHOW); setting.setValue(Integer.toString(getMaxToShow(text))); context.getConfigurationService().save(setting); } }; limitField.setWidth("5em"); limitField.setValue(context.getUser().get(UserSetting.SETTING_MAX_LOG_MESSAGE_TO_SHOW, "1000")); right.addComponent(limitField); right.setComponentAlignment(limitField, Alignment.MIDDLE_RIGHT); showDiagramCheckbox = new CheckBox("Show Diagram"); showDiagramCheckbox.addValueChangeListener((event) -> { if (showDiagramCheckbox.getValue()) { showDiagram(); } else { showDetails(); } }); right.addComponent(showDiagramCheckbox); right.setComponentAlignment(showDiagramCheckbox, Alignment.MIDDLE_RIGHT); addComponent(topBar); ButtonBar buttonBar = new ButtonBar(); rerunButton = buttonBar.addButton("Rerun", Icons.RUN, event -> rerun()); rerunButton.setVisible(false); removeButton = buttonBar.addButton("Remove", Icons.DELETE, event -> remove()); removeButton.setVisible(false); cancelButton = buttonBar.addButton("Cancel", Icons.CANCEL, event -> cancel()); addComponent(buttonBar); HorizontalLayout header1 = new HorizontalLayout(); header1.addComponent(new Label("<b>Flow:</b>", ContentMode.HTML)); header1.addComponent(flowLabel); header1.addComponent(new Label("<b>Start:</b>", ContentMode.HTML)); header1.addComponent(startLabel); header1.setSpacing(true); header1.setMargin(new MarginInfo(false, true, false, true)); header1.setWidth("100%"); addComponent(header1); HorizontalLayout header2 = new HorizontalLayout(); header2.addComponent(new Label("<b>Status:</b>", ContentMode.HTML)); header2.addComponent(statusLabel); header2.addComponent(new Label("<b>End:</b>", ContentMode.HTML)); header2.addComponent(endLabel); header2.setSpacing(true); header2.setMargin(new MarginInfo(false, true, true, true)); header2.setWidth("100%"); addComponent(header2); stepContainer.setBeanIdProperty("id"); diagramLayout = new VerticalLayout(); diagramLayout.setWidth(10000, Unit.PIXELS); diagramLayout.setHeight(10000, Unit.PIXELS); flowPanel = new Panel(); flowPanel.setSizeFull(); flowPanel.addStyleName(ValoTheme.PANEL_WELL); flowPanel.setContent(diagramLayout); stepTable.setContainerDataSource(stepContainer); stepTable.setSelectable(true); stepTable.setMultiSelect(true); stepTable.setImmediate(true); stepTable.setSizeFull(); stepTable.setVisibleColumns( new Object[] { "componentName", "threadNumber", "status", "payloadReceived", "messagesReceived", "messagesProduced", "payloadProduced", "startTime", "endTime", "handleDurationString" }); stepTable.setColumnHeaders(new String[] { "Component Name", "Thread", "Status", "Payload Recvd", "Msgs Recvd", "Msgs Sent", "Payload Sent", "Start", "End", "Run Duration" }); stepTable.setColumnWidth("status", 100); stepTable.setColumnWidth("messagesReceived", 100); stepTable.setColumnWidth("messagesProduced", 100); stepTable.setColumnWidth("payloadReceived", 100); stepTable.setColumnWidth("payloadProduced", 100); stepTable.setColumnWidth("threadNumber", 100); stepTable.setColumnWidth("startTime", 170); stepTable.setColumnWidth("endTime", 170); stepTable.setColumnExpandRatio("handleDurationString", 1); stepTable.addValueChangeListener(event -> { @SuppressWarnings("unchecked") Set<String> executionStepIds = (Set<String>) event.getProperty().getValue(); logContainer.removeAllItems(); List<ExecutionStepLog> logs = executionService.findExecutionStepLogs(executionStepIds, getMaxToShow()); logContainer.addAll(logs); }); stepTable.addValueChangeListener(event -> { @SuppressWarnings("unchecked") Set<String> executionStepIds = (Set<String>) event.getProperty().getValue(); logContainer.removeAllItems(); List<ExecutionStepLog> logs = executionService.findExecutionStepLogs(executionStepIds, getMaxToShow()); logContainer.addAll(logs); }); logTable = new Grid(); logTable.addColumn("level", String.class).setHeaderCaption("Level").setWidth(110).setMaximumWidth(200); logTable.addColumn("createTime", Date.class).setHeaderCaption("Time").setWidth(120).setMaximumWidth(200) .setRenderer(new DateRenderer(UiConstants.TIME_FORMAT)); logTable.addColumn("logText", String.class).setHeaderCaption("Message").setExpandRatio(1); logTable.setContainerDataSource(logContainer); logTable.setSizeFull(); logTable.addItemClickListener(event -> logTableCellClicked(logTable, event)); logTable.addSortListener(event -> { lastSortOrder = event.getSortOrder(); }); HeaderRow filteringHeader = logTable.appendHeaderRow(); HeaderCell logTextFilterCell = filteringHeader.getCell("logText"); TextField filterField = new TextField(); filterField.setInputPrompt("Filter"); filterField.addStyleName(ValoTheme.TEXTFIELD_TINY); filterField.setWidth("100%"); // Update filter When the filter input is changed filterField.addTextChangeListener(change -> { // Can't modify filters so need to replace logContainer.removeContainerFilters("logText"); // (Re)create the filter if necessary if (!change.getText().isEmpty()) logContainer.addContainerFilter(new SimpleStringFilter("logText", change.getText(), true, false)); }); logTextFilterCell.setComponent(filterField); HeaderCell levelFilterCell = filteringHeader.getCell("level"); ComboBox levelFilter = new ComboBox(); levelFilter.setWidth(8, Unit.EM); levelFilter.setNullSelectionAllowed(true); LogLevel[] levels = LogLevel.values(); for (LogLevel logLevel : levels) { levelFilter.addItem(logLevel.name()); } levelFilter.addValueChangeListener(change -> { logContainer.removeContainerFilters("level"); String text = (String) levelFilter.getValue(); if (isNotBlank(text)) { logContainer.addContainerFilter(new SimpleStringFilter("level", text, true, false)); } }); levelFilterCell.setComponent(levelFilter); levelFilter.addStyleName(ValoTheme.COMBOBOX_TINY); splitPanel = new VerticalSplitPanel(); splitPanel.setFirstComponent(flowPanel); splitPanel.setSecondComponent(logTable); splitPanel.setSplitPosition(50f); splitPanel.setSizeFull(); addComponent(splitPanel); setExpandRatio(splitPanel, 1.0f); showDiagramCheckbox.setValue(context.getUser().getBoolean(UserSetting.SETTING_SHOW_RUN_DIAGRAM, true)); if (!showDiagramCheckbox.getValue()) { showDetails(); } context.getBackgroundRefresherService().register(this); }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.SplitPanelPresentation.java
License:Open Source License
@Override public ComponentContainer doCreateWidget(Object parent) { if (splitPanel == null) { splitPanel = modelAccess.yLayout.isVertical() ? new VerticalSplitPanel() : new HorizontalSplitPanel(); setupComponent(splitPanel, getCastedModel()); splitPanel.setSplitPosition(modelAccess.yLayout.getSplitPosition(), Unit.PERCENTAGE); associateWidget(splitPanel, modelAccess.yLayout); if (modelAccess.isCssIdValid()) { splitPanel.setId(modelAccess.getCssID()); } else {// w w w . j a va 2s . com splitPanel.setId(getEditpart().getId()); } if (modelAccess.isCssClassValid()) { splitPanel.addStyleName(modelAccess.getCssClass()); } else { splitPanel.addStyleName(CSS_CLASS_CONTROL); } // creates the binding for the field createBindings(modelAccess.yLayout, splitPanel, null); // initialize all children initializeChildren(); renderChildren(false); } return splitPanel; }
From source file:org.openeos.services.ui.vaadin.internal.VaadinWindowImpl.java
License:Apache License
@Override protected ComponentContainer createMainContainer() { Panel mainPanel = new Panel(); mainPanel.setSizeFull();/* www. j a v a 2 s .co m*/ if (!multipleLevels) { firstContainer = mainPanel; } else { VerticalSplitPanel vSplit = new VerticalSplitPanel(); vSplit.setSizeFull(); mainPanel.setContent(vSplit); firstContainer = new Panel(); firstContainer.setSizeFull(); vSplit.setFirstComponent(firstContainer); secondContainer = new Panel(); secondContainer.setSizeFull(); vSplit.setSecondComponent(secondContainer); vSplit.setLocked(false); } return mainPanel; }
From source file:org.opennms.features.topology.app.internal.TopologyUI.java
License:Open Source License
/** * Updates the bottom widget area with the registered widgets * /* w ww. ja va2 s.co m*/ * Any widget with the service property of 'location=bottom' are * included. * * @param widgetManager The WidgetManager. */ private void updateWidgetView(WidgetManager widgetManager) { synchronized (m_layout) { m_layout.removeAllComponents(); if (widgetManager.widgetCount() == 0) { m_layout.addComponent(m_treeMapSplitPanel); } else { VerticalSplitPanel bottomLayoutBar = new VerticalSplitPanel(); bottomLayoutBar.setFirstComponent(m_treeMapSplitPanel); // Split the screen 70% top, 30% bottom bottomLayoutBar.setSplitPosition(70, Unit.PERCENTAGE); bottomLayoutBar.setSizeFull(); bottomLayoutBar.setSecondComponent(getTabSheet(widgetManager, this)); m_layout.addComponent(bottomLayoutBar); updateTabVisibility(); } m_layout.markAsDirty(); } m_layout.markAsDirty(); }
From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java
License:Open Source License
/** * Updates the bottom widget area with the registered widgets * /*from w ww . j a va2s. c o m*/ * Any widget with the service property of 'location=bottom' are * included. * * @param widgetManager */ private void updateWidgetView(WidgetManager widgetManager) { synchronized (m_layout) { m_layout.removeAllComponents(); if (widgetManager.widgetCount() == 0) { m_layout.addComponent(m_treeMapSplitPanel, getBelowMenuPosition()); } else { VerticalSplitPanel bottomLayoutBar = new VerticalSplitPanel(); bottomLayoutBar.setFirstComponent(m_treeMapSplitPanel); // Split the screen 70% top, 30% bottom bottomLayoutBar.setSplitPosition(70, Sizeable.UNITS_PERCENTAGE); bottomLayoutBar.setSizeFull(); bottomLayoutBar.setSecondComponent(getTabSheet(widgetManager, this)); m_layout.addComponent(bottomLayoutBar, getBelowMenuPosition()); } m_layout.requestRepaint(); } if (m_contextMenu != null && m_contextMenu.getParent() == null) { getMainWindow().addComponent(m_contextMenu); } }
From source file:org.opennms.features.topology.netutils.internal.TracerouteWindow.java
License:Open Source License
/** * The TracerouteWindow method constructs a TracerouteWindow component with a size proportionate to the * width and height of the main window.//w ww . j a v a2 s . c om * @param node * @param width Width of Main window * @param height Height of Main window */ public TracerouteWindow(final Node node, final String url) { this.tracerouteUrl = url; String label = ""; String ipAddress = ""; if (node != null) { label = node.getLabel(); ipAddress = node.getIPAddress(); } String caption = ""; /*Sets up window settings*/ if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) { label = ""; } if (!label.equals("")) caption = " - " + label; setCaption("Traceroute" + caption); setImmediate(true); setResizable(false); /*Initialize the header of the Sub-window with the name of the selected Node*/ String nodeName = "<div style=\"text-align: center; font-size: 18pt; font-weight:bold;\">" + label + "</div>"; nodeLabel = new Label(nodeName); nodeLabel.setContentMode(ContentMode.HTML); /*Creating various layouts to encapsulate all of the components*/ VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); vSplit = new VerticalSplitPanel(); topLayout = new VerticalLayout(); bottomLayout = new VerticalLayout(); VerticalLayout form = new VerticalLayout(); GridLayout grid = new GridLayout(2, 2); grid.setWidth("420"); grid.setHeight("62"); /*Sets up IP Address dropdown with the Name as default*/ ipDropdown = new NativeSelect(); ipDropdown.addItem(ipAddress); ipDropdown.select(ipAddress); /*Creates the Numerical Output Check box and sets up the listener*/ numericalDataCheckBox = new CheckBox("Use Numerical Node Names"); numericalDataCheckBox.setImmediate(true); numericalDataCheckBox.setValue(false); /*Creates the form labels and text fields*/ Label ipLabel = new Label("IP Address: "); Label forcedHopLabel = new Label("Forced Hop IP: "); forcedHopField = new TextField(); forcedHopField.setMaxLength(15); /*Add all of the components to the GridLayout*/ grid.addComponent(ipLabel); grid.setComponentAlignment(ipLabel, Alignment.MIDDLE_LEFT); grid.addComponent(ipDropdown); grid.setComponentAlignment(ipDropdown, Alignment.MIDDLE_LEFT); grid.addComponent(forcedHopLabel); grid.setComponentAlignment(forcedHopLabel, Alignment.MIDDLE_LEFT); grid.addComponent(forcedHopField); grid.setComponentAlignment(forcedHopField, Alignment.MIDDLE_LEFT); /*Creates the Ping button and sets up the listener*/ tracerouteButton = new Button("Traceroute"); tracerouteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { changeBrowserURL(buildURL()); } }); /*Adds components to the form and sets the width and spacing*/ form.addComponent(grid); form.addComponent(numericalDataCheckBox); form.addComponent(tracerouteButton); form.setWidth("100%"); form.setSpacing(true); /*Adds components to the Top Layout and sets the width and margins*/ topLayout.addComponent(nodeLabel); topLayout.setComponentAlignment(nodeLabel, Alignment.MIDDLE_CENTER); topLayout.addComponent(form); topLayout.setSizeFull(); topLayout.setMargin(new MarginInfo(true, true, false, true)); /*Adds components to the Bottom Layout and sets the width and margins*/ bottomLayout.setSizeFull(); bottomLayout.setMargin(true); bottomLayout.setImmediate(true); buildEmbeddedBrowser(); /*Setting first and second components for the split panel and setting the panel divider position*/ vSplit.setFirstComponent(topLayout); vSplit.setSecondComponent(bottomLayout); vSplit.setSplitPosition(splitHeight, Unit.PIXELS); vSplit.setLocked(true); /*Adds split panel to the main layout and expands the split panel to 100% of the layout space*/ mainLayout.addComponent(vSplit); mainLayout.setExpandRatio(vSplit, 1); setContent(mainLayout); }
From source file:org.opennms.features.vaadin.app.TopologyWidgetTestApplication.java
License:Open Source License
@Override public void init() { //This timer is a hack at the moment to disable and enable menuItems m_timer.scheduleAtFixedRate(new TimerTask() { @Override/*from ww w .j a v a 2s . c o m*/ public void run() { List<MenuItem> items = m_menuBar.getItems(); for (MenuItem item : items) { if (item.getText().equals("Device")) { List<MenuItem> children = item.getChildren(); for (MenuItem child : children) { if (m_graphContainer.getSelectedVertexIds().size() > 0) { if (!child.isEnabled()) { child.setEnabled(true); } } else { if (child.isEnabled()) { child.setEnabled(false); } } } } } } }, 1000, 1000); m_commandManager.addCommand(new Command("Redo Layout") { ; @Override public void doCommand(Object target) { m_graphContainer.redoLayout(); } @Override public boolean appliesToTarget(Object target) { //Applies to background as a whole return target == null; } }, true); m_commandManager.addCommand(new Command("Open") { @Override public void doCommand(Object target) { m_graphContainer.load("graph.xml"); } }, false, "File"); m_commandManager.addCommand(new Command("Save") { @Override public void doCommand(Object target) { m_graphContainer.save("graph.xml"); } }, false, "File"); m_commandManager.addCommand(new Command("Add Vertex") { @Override public boolean appliesToTarget(Object itemId) { return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId); } @Override public void doCommand(Object vertexId) { if (vertexId == null) { addRandomVertex(); } else { connectNewVertexTo(vertexId.toString(), SERVER_ICON); } m_graphContainer.redoLayout(); } }, true, "File"); m_commandManager.addCommand(new Command("Lock") { @Override public boolean appliesToTarget(Object itemId) { if (m_graphContainer.getVertexContainer().containsId(itemId)) { Item v = m_graphContainer.getVertexContainer().getItem(itemId); return !(Boolean) v.getItemProperty("locked").getValue(); } return false; } @Override public void doCommand(Object vertexId) { Item v = m_graphContainer.getVertexContainer().getItem(vertexId); v.getItemProperty("locked").setValue(true); } }, true); m_commandManager.addCommand(new Command("Unlock") { @Override public boolean appliesToTarget(Object itemId) { if (m_graphContainer.getVertexContainer().containsId(itemId)) { Item v = m_graphContainer.getVertexContainer().getItem(itemId); return (Boolean) v.getItemProperty("locked").getValue(); } return false; } @Override public void doCommand(Object vertexId) { Item v = m_graphContainer.getVertexContainer().getItem(vertexId); v.getItemProperty("locked").setValue(false); } }, true); m_commandManager.addCommand(new Command("Add Switch Vertex") { @Override public boolean appliesToTarget(Object itemId) { return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId); } @Override public void doCommand(Object vertexId) { if (vertexId == null) { addRandomVertex(); } else { connectNewVertexTo(vertexId.toString(), SWITCH_ICON); } m_graphContainer.redoLayout(); } }, true); m_commandManager.addCommand(new Command("Remove Vertex") { @Override public boolean appliesToTarget(Object itemId) { return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId); } @Override public void doCommand(Object vertexId) { if (vertexId == null) { System.err.println("need to handle selection!!!"); } else { m_graphContainer.removeVertex(vertexId.toString()); m_graphContainer.redoLayout(); } } }, true, "File"); m_commandManager.addCommand(new Command("Connect") { @Override public boolean appliesToTarget(Object itemId) { return m_graphContainer.getSelectedVertexIds().size() == 2; } @Override public void doCommand(Object unused) { List<Object> endPoints = new ArrayList<Object>(m_graphContainer.getSelectedVertexIds()); m_graphContainer.connectVertices(m_graphContainer.getNextEdgeId(), (String) endPoints.get(0), (String) endPoints.get(1)); } }, true, "File"); m_commandManager.addCommand(new Command("Create Group") { @Override public boolean appliesToTarget(Object itemId) { return m_graphContainer.getSelectedVertexIds().size() > 0; } @Override public void doCommand(Object vertexId) { String groupId = m_graphContainer.getNextGroupId(); m_graphContainer.addGroup(groupId, GROUP_ICON); m_graphContainer.getVertexContainer().setParent(groupId, ROOT_GROUP_ID); for (Object itemId : m_graphContainer.getSelectedVertexIds()) { m_graphContainer.getVertexContainer().setParent(itemId, groupId); } } }, true, "Edit"); m_commandManager.addCommand(new Command("Manual Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new ManualLayoutAlgorithm()); } }, false, "Edit|Layout"); m_commandManager.addCommand(new Command("Balloon Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new BalloonLayoutAlgorithm(CENTER_VERTEX_ID)); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("Circle Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new CircleLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("DAG Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new DAGLayoutAlgorithm(CENTER_VERTEX_ID)); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("Radial Tree Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new RadialTreeLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("Tree Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new TreeLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("Simple Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new SimpleLayoutAlgorithm()); } }, false, "Edit|Layout"); m_commandManager.addCommand(new Command("Spring Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new SpringLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("KK Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new KKLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("ISOM Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new ISOMLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("FR Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm()); } }, false, "Edit|Layout|JUNG"); m_commandManager.addCommand(new Command("Other Layout") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { m_graphContainer.setLayoutAlgorithm(new AlternativeLayoutAlgorithm()); } }, false, "Edit|Layout"); m_commandManager.addCommand(new Command("Reset") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { resetView(); } }, false, null); m_commandManager.addCommand(new Command("History") { @Override public boolean appliesToTarget(Object target) { return true; } @Override public void doCommand(Object target) { showHistoryList(m_commandManager.getHistoryList()); } }, false, null); m_commandManager.addCommand(new Command("Show Map") { @Override public void doCommand(Object target) { getMainWindow().showNotification("This has not been implemented yet"); } }, false, "View"); m_commandManager.addCommand(new Command("Get Info") { @Override public boolean appliesToTarget(Object itemId) { return itemId == null || m_graphContainer.getEdgeContainer().containsId(itemId); } @Override public void doCommand(Object target) { getMainWindow().showNotification("This has not been implemented yet"); } }, true, "Device"); AbsoluteLayout layout = new AbsoluteLayout(); layout.setSizeFull(); m_window = new Window("Topology Widget Test"); m_window.setContent(layout); setMainWindow(m_window); m_graphContainer.addGroup(ROOT_GROUP_ID, GROUP_ICON); m_graphContainer.addVertex(CENTER_VERTEX_ID, 50, 50, SERVER_ICON); m_graphContainer.getVertexContainer().setParent(CENTER_VERTEX_ID, ROOT_GROUP_ID); m_graphContainer.setLayoutAlgorithm(new KKLayoutAlgorithm()); m_topologyComponent = new TopologyComponent(m_graphContainer); m_commandManager.addActionHandlers(m_topologyComponent); m_topologyComponent.setSizeFull(); final Property scale = m_graphContainer.getProperty("scale"); final Slider slider = new Slider(1, 4); slider.setResolution(2); slider.setHeight("300px"); slider.setOrientation(Slider.ORIENTATION_VERTICAL); slider.addListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { scale.setValue((Double) slider.getValue()); } }); slider.setImmediate(true); m_tree = createTree(); Label semanticZoomLabel = new Label(); final Property zoomLevel = m_graphContainer.getProperty("semanticZoomLevel"); semanticZoomLabel.setPropertyDataSource(zoomLevel); Button zoomInBtn = new Button("Zoom In"); zoomInBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) zoomLevel.getValue(); szl++; zoomLevel.setValue(szl); m_graphContainer.redoLayout(); } }); Button zoomOutBtn = new Button("Zoom Out"); zoomOutBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) zoomLevel.getValue(); szl--; zoomLevel.setValue(szl); m_graphContainer.redoLayout(); } }); VerticalLayout vLayout = new VerticalLayout(); vLayout.setWidth("100%"); vLayout.setHeight("100%"); vLayout.addComponent(m_tree); AbsoluteLayout mapLayout = new AbsoluteLayout(); mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;"); mapLayout.addComponent(slider, "top: 20px; left: 20px; z-index:1000;"); mapLayout.addComponent(semanticZoomLabel, "bottom: 10px; right: 10px; z-index: 2000;"); mapLayout.setSizeFull(); HorizontalSplitPanel treeMapSplitPanel = new HorizontalSplitPanel(); treeMapSplitPanel.setFirstComponent(vLayout); treeMapSplitPanel.setSecondComponent(mapLayout); treeMapSplitPanel.setSplitPosition(100, Sizeable.UNITS_PIXELS); treeMapSplitPanel.setSizeFull(); VerticalSplitPanel bottomLayoutBar = new VerticalSplitPanel(); bottomLayoutBar.setFirstComponent(treeMapSplitPanel); VerticalLayout zoomLayout = new VerticalLayout(); zoomLayout.addComponent(zoomInBtn); zoomLayout.addComponent(zoomOutBtn); bottomLayoutBar.setSecondComponent(zoomLayout); bottomLayoutBar.setSplitPosition(80, Sizeable.UNITS_PERCENTAGE); bottomLayoutBar.setSizeFull(); m_menuBar = m_commandManager.getMenuBar(); m_menuBar.setWidth("100%"); layout.addComponent(m_menuBar, "top: 0px; left: 0px; right:0px;"); layout.addComponent(bottomLayoutBar, "top: 23px; left: 0px; right:0px; bottom:0px;"); }
From source file:org.opennms.features.vaadin.nodemaps.internal.NodeMapsApplication.java
License:Open Source License
private void updateWidgetView() { final VerticalSplitPanel bottomLayoutBar = new VerticalSplitPanel(); bottomLayoutBar.setFirstComponent(m_mapWidgetComponent); // Split the screen 70% top, 30% bottom bottomLayoutBar.setSplitPosition(70, Unit.PERCENTAGE); bottomLayoutBar.setSizeFull();/*from w w w . j a va 2 s. c om*/ bottomLayoutBar.setSecondComponent(getTabSheet()); m_layout.addComponent(bottomLayoutBar); m_layout.markAsDirty(); }
From source file:pt.yellowduck.ramboia.RamboiaApplication.java
License:Open Source License
private void buildMainLayout() { VerticalSplitPanel vSplit = new VerticalSplitPanel(); vSplit.setSplitPosition(15, Sizeable.UNITS_PERCENTAGE); vSplit.setSizeFull();/*from ww w. ja v a2s . co m*/ HorizontalSplitPanel hSplit_top = new HorizontalSplitPanel(); hSplit_top.setSizeFull(); hSplit_top.setSplitPosition(50, Sizeable.UNITS_PERCENTAGE); hSplit_top.setFirstComponent(viewPlayer); hSplit_top.setSecondComponent(viewUpload); hSplit_top.setLocked(true); vSplit.setFirstComponent(hSplit_top); HorizontalSplitPanel hSplit_bottom = new HorizontalSplitPanel(); hSplit_bottom.setSizeFull(); hSplit_bottom.setSplitPosition(75, Sizeable.UNITS_PERCENTAGE); hSplit_bottom.setFirstComponent(viewLibrary); hSplit_bottom.setSecondComponent(viewPlaylist); hSplit_bottom.setLocked(true); vSplit.setSecondComponent(hSplit_bottom); mainWindow.setContent(vSplit); }