List of usage examples for com.vaadin.ui GridLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java
License:Apache License
protected void addDeploymentName() { GridLayout taskDetails = new GridLayout(3, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true); taskDetails.setMargin(false, false, true, false); // Add image/* www.j a va 2 s . c o m*/ Embedded image = new Embedded(null, Images.DEPLOYMENT_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add deployment name Label nameLabel = new Label(); if (deployment.getName() != null) { nameLabel.setValue(deployment.getName()); } else { nameLabel.setValue(i18nManager.getMessage(Messages.DEPLOYMENT_NO_NAME)); } nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 2, 0); // Add deploy time PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel( i18nManager.getMessage(Messages.DEPLOYMENT_DEPLOY_TIME), deployment.getDeploymentTime(), null, true); deployTimeLabel.addStyleName(ExplorerLayout.STYLE_DEPLOYMENT_HEADER_DEPLOY_TIME); taskDetails.addComponent(deployTimeLabel, 1, 1); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); addDetailComponent(taskDetails); }
From source file:org.activiti.explorer.ui.management.identity.UserDetailPanel.java
License:Apache License
protected void loadUserDetails() { // Grid of details GridLayout detailGrid = new GridLayout(); detailGrid.setColumns(2);//www .j ava 2s .c o m detailGrid.setSpacing(true); detailGrid.setMargin(true, true, false, true); userDetailsLayout.addComponent(detailGrid); // Details addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_ID), new Label(user.getId())); // details are non-editable if (!editingDetails) { addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), new Label(user.getFirstName())); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), new Label(user.getLastName())); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), new Label(user.getEmail())); } else { firstNameField = new TextField(null, user.getFirstName() != null ? user.getFirstName() : ""); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), firstNameField); firstNameField.focus(); lastNameField = new TextField(null, user.getLastName() != null ? user.getLastName() : ""); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), lastNameField); emailField = new TextField(null, user.getEmail() != null ? user.getEmail() : ""); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), emailField); passwordField = new PasswordField(); Label cautionLabel = new Label(i18nManager.getMessage(Messages.USER_RESET_PASSWORD)); cautionLabel.addStyleName(Reindeer.LABEL_SMALL); HorizontalLayout passwordLayout = new HorizontalLayout(); passwordLayout.setSpacing(true); passwordLayout.addComponent(passwordField); passwordLayout.addComponent(cautionLabel); passwordLayout.setComponentAlignment(cautionLabel, Alignment.MIDDLE_LEFT); addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_PASSWORD), passwordLayout); } }
From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java
License:Apache License
protected void addHeader() { GridLayout jobDetails = new GridLayout(3, 2); jobDetails.setWidth(100, UNITS_PERCENTAGE); jobDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); jobDetails.setSpacing(true); jobDetails.setMargin(false, false, true, false); // Add image//from ww w . ja va 2s. co m Embedded image = new Embedded(null, Images.JOB_50); jobDetails.addComponent(image, 0, 0, 0, 1); // Add job name Label nameLabel = new Label(getJobLabel(job)); nameLabel.addStyleName(Reindeer.LABEL_H2); jobDetails.addComponent(nameLabel, 1, 0, 2, 0); // Add due date PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.JOB_DUEDATE), job.getDuedate(), i18nManager.getMessage(Messages.JOB_NO_DUEDATE), false); dueDateLabel.addStyleName(ExplorerLayout.STYLE_JOB_HEADER_DUE_DATE); jobDetails.addComponent(dueDateLabel, 1, 1); jobDetails.setColumnExpandRatio(1, 1.0f); jobDetails.setColumnExpandRatio(2, 1.0f); addDetailComponent(jobDetails); }
From source file:org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel.java
License:Apache License
protected void addHeader() { GridLayout header = new GridLayout(3, 2); header.setWidth(100, UNITS_PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); header.setSpacing(true); header.setMargin(false, false, true, false); // Add image//ww w.j av a2 s . co m Embedded image = new Embedded(null, Images.PROCESS_50); header.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance)); nameLabel.addStyleName(Reindeer.LABEL_H2); header.addComponent(nameLabel, 1, 0, 2, 0); // Add start time PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_START_TIME), historicProcessInstance.getStartTime(), null, true); startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME); header.addComponent(startTimeLabel, 1, 1); header.setColumnExpandRatio(1, 1.0f); header.setColumnExpandRatio(2, 1.0f); panelLayout.addComponent(header); }
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); details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image// w ww .ja v a 2s.c o m 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.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/* ww w. j a v a2 s . c o m*/ 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); 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 .j a va2 s .co m 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); details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image// w w w . j a v a2 s.c o m 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); details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image/*from w ww. j a v a 2 s . co m*/ 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); }