List of usage examples for com.vaadin.ui GridLayout GridLayout
public GridLayout(int columns, int rows)
From source file:org.jpos.qi.system.MemoryUsageView.java
License:Open Source License
public MemoryUsageView() { super();/* w w w . j av a 2 s .co m*/ qi = (QI) UI.getCurrent(); setSpacing(false); setMargin(true); setSizeFull(); available = createLabel(); allocated = createLabel(); used = createLabel(); forceGC = new Button(qi.getMessage("memory-usage.force.gc")); GridLayout gl = new GridLayout(3, 3); gl.addComponent(strong(qi.getMessage("memory-usage.availableMemory"))); gl.addComponent(available); gl.setComponentAlignment(available, Alignment.TOP_RIGHT); gl.addComponent(createMBLabel()); gl.addComponent(strong(qi.getMessage("memory-usage.allocatedMemory"))); gl.addComponent(allocated); gl.setComponentAlignment(allocated, Alignment.TOP_RIGHT); gl.addComponent(createMBLabel()); gl.addComponent(strong(qi.getMessage("memory-usage.usedMemory"))); gl.addComponent(used); gl.setComponentAlignment(used, Alignment.TOP_RIGHT); gl.addComponent(createMBLabel()); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("75%"); hl.addComponent(gl); hl.setComponentAlignment(gl, Alignment.MIDDLE_CENTER); hl.addComponent(memoryGauge = createGauge("Memory", 0)); hl.setComponentAlignment(memoryGauge, Alignment.MIDDLE_CENTER); hl.addComponent(forceGC); hl.setComponentAlignment(forceGC, Alignment.MIDDLE_CENTER); forceGC.addClickListener((Button.ClickListener) event -> gc()); addComponent(hl); setComponentAlignment(hl, Alignment.MIDDLE_CENTER); Label l = new Label(""); l.setHeight("30px"); addComponent(l); chart = new DCharts(); ds = new DataSeries(); AxesDefaults axesDefaults = new AxesDefaults().setLabelRenderer(LabelRenderers.CANVAS); Axes axes = new Axes() .addAxis(new XYaxis(XYaxes.X).setLabel("Time (last 300 seconds)") .setLabelRenderer(LabelRenderers.AXIS).setPad(0)) .addAxis(new XYaxis(XYaxes.Y).setLabel("In use memory percentage").setPad(0) .setTickOptions(new AxisTickRenderer().setFormatString("%.2f%"))); Cursor cursor = new Cursor().setShow(true); Series series = new Series().addSeries(new XYseries().setLineWidth(0.5f) .setMarkerOptions(new MarkerRenderer().setStyle(MarkerStyles.CIRCLE).setShadow(true))); Options options = new Options().setAxesDefaults(axesDefaults).setCursor(cursor).setSeries(series) .setAxes(axes); chart.setDataSeries(ds).show(); chart.setOptions(options); chart.setSizeFull(); // chart.setHeight("450px"); // chart.setWidth("450px"); addComponent(chart); // setComponentAlignment(chart, Alignment.BOTTOM_CENTER); }
From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java
License:Open Source License
@Override public void init(VaadinRequest request) { // initialize push ///*w w w . j a v a2 s. com*/ pusher = new ICEPush(); pusher.extend(this); // prepare UI // GridLayout root = new GridLayout(8, 8); root.setStyleName(Reindeer.LAYOUT_BLUE); root.addStyleName("kwiee"); root.setSizeFull(); root.setMargin(new MarginInfo(false, true, true, true)); root.setSpacing(false); setContent(root); root.setRowExpandRatio(0, 0.7f); root.setRowExpandRatio(1, 1.0f); root.setRowExpandRatio(2, 1.0f); root.setRowExpandRatio(3, 1.0f); root.setRowExpandRatio(4, 1.0f); root.setRowExpandRatio(5, 1.0f); root.setRowExpandRatio(6, 1.0f); root.setRowExpandRatio(7, 0.4f); // Create top frame topFrame = new HorizontalLayout(); topFrame.addStyleName("k-topframe"); topFrame.setMargin(true); topFrame.setSpacing(true); topFrame.setSizeFull(); root.addComponent(topFrame, 1, 0, 7, 0); // Create top frame navFrame = new CssLayout(); navFrame.addStyleName("k-navframe"); navFrame.setSizeFull(); root.addComponent(navFrame, 0, 1, 0, 6); // Create main frame mainFrame = new CssLayout(); mainFrame.setSizeFull(); root.addComponent(mainFrame, 1, 1, 7, 6); tabSheet = new TabSheet(); tabSheet.setSizeFull(); mainFrame.addComponent(tabSheet); // task table createTasksTable(); // Create bottom frame bottomFrame = new CssLayout(); bottomFrame.addStyleName("k-bottomframe"); bottomFrame.setSizeFull(); root.addComponent(bottomFrame, 0, 7, 7, 7); initialized = true; // attach the pending modules // synchronized (this) { for (IUIModule module : pendingModules) { attachModule(module); } pendingModules.clear(); } }
From source file:org.lunifera.examples.runtime.web.vaadin.databinding.DatabindingDemoUI.java
License:Open Source License
@Override public void init(VaadinRequest request) { VaadinObservables.getRealm(getUI()); dbc = new DataBindingContext(); GridLayout layout = new GridLayout(3, 4); layout.setStyleName(Reindeer.LAYOUT_BLUE); layout.setWidth("100%"); layout.setMargin(true);//from w ww.j a v a2 s . c o m setContent(layout); row1(layout); row2(layout); row3(layout); row4(layout); }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.GridLayoutPresentation.java
License:Open Source License
@Override public ComponentContainer doCreateWidget(Object parent) { if (componentBase == null) { componentBase = new CssLayout(); componentBase.setSizeFull();//from w w w . j av a 2s.c o m componentBase.addStyleName(CSS_CLASS_CONTROL_BASE); if (modelAccess.isCssIdValid()) { componentBase.setId(modelAccess.getCssID()); } else { componentBase.setId(getEditpart().getId()); } associateWidget(componentBase, modelAccess.yLayout); gridlayout = new GridLayout(modelAccess.getColumns(), 1); gridlayout.setSpacing(false); gridlayout.setImmediate(true); componentBase.addComponent(gridlayout); associateWidget(gridlayout, modelAccess.yLayout); if (modelAccess.isMargin()) { gridlayout.addStyleName(IConstants.CSS_CLASS_MARGIN); gridlayout.setMargin(true); } if (modelAccess.isSpacing()) { gridlayout.setData(IConstants.CSS_CLASS_SPACING); gridlayout.setSpacing(true); } if (modelAccess.isCssClassValid()) { gridlayout.addStyleName(modelAccess.getCssClass()); } else { gridlayout.addStyleName(CSS_CLASS_CONTROL); } renderChildren(false); } return componentBase; }
From source file:org.lunifera.web.ecp.uimodel.presentation.vaadin.internal.GridLayoutPresentation.java
License:Open Source License
@Override public ComponentContainer createWidget(Object parent) { if (componentBase == null) { componentBase = new CssLayout(); componentBase.setSizeFull();/* w ww. ja va2 s .c o m*/ componentBase.addStyleName(CSS_CLASS__CONTROL_BASE); if (modelAccess.isCssIdValid()) { componentBase.setId(modelAccess.getCssID()); } else { componentBase.setId(getEditpart().getId()); } gridlayout = new GridLayout(modelAccess.getColumns(), 1); gridlayout.setSizeFull(); gridlayout.setSpacing(false); componentBase.addComponent(gridlayout); if (modelAccess.isMargin()) { gridlayout.addStyleName(IConstants.CSS_CLASS__MARGIN); gridlayout.setMargin(true); } if (modelAccess.isSpacing()) { gridlayout.setData(IConstants.CSS_CLASS__SPACING); gridlayout.setSpacing(true); } if (modelAccess.isCssClassValid()) { gridlayout.addStyleName(modelAccess.getCssClass()); } else { gridlayout.addStyleName(CSS_CLASS__CONTROL); } renderChildren(false); } return componentBase; }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorOptions.java
License:Open Source License
/** * Creates the complete options component. * It's a grid with two rows and two columns, styled like: * * || * [language switch] [mode switch] File-Label || [file path display] * -------------------------------------------||---------------------------------- * New-Key-Label || [new key input] [add key button] * || * * NOTE: The second row is not filled with components on initialization, what means keys can not be added * Filling is done via {@link #updateShownOptions(boolean, boolean)} *///from w w w . ja v a 2s.com private void initOptionsComponent() { // create and layout the component m_optionsComponent = new GridLayout(2, 2); m_optionsComponent.setHideEmptyRowsAndColumns(true); m_optionsComponent.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); m_optionsComponent.setWidth("100%"); m_optionsComponent.setColumnExpandRatio(1, 1f); m_optionsComponent.setStyleName("v-options"); // add the components m_optionsComponent.addComponent(m_upperLeftComponent, 0, 0); Component upperRight = createUpperRightComponent(); m_optionsComponent.addComponent(upperRight, 1, 0); }
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./*ww w . ja v a 2 s .co m*/ * @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.topology.ssh.internal.AuthWindow.java
License:Open Source License
/** * This constructor method spawns a window to authorize the * username and password input by the user. If the authroization * is sucessful, the user will be connected to the host at the * given port through SSH, and the terminal emulator this window * will be replaced by a terminal emulator. * /* w w w .j a va2 s. c o m*/ * @param host - The host name to connect to * @param port - The port number to connect to */ public AuthWindow(String host, int port) { super("Login"); m_host = host; m_port = port; if ("".equals(m_host) || m_port == 0) { showOptions = true; } setCaption("Auth Window"); setModal(true); setWidth("260px"); setHeight("190px"); if (showOptions) setHeight("260px"); setResizable(false); Label hostLabel = new Label("Host: "); hostField = new TextField(); // hostField.setMaxLength(FIELD_BUFFER); Label portLabel = new Label("Port: "); portField = new TextField(); // portField.setMaxLength(FIELD_BUFFER); Label usernameLabel = new Label("Username: "); usernameField = new TextField(); // usernameField.setMaxLength(FIELD_BUFFER); Label passwordLabel = new Label("Password: "); passwordField = new PasswordField(); passwordField.setMaxLength(FIELD_BUFFER); final Button loginButton = new Button("Login"); loginButton.setClickShortcut(KeyCode.ENTER); client = SshClient.setUpDefaultClient(); client.start(); loginButton.addClickListener(this); GridLayout grid = new GridLayout(2, 2); if (showOptions) { grid = new GridLayout(2, 4); grid.addComponent(hostLabel); grid.addComponent(hostField); grid.addComponent(portLabel); grid.addComponent(portField); } grid.addComponent(usernameLabel); grid.addComponent(usernameField); grid.addComponent(passwordLabel); grid.addComponent(passwordField); grid.setSpacing(true); grid.setMargin(new MarginInfo(false, false, true, false)); VerticalLayout layout = new VerticalLayout(); layout.addComponent(grid); layout.addComponent(loginButton); layout.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT); setContent(layout); }
From source file:org.peergreen.vaadin.diagram.Toolbar.java
License:Open Source License
public Toolbar(int columns, final int rows) { super("Tools"); setModal(false);//ww w . jav a 2 s.c o m setClosable(false); setResizable(false); setDraggable(true); addStyleName("diagram-toolbar"); this.columns = columns; this.rows = rows; this.layout = new GridLayout(this.columns, 1); layout.setSizeFull(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); setContent(layout); setImageLength(IMAGE_LENGTH); }
From source file:org.primaldev.ppm.util.ChartTypeGenerator.java
License:Apache License
protected static Component createChart(JsonNode dataNode, String[] names, Number[] values) { String type = dataNode.get("type").textValue(); JsonNode xAxisNode = dataNode.get("xaxis"); String xAxis = null;/*from ww w . j a v a 2s . c om*/ if (xAxisNode != null) { xAxis = xAxisNode.textValue(); } JsonNode yAxisNode = dataNode.get("yaxis"); String yAxis = null; if (yAxisNode != null) { yAxis = yAxisNode.textValue(); } Component chart = null; if (CHART_TYPE_BAR_CHART.equals(type)) { DataSeries dataSeries = new DataSeries().add((Object[]) values); SeriesDefaults seriesDefaults = new SeriesDefaults().setRenderer(SeriesRenderers.BAR); Axes axes = new Axes().addAxis( new XYaxis().setRenderer(AxisRenderers.CATEGORY).setTicks(new Ticks().add((Object[]) names))); Highlighter highlighter = new Highlighter().setShow(false); Options options = new Options().setSeriesDefaults(seriesDefaults).setAxes(axes) .setHighlighter(highlighter); options.setAnimate(true); options.setAnimateReplot(true); chart = new DCharts().setDataSeries(dataSeries).setOptions(options); } else if (CHART_TYPE_PIE_CHART.equals(type)) { DataSeries dataSeries = new DataSeries().newSeries(); for (int i = 0; i < names.length; i++) { dataSeries.add(names[i], values[i]); } SeriesDefaults seriesDefaults = new SeriesDefaults().setRenderer(SeriesRenderers.PIE); Options options = new Options().setSeriesDefaults(seriesDefaults); options.setAnimate(true); options.setAnimateReplot(true); Legend legend = new Legend().setShow(true).setPlacement(LegendPlacements.INSIDE); options.setLegend(legend); Highlighter highlighter = new Highlighter().setShow(true); options.setHighlighter(highlighter); chart = new DCharts().setDataSeries(dataSeries).setOptions(options); } else if (CHART_TYPE_LINE_CHART.equals(type)) { AxesDefaults axesDefaults = new AxesDefaults().setLabelRenderer(LabelRenderers.CANVAS); Axes axes = new Axes() .addAxis(new XYaxis().setLabel(xAxis != null ? xAxis : "").setMin(names[0]) .setMax(names[values.length - 1]).setDrawMajorTickMarks(true)) .addAxis(new XYaxis(XYaxes.Y).setLabel(yAxis != null ? yAxis : "").setDrawMajorTickMarks(true)); Options options = new Options().setAxesDefaults(axesDefaults).setAxes(axes); DataSeries dataSeries = new DataSeries().newSeries(); for (int i = 0; i < names.length; i++) { // if (parseLong(names[i]) != null) { // dataSeries.add(parseLong(names[i]), values[i]); // } else if (parseDouble(names[i]) != null) { // dataSeries.add(parseDouble(names[i]), values[i]); // } else { // dataSeries.add(names[i], values[i]); // } dataSeries.add(names[i], values[i]); } Series series = new Series().addSeries(new XYseries().setShowLine(true).setMarkerOptions( new MarkerRenderer().setShadow(true).setSize(7).setStyle(MarkerStyles.CIRCLE))); options.setSeries(series); options.setAnimate(true); options.setAnimateReplot(true); Highlighter highlighter = new Highlighter().setShow(true); options.setHighlighter(highlighter); chart = new DCharts().setDataSeries(dataSeries).setOptions(options); } else if (CHART_TYPE_LIST.equals(type)) { GridLayout grid = new GridLayout(2, names.length); grid.setSpacing(true); for (int i = 0; i < names.length; i++) { String name = names[i]; Label nameLabel = new Label(name); nameLabel.addStyleName(Reindeer.LABEL_H2); grid.addComponent(nameLabel, 0, i); Number value = values[i]; Label valueLabel = new Label(value + ""); grid.addComponent(valueLabel, 1, i); } chart = grid; } if (chart instanceof DCharts) { // Needed, otherwise the chart will not be shown ((DCharts) chart).show(); } return chart; }