List of usage examples for com.vaadin.ui GridLayout GridLayout
public GridLayout(int columns, int rows)
From source file:org.activiti.explorer.ui.process.AbstractProcessDefinitionDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);//w w w .java2s .co m details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.PROCESS_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(getProcessDisplayName(processDefinition)); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Version String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION); propertiesLayout.addComponent(versionLabel); // Add deploy time PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_DEPLOY_TIME), deployment.getDeploymentTime(), null, true); deployTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_DEPLOY_TIME); propertiesLayout.addComponent(deployTimeLabel); }
From source file:org.activiti.explorer.ui.process.simple.editor.SimpleTableEditor.java
License:Apache License
@Override protected void initUi() { super.initUi(); setSizeFull();/* w w w .j a v a2 s.c om*/ grid.setColumnExpandRatio(0, 0f); // Hide the column on the left side mainLayout = new DetailPanel(); setDetailComponent(mainLayout); // Editor editorGrid = new GridLayout(2, 7); editorGrid.setSizeFull(); editorGrid.setMargin(true); editorGrid.setColumnExpandRatio(0, 1.0f); editorGrid.setColumnExpandRatio(1, 9.0f); editorGrid.setSpacing(true); mainLayout.addComponent(editorGrid); initNameField(editorGrid); initDescriptionField(editorGrid); initTaskTable(editorGrid); initButtons(editorGrid); toolBar.setActiveEntry(KEY_EDITOR); }
From source file:org.activiti.explorer.ui.profile.ProfilePanel.java
License:Apache License
protected void initContactSection() { Label header = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_CONTACT)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); GridLayout contactLayout = createInfoSectionLayout(2, 4); // Email//from w ww . j a v a 2s . com if (!editable && isDefined(user.getEmail())) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), user.getEmail()); } else if (editable) { emailField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), emailField, user.getEmail()); } // Phone if (!editable && isDefined(phone)) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phone); } else if (editable) { phoneField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phoneField, phone); } // Twitter if (!editable && isDefined(twitterName)) { Link twitterLink = new Link(twitterName, new ExternalResource("http://www.twitter.com/" + twitterName)); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterLink); } else if (editable) { twitterField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterField, twitterName); } // Skype if (!editable && isDefined(skypeId)) { // The skype entry shows the name + skype icon, laid out in a small grid GridLayout skypeLayout = new GridLayout(2, 1); skypeLayout.setSpacing(true); skypeLayout.setSizeUndefined(); Label skypeIdLabel = new Label(skypeId); skypeIdLabel.setSizeUndefined(); skypeLayout.addComponent(skypeIdLabel); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeLayout); } else if (editable) { skypeField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeField, skypeId); } }
From source file:org.activiti.explorer.ui.profile.ProfilePanel.java
License:Apache License
protected GridLayout createInfoSectionLayout(int columns, int rows) { GridLayout layout = new GridLayout(columns, rows); layout.setSpacing(true);//from www . j a v a 2s. c o m layout.setWidth(100, UNITS_PERCENTAGE); layout.setMargin(true, false, true, false); infoPanelLayout.addComponent(layout); return layout; }
From source file:org.activiti.explorer.ui.reports.ChartGenerator.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 w ww. ja 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(ExplorerLayout.STYLE_LABEL_BOLD); 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; }
From source file:org.activiti.explorer.ui.reports.ReportDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);//w w w. ja va 2 s . co m details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.REPORT_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(getReportDisplayName()); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Version String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION); propertiesLayout.addComponent(versionLabel); }
From source file:org.activiti.explorer.ui.reports.SavedReportDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);//from w w w.ja v a2s . c om details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.REPORT_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(SavedReportListItem.getReportDisplayName(historicProcessInstance)); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Created Time String createLabel = i18nManager.getMessage(Messages.REPORTING_CREATE_TIME, new HumanTime(i18nManager).format(historicProcessInstance.getEndTime())); Label versionLabel = new Label(createLabel); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME); propertiesLayout.addComponent(versionLabel); }
From source file:org.activiti.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(5, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);/*from w w w. j a v a2 s. com*/ taskDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.TASK_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(historicTask.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 4, 0); // Add due date PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT), historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false); dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE); taskDetails.addComponent(dueDateLabel, 1, 1); // Add priority Integer lowMedHighPriority = convertPriority(historicTask.getPriority()); Label priorityLabel = new Label(); switch (lowMedHighPriority) { case 1: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW); break; case 2: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM); break; case 3: default: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH); } taskDetails.addComponent(priorityLabel, 2, 1); // Add create date PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT), historicTask.getStartTime(), "", true); createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME); taskDetails.addComponent(createLabel, 3, 1); // Add label to fill excess space Label spacer = new Label(); spacer.setContentMode(Label.CONTENT_XHTML); spacer.setValue(" "); spacer.setSizeUndefined(); taskDetails.addComponent(spacer); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); taskDetails.setColumnExpandRatio(3, 1.0f); taskDetails.setColumnExpandRatio(4, 1.0f); centralLayout.addComponent(taskDetails); }
From source file:org.activiti.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(2, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);/* w w w . j a v a2 s. c o m*/ taskDetails.setMargin(false, false, true, false); taskDetails.setColumnExpandRatio(1, 1.0f); centralLayout.addComponent(taskDetails); // Add image Embedded image = new Embedded(null, Images.TASK_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(task.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0); taskDetails.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); taskDetails.addComponent(propertiesLayout); propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService)); propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService)); initCreateTime(propertiesLayout); }
From source file:org.activiti.kickstart.ui.panel.KickstartWorkflowPanel.java
License:Apache License
protected void initUi() { initTitle();// w w w . j a v a 2 s . c o m GridLayout layout = new GridLayout(2, 7); layout.setSizeFull(); layout.setColumnExpandRatio(0, 1.0f); layout.setColumnExpandRatio(1, 9.0f); layout.setSpacing(true); addComponent(layout); initNameField(layout); initDescriptionField(layout); initTaskTable(layout); initButtons(layout); }