Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_CENTER.

Prototype

Alignment MIDDLE_CENTER

To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.

Click Source Link

Usage

From source file:com.peergreen.webconsole.scope.deployment.internal.DeploymentScope.java

License:Open Source License

@PostConstruct
public void init() {
    deploymentViewManager = createDeploymentViewManager();

    OptionGroup option = new OptionGroup();
    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setWidth("100%");
    toolBar.setSpacing(true);//  w ww  .ja va2s  . com
    toolBar.setMargin(true);

    VerticalLayout uploadLayout = new VerticalLayout();

    Upload uploader = new Upload("Upload a file here", null);
    uploader.setButtonCaption("Upload");
    final FileUploader fileUploader = new FileUploader(deploymentViewManager, notifierService, artifactBuilder,
            option);
    uploader.setReceiver(fileUploader);
    uploader.addSucceededListener(fileUploader);
    uploader.addStartedListener(fileUploader);
    uploadLayout.addComponent(uploader);

    HorizontalLayout target = new HorizontalLayout();
    option.addContainerProperty("id", String.class, null);
    option.setItemCaptionPropertyId("id");
    option.addItem(DeployableContainerType.DEPLOYABLE.attribute()).getItemProperty("id")
            .setValue("Add to deployables");
    option.addItem(DeployableContainerType.DEPLOYED.attribute()).getItemProperty("id").setValue("Deploy");
    option.addItem(DeployableContainerType.DEPLOYMENT_PLAN.attribute()).getItemProperty("id")
            .setValue("Create a deployment plan");
    option.addStyleName("horizontal");
    option.select(DeployableContainerType.DEPLOYABLE.attribute());

    target.addComponent(option);
    uploadLayout.addComponent(target);
    toolBar.addComponent(uploadLayout);

    Label infoLabel = new Label("Drop files here to create a deployment plan");
    infoLabel.setSizeUndefined();
    final VerticalLayout deploymentPlanMaker = new VerticalLayout(infoLabel);
    deploymentPlanMaker.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);
    Button draft = new Button("A draft is under construction");
    draft.addStyleName("link");
    draft.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            deploymentViewManager.showDeploymentPlanView();
        }
    });
    draft.setVisible(false);
    deploymentViewManager.setDeploymentPlanDraftViewer(draft);
    deploymentPlanMaker.addComponent(draft);
    deploymentPlanMaker.setComponentAlignment(draft, Alignment.TOP_CENTER);
    deploymentPlanMaker.setSizeFull();
    deploymentPlanMaker.addStyleName("drop-area");
    deploymentPlanMakerWrapper = new DragAndDropWrapper(deploymentPlanMaker);
    deploymentPlanMakerWrapper.setSizeFull();
    toolBar.addComponent(deploymentPlanMakerWrapper);
    addComponent(toolBar);

    addComponent(framesContainer);
    setExpandRatio(framesContainer, 1.5f);

    helpWindow = notifierService.createHelpOverlay("Deployment module",
            "<p>To deploy, or undeploy, artifacts, you can drag and drop elements from deployables panel "
                    + "to deployed panel and vice versa.</p>"
                    + "<p>You can also drag files from desktop and drop them where you want to add them.");
}

From source file:com.philippefichet.vaadincdipush.view.FirstView.java

@PostConstruct
public void init() {
    setHeight("100%");
    loginLayout = new HorizontalLayout();
    Label loginLabel = new Label("Login");
    loginChoose = new TextField();
    attach = new Button("Connect");
    attach.addClickListener((Button.ClickEvent event) -> {
        if (chat.loginFree(loginChoose.getValue())) {
            if (login == null) {
                login = loginChoose.getValue();
                chat.getUsernameConnected().forEach((l) -> {
                    newUser(l);/*from  ww w  .j av a  2 s . com*/
                });
                chat.attach(this);
            } else {
                chat.rename(loginChoose.getValue(), this);
                login = loginChoose.getValue();
            }
            attach.setStyleName(ValoTheme.BUTTON_FRIENDLY);
            Notification.show("Login \"" + loginChoose.getValue() + "\" valid.", null,
                    Notification.Type.HUMANIZED_MESSAGE);

            messagePanel.setVisible(true);
            sendLayout.setVisible(true);

        } else {
            Notification.show("Login \"" + loginChoose.getValue() + "\" already exist.", null,
                    Notification.Type.ERROR_MESSAGE);
        }
    });

    chatMessage.setWidth("100%");
    sendLayout.setWidth("100%");
    sendMessage.setWidthUndefined();
    sendLayout.addComponent(chatMessage);
    sendLayout.addComponent(sendMessage);
    sendLayout.setExpandRatio(chatMessage, 100);
    sendMessage.addClickListener((event) -> {
        chat.sendMessage(this, chatMessage.getValue());
        chatMessage.setValue("");
    });

    Button next = new Button("next");
    next.addClickListener((eventClick) -> {
        getUI().getNavigator().navigateTo("next");
    });

    loginLayout.addComponent(loginLabel);
    loginLayout.addComponent(loginChoose);
    loginLayout.addComponent(attach);
    loginLayout.setComponentAlignment(loginLabel, Alignment.MIDDLE_RIGHT);
    loginLayout.setComponentAlignment(loginChoose, Alignment.MIDDLE_CENTER);
    loginLayout.setComponentAlignment(attach, Alignment.MIDDLE_LEFT);

    loginLayout.setWidth("100%");
    loginLabel.setWidthUndefined();
    loginChoose.setWidth("100%");
    attach.setWidthUndefined();
    messagePanel.setHeight("100%");
    listUserPanel.setStyleName(ValoTheme.PANEL_WELL);
    listUserPanel.setContent(listUserLayout);
    listUserPanel.setHeight("100%");
    centerLayout.setHeight("100%");
    centerLayout.addComponent(listUserPanel);
    centerLayout.addComponent(messageLayout);
    centerLayout.setExpandRatio(messageLayout, 100);
    messagePanel.setContent(centerLayout);
    addComponent(loginLayout);
    addComponent(messagePanel);
    addComponent(sendLayout);

    messagePanel.setVisible(false);
    sendLayout.setVisible(false);

    setExpandRatio(messagePanel, 100);
}

From source file:com.philippefichet.vaadincdipush.view.FirstView.java

public void newUser(String login) {
    Label user = new Label(login);
    listUserLayout.addComponent(user);//  w ww .  jav  a2 s  .  c  om
    listUserLayout.setComponentAlignment(user, Alignment.MIDDLE_CENTER);
}

From source file:com.rdonasco.security.home.views.LoggedOutContentView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    addComponent(logonForm);/*from  ww w.  j  av  a  2 s.  co m*/
    setComponentAlignment(logonForm, Alignment.MIDDLE_CENTER);
    setMargin(true, true, true, true);
    setSpacing(true);
    logonForm.setSizeUndefined();
    setSizeFull();
}

From source file:com.salsaw.msalsa.PhylogeneticTreeView.java

License:Apache License

public PhylogeneticTreeView(ClustalFileMapper clustalFileMapper) throws IOException {
    initializeUiComponents();/*from   w w w  . ja  va 2 s .co m*/

    // Download alignment file
    Button aligmentButton = new Button("Download alignment");
    Resource resAlignment = new FileResource(new File(clustalFileMapper.getAlignmentFilePath()));
    FileDownloader fdAln = new FileDownloader(resAlignment);
    fdAln.extend(aligmentButton);
    mainLayout.addComponent(aligmentButton);
    mainLayout.setComponentAlignment(aligmentButton, Alignment.MIDDLE_CENTER);

    // Download tree file
    Button downloadTreeButton = new Button("Download phylogentic tree");
    Resource resTree = new FileResource(new File(clustalFileMapper.getTreeFilePath()));
    FileDownloader fdTree = new FileDownloader(resTree);
    fdTree.extend(downloadTreeButton);
    mainLayout.addComponent(downloadTreeButton);
    mainLayout.setComponentAlignment(downloadTreeButton, Alignment.MIDDLE_CENTER);

    // Add and center with HTML div
    svgHTMLPhylogenticTree = new Label("<div id='svgCanvas'></div>", ContentMode.HTML);
    svgHTMLPhylogenticTree.setWidth("-1px");
    svgHTMLPhylogenticTree.setHeight("-1px");
    mainLayout.addComponent(svgHTMLPhylogenticTree);
    mainLayout.setComponentAlignment(svgHTMLPhylogenticTree, Alignment.MIDDLE_CENTER);

    // Add tab with aligment content
    String aligmentFileContent = new String(
            Files.readAllBytes(Paths.get(clustalFileMapper.getAlignmentFilePath())));
    TextArea aligmentFileTextArea = new TextArea("M-SALSA Aligment");
    aligmentFileTextArea.setWordwrap(false);
    aligmentFileTextArea.setValue(aligmentFileContent);
    aligmentFileTextArea.setWidth("100%");
    aligmentFileTextArea.setHeight("100%");
    mainLayout.addComponent(aligmentFileTextArea);
    mainLayout.setComponentAlignment(aligmentFileTextArea, Alignment.MIDDLE_CENTER);

    // Add JavaScript component to generate phylogentic tree
    JsPhyloSVG jsPhyloSVG = new JsPhyloSVG(getPhylogeneticTreeFileContent(clustalFileMapper));
    mainLayout.addComponent(jsPhyloSVG);

    setCompositionRoot(mainLayout);
}

From source file:com.salsaw.msalsa.PhylogeneticTreeView.java

License:Apache License

private GridLayout initializeUiComponents() {
    mainLayout = new GridLayout();
    mainLayout.setImmediate(false);/*from   w ww.j  ava 2  s  .c o  m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // title
    title = new Label();
    title.setImmediate(false);
    title.setWidth("-1px");
    title.setHeight("-1px");
    title.setValue("M-SALSA");
    mainLayout.addComponent(title);
    mainLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);

    return mainLayout;
}

From source file:com.save.employee.request.RequestFormWindow.java

Component buildRequestForm() {
    GridLayout glayout = new GridLayout(4, 7);
    glayout.setSizeFull();//from ww w  . ja v  a  2 s .com
    glayout.setSpacing(true);
    glayout.setMargin(true);

    controlNo = new TextField("Control No.");
    controlNo.setWidth("100%");
    controlNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    glayout.addComponent(controlNo, 0, 0);

    dateOfActivity = new DateField("Date of Activity: ");
    dateOfActivity.setWidth("100%");
    dateOfActivity.addStyleName(ValoTheme.DATEFIELD_SMALL);
    glayout.addComponent(dateOfActivity, 1, 0);

    area = CommonComboBox.areas();
    area.setWidth("100%");
    glayout.addComponent(area, 2, 0);

    activity = new TextField("Activity: ");
    activity.setWidth("100%");
    activity.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    glayout.addComponent(activity, 0, 1, 1, 1);

    venue = new TextField("Venue: ");
    venue.setWidth("100%");
    venue.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    glayout.addComponent(venue, 0, 2, 1, 2);

    requirements = new TextArea("Requirements: ");
    requirements.setWidth("100%");
    requirements.addStyleName(ValoTheme.TEXTAREA_SMALL);
    glayout.addComponent(requirements, 2, 1, 3, 2);

    Label lodging = new Label("Lodging: ");
    lodging.setWidthUndefined();
    glayout.addComponent(lodging, 0, 3);
    glayout.setComponentAlignment(lodging, Alignment.MIDDLE_CENTER);

    lodgingPax = new TextField("Pax: ");
    lodgingPax.setWidth("100%");
    lodgingPax.setValue("0");
    lodgingPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    lodgingPax.addStyleName("align-right");
    glayout.addComponent(lodgingPax, 1, 3);

    lodgingAmount = new TextField("Amount: ");
    lodgingAmount.setWidth("100%");
    lodgingAmount.setValue("0.00");
    lodgingAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    lodgingAmount.addStyleName("align-right");
    lodgingAmount.setEnabled(false);
    lodgingAmount.setImmediate(true);
    glayout.addComponent(lodgingAmount, 3, 3);

    lodgingBudget = new TextField("Budget: ");
    lodgingBudget.setWidth("100%");
    lodgingBudget.setValue("0.00");
    lodgingBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    lodgingBudget.addStyleName("align-right");
    lodgingBudget.addValueChangeListener((ValueChangeEvent event) -> {
        if (!CommonUtilities.checkInputIfInteger(lodgingPax.getValue().trim())) {
            Notification.show("Enter a numeric value for Pax", Notification.Type.ERROR_MESSAGE);
            return;
        }

        if (!CommonUtilities.checkInputIfDouble(lodgingBudget.getValue().trim())) {
            Notification.show("Enter a numeric value for Budget", Notification.Type.ERROR_MESSAGE);
            return;
        }

        lodgingAmount.setValue(String.valueOf(CommonUtilities.convertStringToInt(lodgingPax.getValue().trim())
                * CommonUtilities.convertStringToDouble(lodgingBudget.getValue().trim())));
    });
    lodgingBudget.setImmediate(true);
    glayout.addComponent(lodgingBudget, 2, 3);

    Label meals = new Label("Meals: ");
    meals.setWidthUndefined();
    glayout.addComponent(meals, 0, 4);
    glayout.setComponentAlignment(meals, Alignment.MIDDLE_CENTER);

    mealsPax = new TextField("Pax: ");
    mealsPax.setWidth("100%");
    mealsPax.setValue("0");
    mealsPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    mealsPax.addStyleName("align-right");
    glayout.addComponent(mealsPax, 1, 4);

    mealsAmount = new TextField("Amount: ");
    mealsAmount.setWidth("100%");
    mealsAmount.setValue("0.00");
    mealsAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    mealsAmount.addStyleName("align-right");
    mealsAmount.setEnabled(false);
    mealsAmount.setImmediate(liquidated);
    glayout.addComponent(mealsAmount, 3, 4);

    mealsBudget = new TextField("Budget: ");
    mealsBudget.setWidth("100%");
    mealsBudget.setValue("0.00");
    mealsBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    mealsBudget.addStyleName("align-right");
    mealsBudget.addValueChangeListener((ValueChangeEvent event) -> {
        if (!CommonUtilities.checkInputIfInteger(mealsPax.getValue().trim())) {
            Notification.show("Enter a numeric value for Pax", Notification.Type.ERROR_MESSAGE);
            return;
        }

        if (!CommonUtilities.checkInputIfDouble(mealsBudget.getValue().trim())) {
            Notification.show("Enter a numeric value for Budget", Notification.Type.ERROR_MESSAGE);
            return;
        }

        mealsAmount.setValue(String.valueOf(CommonUtilities.convertStringToInt(mealsPax.getValue().trim())
                * CommonUtilities.convertStringToDouble(mealsBudget.getValue().trim())));
    });
    mealsAmount.setImmediate(true);
    glayout.addComponent(mealsBudget, 2, 4);

    others = new TextArea("Others: ");
    others.setWidth("100%");
    others.setRows(3);
    others.addStyleName(ValoTheme.TEXTAREA_SMALL);
    glayout.addComponent(others, 0, 5, 2, 6);

    othersAmount = new TextField("Amount: ");
    othersAmount.setWidth("100%");
    othersAmount.setValue("0.00");
    othersAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    othersAmount.addStyleName("align-right");
    glayout.addComponent(othersAmount, 3, 5);
    glayout.setComponentAlignment(othersAmount, Alignment.TOP_CENTER);

    Button rlButton = new Button();
    rlButton.setCaption("SAVE");
    rlButton.setWidth("100%");
    rlButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    rlButton.addStyleName(ValoTheme.BUTTON_SMALL);
    rlButton.addClickListener(buttonClickListener);
    glayout.addComponent(rlButton, 3, 6);
    glayout.setComponentAlignment(rlButton, Alignment.TOP_CENTER);

    if (getRequestId() != 0) {
        LiquidationForm lf = rls.getRLById(getRequestId());
        controlNo.setValue(String.valueOf(lf.getControlNo()));
        dateOfActivity.setValue(lf.getDateOfActivity());
        area.setValue(lf.getAreaId());
        activity.setValue(lf.getActivity());
        requirements.setValue(lf.getRequirements());
        venue.setValue(lf.getVenue());
        others.setValue(lf.getOthersRemarks());
        othersAmount.setValue(String.valueOf(lf.getOthersAmount()));
        lodgingAmount.setValue(String.valueOf(lf.getLodgingAmount()));
        mealsAmount.setValue(String.valueOf(lf.getMealsAmount()));
        if (getLiquidated() == true) {
            setCaption("LIQUIDATE FROM");
            rlButton.setCaption("LIQUIDATE");
            controlNo.setReadOnly(liquidated);
            dateOfActivity.setReadOnly(liquidated);
            area.setReadOnly(liquidated);
            activity.setReadOnly(liquidated);
            requirements.setReadOnly(liquidated);
            venue.setReadOnly(liquidated);
        } else {
            rlButton.setCaption("EDIT");
            lodgingPax.setValue(String.valueOf(lf.getLodgingPax()));
            lodgingBudget.setValue(String.valueOf(lf.getLodgingBudget()));
            mealsPax.setValue(String.valueOf(lf.getMealsPax()));
            mealsBudget.setValue(String.valueOf(lf.getMealsBudget()));
            rlButton.setEnabled(rls.getRLById(getRequestId()).getLiquidated() == 0);
        }
        //            delete.setVisible(true);
    }

    return glayout;
}

From source file:com.skysql.manager.ui.AboutSettings.java

License:Open Source License

/**
 * Reads the AboutRecord from the session and populates the panel layout.
 *///from  w ww.  j av  a 2  s.c  o  m
AboutSettings(boolean extraInfo) {
    addStyleName("aboutTab");
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    Label title = new Label("<h3>Welcome to MariaDB Manager<h3/>", ContentMode.HTML);
    title.setSizeUndefined();
    addComponent(title);
    setComponentAlignment(title, Alignment.MIDDLE_CENTER);

    StringBuffer str = new StringBuffer();
    str.append("<table border=0 cellspacing=3 cellpadding=3 summary=\"\">" + "<tr bgcolor=\"#ccccff\">"
            + "<th align=left>Component" + "<th align=left>Release");
    if (extraInfo) {
        str.append("<th align=left>Version" + "<th align=left>Date");
    }
    LinkedHashMap<String, Versions> versionsList = Versions.getVersionsList();
    int i = 0;
    for (Versions component : versionsList.values()) {
        str.append(((i++ & 1) == 0) ? "<tr>" : "<tr bgcolor=\"#eeeeff\">");
        str.append("<td><code>" + component.getName() + "</code><td>" + component.getRelease());
        if (extraInfo) {
            str.append("<td>" + component.getVersion());
            str.append("<td>" + (component.getDate() == null ? " " : component.getDate()));
        }
    }
    str.append("</table>");
    ManagerUI.log(str.toString());
    Label versionsLabel = new Label(str.toString(), ContentMode.HTML);
    versionsLabel.setSizeUndefined();
    addComponent(versionsLabel);
    setComponentAlignment(versionsLabel, Alignment.MIDDLE_CENTER);

    if (extraInfo) {
        Label guiInfo = new Label("WebUI calling API " + APIrestful.apiVERSION + " @ " + APIrestful.getURI());
        guiInfo.setSizeUndefined();
        addComponent(guiInfo);
        setComponentAlignment(guiInfo, Alignment.MIDDLE_CENTER);
    }

    addComponent(new Label(""));
    addComponent(new Label(""));

    Label copyright = new Label("\u00A9 SkySQL Corporation Ab, 2014.");
    copyright.setSizeUndefined();
    addComponent(copyright);
    setComponentAlignment(copyright, Alignment.MIDDLE_CENTER);

    Link link = new Link("MariaDB is a trademark of SkySQL Corporation Ab.",
            new ExternalResource("http://www.mariadb.com/about/legal/trademarks"));
    link.setTargetName("_blank");
    addComponent(link);
    setComponentAlignment(link, Alignment.MIDDLE_CENTER);

}

From source file:com.skysql.manager.ui.CalendarDialog.java

License:Open Source License

/**
 * Inits the layout content./*from  ww w.  j  ava 2s . c o m*/
 */
private void initLayoutContent() {
    initNavigationButtons();
    initAddNewEventButton();
    initHideWeekEndButton();
    //initAllScheduleButton();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);
    hl.setMargin(new MarginInfo(false, false, true, false));
    hl.addComponent(prevButton);
    hl.addComponent(captionLabel);
    hl.addComponent(monthButton);
    hl.addComponent(weekButton);
    hl.addComponent(nextButton);
    hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
    hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);

    monthButton.setVisible(viewMode == Mode.WEEK);
    weekButton.setVisible(viewMode == Mode.DAY);

    HorizontalLayout controlPanel = new HorizontalLayout();
    controlPanel.setSpacing(true);
    controlPanel.setMargin(new MarginInfo(false, false, true, false));
    controlPanel.setWidth("100%");
    //controlPanel.addComponent(localeSelect);
    //controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);
    controlPanel.addComponent(timeZoneSelect);
    controlPanel.setComponentAlignment(timeZoneSelect, Alignment.MIDDLE_LEFT);
    //controlPanel.addComponent(formatSelect);
    //controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT);
    controlPanel.addComponent(addNewEvent);
    controlPanel.setComponentAlignment(addNewEvent, Alignment.BOTTOM_LEFT);
    controlPanel.addComponent(hideWeekendsButton);
    controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.BOTTOM_LEFT);
    //controlPanel.addComponent(allScheduleButton);
    //controlPanel.setComponentAlignment(allScheduleButton, Alignment.MIDDLE_LEFT);

    VerticalLayout layout = (VerticalLayout) dialogWindow.getContent();
    layout.addComponent(controlPanel);
    layout.addComponent(hl);
    layout.addComponent(calendarComponent);
    layout.setExpandRatio(calendarComponent, 1);
}

From source file:com.skysql.manager.ui.ChartPreviewLayout.java

License:Open Source License

/**
 * Instantiates a new chart preview layout.
 *
 * @param userChart the user chart/* w w  w .j av a2  s.c o  m*/
 * @param time the time
 * @param interval the interval
 */
public ChartPreviewLayout(final UserChart userChart, String time, String interval) {
    this.userChart = userChart;
    this.time = time;
    this.interval = interval;

    addStyleName("ChartPreviewLayout");
    setSpacing(true);
    setMargin(true);

    HorizontalLayout formDescription = new HorizontalLayout();
    formDescription.setSpacing(true);

    Embedded info = new Embedded(null, new ThemeResource("img/info.png"));
    info.addStyleName("infoButton");
    String infoText = "<table border=0 cellspacing=3 cellpadding=0 summary=\"\">\n"
            + "     <tr bgcolor=\"#ccccff\">" + "         <th align=left>Field"
            + "         <th align=left>Description" + "     <tr>" + "         <td><code>Title</code>"
            + "         <td>Name of the Chart" + "     <tr bgcolor=\"#eeeeff\">"
            + "         <td><code>Description</code>" + "         <td>Description of the Chart " + "     <tr>"
            + "         <td nowrap><code>Measurement Unit</code>"
            + "         <td>Unit of measurement for the data returned by the monitor, used as caption for the vertical axis of the chart"
            + "     <tr bgcolor=\"#eeeeff\">" + "         <td><code>Type</code>"
            + "         <td>Chart type (LineChart, AreaChart)" + "     <tr>"
            + "         <td><code>Points</code>" + "         <td>Number of data points displayed";
    infoText += " </table>" + " </blockquote>";
    info.setDescription(infoText);
    formDescription.addComponent(info);

    final Label monitorsLabel = new Label("Display as Chart");
    monitorsLabel.setStyleName("dialogLabel");
    formDescription.addComponent(monitorsLabel);
    formDescription.setComponentAlignment(monitorsLabel, Alignment.MIDDLE_LEFT);

    addComponent(formDescription);
    setComponentAlignment(formDescription, Alignment.TOP_CENTER);

    HorizontalLayout chartInfo = new HorizontalLayout();
    chartInfo.setSpacing(true);
    addComponent(chartInfo);
    setComponentAlignment(chartInfo, Alignment.MIDDLE_CENTER);

    FormLayout formLayout = new FormLayout();
    chartInfo.addComponent(formLayout);

    chartName = new TextField("Title");
    chartName.setImmediate(true);
    formLayout.addComponent(chartName);

    chartDescription = new TextField("Description");
    chartDescription.setWidth("25em");
    chartDescription.setImmediate(true);
    formLayout.addComponent(chartDescription);

    chartUnit = new TextField("Measurement Unit");
    chartUnit.setImmediate(true);
    formLayout.addComponent(chartUnit);

    chartSelectType = new NativeSelect("Type");
    chartSelectType.setImmediate(true);
    for (UserChart.ChartType type : UserChart.ChartType.values()) {
        chartSelectType.addItem(type.name());
    }
    chartSelectType.setNullSelectionAllowed(false);
    formLayout.addComponent(chartSelectType);

    selectCount = new NativeSelect("Points");
    selectCount.setImmediate(true);
    for (int points : UserChart.chartPoints()) {
        selectCount.addItem(points);
        selectCount.setItemCaption(points, String.valueOf(points));
    }
    selectCount.setNullSelectionAllowed(false);
    formLayout.addComponent(selectCount);

    updateChartInfo(userChart.getName(), userChart.getDescription(), userChart.getUnit(), userChart.getType(),
            userChart.getPoints());

    chartName.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {

            String chartName = (String) (event.getProperty()).getValue();
            userChart.setName(chartName);
            refreshChart();

        }
    });

    chartDescription.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {

            String value = (String) (event.getProperty()).getValue();
            userChart.setDescription(value);
            refreshChart();

        }
    });

    chartUnit.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {

            String value = (String) (event.getProperty()).getValue();
            userChart.setUnit(value);
            refreshChart();

        }
    });

    chartSelectType.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {

            String value = (String) (event.getProperty()).getValue();
            userChart.setType(value);
            refreshChart();

        }
    });

    selectCount.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {

            int points = (Integer) (event.getProperty()).getValue();
            userChart.setPoints(points);
            refreshChart();

        }
    });

    chartLayout = drawChart();
    addComponent(chartLayout);

}