Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

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

Introduction

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

Prototype

Alignment MIDDLE_LEFT

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

Click Source Link

Usage

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

License:Open Source License

/**
 * Instantiates a new chart preview layout.
 *
 * @param userChart the user chart//from w  w w  . jav a 2s.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);

}

From source file:com.skysql.manager.ui.components.BackupScheduledLayout.java

License:Open Source License

/**
 * Instantiates a new backup scheduled layout.
 *///from w ww  . j  a va 2s  . c om
public BackupScheduledLayout() {

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

    HorizontalLayout scheduleRow = new HorizontalLayout();
    scheduleRow.setSpacing(true);
    addComponent(scheduleRow);

    final Label scheduleLabel = new Label("Schedule backups using the");
    scheduleLabel.setSizeUndefined();
    scheduleRow.addComponent(scheduleLabel);
    scheduleRow.setComponentAlignment(scheduleLabel, Alignment.MIDDLE_LEFT);

    calendarButton = new Button("Calendar");
    calendarButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(Button.ClickEvent event) {
            if (schedule == null) {
                schedule = getSchedule();
            }
            new CalendarDialog(schedule, thisLayout);
        }
    });
    scheduleRow.addComponent(calendarButton);
    scheduleRow.setComponentAlignment(calendarButton, Alignment.MIDDLE_LEFT);

    final Label immediateLabel = new Label(
            "(To run an immediate backup, select a node first then switch to the Control panel)");
    immediateLabel.setSizeUndefined();
    scheduleRow.addComponent(immediateLabel);
    scheduleRow.setComponentAlignment(immediateLabel, Alignment.MIDDLE_CENTER);

    scheduledTable = new Table("Next Scheduled Backups");
    scheduledTable.setPageLength(5);
    // Start time, node
    scheduledTable.addContainerProperty("Start", String.class, null);
    scheduledTable.addContainerProperty("Node", String.class, null);
    scheduledTable.addContainerProperty("Level", String.class, null);
    scheduledTable.addContainerProperty("User", String.class, null);
    addComponent(scheduledTable);
    setComponentAlignment(scheduledTable, Alignment.MIDDLE_LEFT);

}

From source file:com.skysql.manager.ui.components.ComponentButton.java

License:Open Source License

/**
 * Instantiates a new component button./*from w  ww.j a  va  2 s.  c  om*/
 *
 * @param componentInfo the component info
 */
public ComponentButton(ClusterComponent componentInfo) {
    thisButton = this;
    this.componentInfo = componentInfo;

    addStyleName("componentButton");

    componentInfo.setButton(this);
    setData(componentInfo);

    setHeight(COMPONENT_HEIGHT + 4, Unit.PIXELS);
    float componentWidth = (componentInfo.getType() == ClusterComponent.CCType.system) ? SYSTEM_WIDTH
            : NODE_WIDTH;
    setWidth(componentWidth + 8, Unit.PIXELS);

    imageLayout = new VerticalLayout();
    imageLayout.setHeight(COMPONENT_HEIGHT + 4, Unit.PIXELS);
    imageLayout.setWidth(componentWidth, Unit.PIXELS);
    //imageLayout.setMargin(new MarginInfo(true, true, false, true));
    imageLayout.setImmediate(true);

    if (componentInfo.getParentID() != null) {
        String icon = null;
        switch (componentInfo.getType()) {
        case system:
            icon = "system";
            break;

        case node:
            icon = NodeStates.getNodeIcon(componentInfo.getSystemType(), componentInfo.getState());
            break;

        default:
            // unknown component type
            break;
        }
        imageLayout.addStyleName(icon);
        //imageLayout.addStyleName(componentInfo.getType().toString());

        commandLabel = new Label();
        commandLabel.setSizeUndefined();
        imageLayout.addComponent(commandLabel);
        imageLayout.setComponentAlignment(commandLabel, Alignment.TOP_LEFT);
        //imageLayout.setExpandRatio(commandLabel, 1.0f);
        //            NodeInfo nodeInfo = (NodeInfo) componentInfo;
        //            TaskRecord taskRecord = nodeInfo.getTask();
        //            setCommandLabel(taskRecord);

        Label padding = new Label("");
        imageLayout.addComponent(padding);
        imageLayout.setComponentAlignment(padding, Alignment.MIDDLE_CENTER);

        HorizontalLayout iconsStrip = new HorizontalLayout();
        iconsStrip.addStyleName("componentInfo");
        iconsStrip.setWidth(componentInfo.getType() == ClusterComponent.CCType.node ? "60px" : "76px");
        imageLayout.addComponent(iconsStrip);
        imageLayout.setComponentAlignment(iconsStrip, Alignment.MIDDLE_CENTER);

        info = new Embedded(null, new ThemeResource("img/info.png"));
        iconsStrip.addComponent(info);
        iconsStrip.setComponentAlignment(info, Alignment.MIDDLE_LEFT);

        alert = new Embedded();
        alert.setVisible(false);
        iconsStrip.addComponent(alert);
        iconsStrip.setComponentAlignment(alert, Alignment.MIDDLE_RIGHT);

        nameLabel = new Label(componentInfo.getName());
        nameLabel.setStyleName("componentName");
        nameLabel.setSizeUndefined();
        imageLayout.addComponent(nameLabel);
        imageLayout.setComponentAlignment(nameLabel, Alignment.BOTTOM_CENTER);

    }
    addComponent(imageLayout);
    setComponentAlignment(imageLayout, Alignment.TOP_CENTER);
    setExpandRatio(imageLayout, 1.0f);

}

From source file:com.skysql.manager.ui.components.ParametersLayout.java

License:Open Source License

/**
 * Instantiates a new parameters layout.
 *
 * @param runningTask the running task/*w  w  w.  j ava 2s .c o  m*/
 * @param nodeInfo the node info
 * @param commandEnum the command enum
 */
public ParametersLayout(final RunningTask runningTask, final NodeInfo nodeInfo, Commands.Command commandEnum) {
    this.runningTask = runningTask;

    addStyleName("parametersLayout");
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    params = new HashMap<String, String>();
    runningTask.selectParameter(params);

    switch (commandEnum) {
    case backup:
        backupLevel = new OptionGroup("Backup Level");
        backupLevel.setImmediate(true);
        backupLevel.addItem(BackupRecord.BACKUP_TYPE_FULL);
        backupLevel.setItemCaption(BackupRecord.BACKUP_TYPE_FULL, "Full");
        backupLevel.addItem(BackupRecord.BACKUP_TYPE_INCREMENTAL);
        backupLevel.setItemCaption(BackupRecord.BACKUP_TYPE_INCREMENTAL, "Incremental");
        addComponent(backupLevel);
        setComponentAlignment(backupLevel, Alignment.MIDDLE_LEFT);
        backupLevel.addValueChangeListener(new ValueChangeListener() {
            private static final long serialVersionUID = 0x4C656F6E6172646FL;

            public void valueChange(ValueChangeEvent event) {
                String level = (String) event.getProperty().getValue();
                params.put(PARAM_BACKUP_TYPE, level);
                if (level.equals(BackupRecord.BACKUP_TYPE_INCREMENTAL)) {
                    addComponent(prevBackupsLayout);
                    selectPrevBackup.select(firstItem);
                } else {
                    params.remove(PARAM_BACKUP_PARENT);
                    if (getComponentIndex(prevBackupsLayout) != -1) {
                        removeComponent(prevBackupsLayout);
                    }
                }
            }
        });

        backupLevel.setValue(BackupRecord.BACKUP_TYPE_FULL);
        isParameterReady = true;

    case restore:
        VerticalLayout restoreLayout = new VerticalLayout();
        restoreLayout.setSpacing(true);

        if (commandEnum == Command.restore) {
            addComponent(restoreLayout);
            FormLayout formLayout = new FormLayout();
            //formLayout.setMargin(new MarginInfo(false, false, true, false));
            formLayout.setMargin(false);
            restoreLayout.addComponent(formLayout);

            final NativeSelect selectSystem;
            selectSystem = new NativeSelect("Backups from");
            selectSystem.setImmediate(true);
            selectSystem.setNullSelectionAllowed(false);
            SystemInfo systemInfo = VaadinSession.getCurrent().getAttribute(SystemInfo.class);
            for (SystemRecord systemRecord : systemInfo.getSystemsMap().values()) {
                if (!systemRecord.getID().equals(SystemInfo.SYSTEM_ROOT)) {
                    selectSystem.addItem(systemRecord.getID());
                    selectSystem.setItemCaption(systemRecord.getID(), systemRecord.getName());
                }
            }
            selectSystem.select(systemInfo.getCurrentID());
            formLayout.addComponent(selectSystem);
            selectSystem.addValueChangeListener(new ValueChangeListener() {
                private static final long serialVersionUID = 0x4C656F6E6172646FL;

                public void valueChange(ValueChangeEvent event) {
                    String systemID = (String) event.getProperty().getValue();
                    Backups backups = new Backups(systemID, null);
                    backupsList = backups.getBackupsList();
                    selectPrevBackup.removeAllItems();
                    firstItem = null;
                    if (backupsList != null && backupsList.size() > 0) {
                        Collection<BackupRecord> set = backupsList.values();
                        Iterator<BackupRecord> iter = set.iterator();
                        while (iter.hasNext()) {
                            BackupRecord backupRecord = iter.next();
                            String backupID = backupRecord.getID();
                            selectPrevBackup.addItem(backupID);
                            selectPrevBackup.setItemCaption(backupID,
                                    "ID: " + backupID + ", " + backupRecord.getStarted());
                            if (firstItem == null) {
                                firstItem = backupID;
                                selectPrevBackup.select(firstItem);
                            }
                        }
                        runningTask.getControlsLayout().enableControls(true, Controls.Run);
                    } else {
                        if (backupInfoLayout != null) {
                            displayBackupInfo(backupInfoLayout, new BackupRecord());
                        }
                        runningTask.getControlsLayout().enableControls(false, Controls.Run);
                    }
                }
            });
        }
        prevBackupsLayout = new HorizontalLayout();
        restoreLayout.addComponent(prevBackupsLayout);

        selectPrevBackup = (commandEnum == Command.backup) ? new ListSelect("Backups") : new ListSelect();
        selectPrevBackup.setImmediate(true);
        selectPrevBackup.setNullSelectionAllowed(false);
        selectPrevBackup.setRows(8); // Show a few items and a scrollbar if there are more
        selectPrevBackup.setWidth("20em");
        prevBackupsLayout.addComponent(selectPrevBackup);
        final Backups backups = new Backups(nodeInfo.getParentID(), null);
        //*** this is for when we only want backups from a specific node
        // backupsList = backups.getBackupsForNode(nodeInfo.getID());
        backupsList = backups.getBackupsList();
        if (backupsList != null && backupsList.size() > 0) {
            Collection<BackupRecord> set = backupsList.values();
            Iterator<BackupRecord> iter = set.iterator();
            while (iter.hasNext()) {
                BackupRecord backupRecord = iter.next();
                selectPrevBackup.addItem(backupRecord.getID());
                selectPrevBackup.setItemCaption(backupRecord.getID(),
                        "ID: " + backupRecord.getID() + ", " + backupRecord.getStarted());
                if (firstItem == null) {
                    firstItem = backupRecord.getID();
                }
            }

            backupInfoLayout = new VerticalLayout();
            backupInfoLayout.setSpacing(false);
            backupInfoLayout.setMargin(new MarginInfo(false, true, false, true));
            prevBackupsLayout.addComponent(backupInfoLayout);
            prevBackupsLayout.setComponentAlignment(backupInfoLayout, Alignment.MIDDLE_CENTER);

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

                public void valueChange(ValueChangeEvent event) {
                    String backupID = (String) event.getProperty().getValue();
                    if (backupID == null) {
                        isParameterReady = false;
                        runningTask.getControlsLayout().enableControls(isParameterReady, Controls.Run);
                        return;
                    }
                    BackupRecord backupRecord = backupsList.get(backupID);
                    displayBackupInfo(backupInfoLayout, backupRecord);
                    if (backupLevel != null) {
                        // we're doing a backup
                        params.put(PARAM_BACKUP_PARENT, backupRecord.getID());
                    } else {
                        // we're doing a restore
                        params.put(PARAM_BACKUP_ID, backupRecord.getID());
                    }
                    isParameterReady = true;
                    ScriptingControlsLayout controlsLayout = runningTask.getControlsLayout();
                    if (controlsLayout != null) {
                        controlsLayout.enableControls(isParameterReady, Controls.Run);
                    }
                }
            });

            // final DisplayBackupRecord displayRecord = new
            // DisplayBackupRecord(parameterLayout);

            if (commandEnum == Command.restore) {
                restoreLayout.addComponent(prevBackupsLayout);
                selectPrevBackup.select(firstItem);
            }

        } else {
            // no previous backups
            if (commandEnum == Command.backup) {
                backupLevel.setEnabled(false);
                isParameterReady = true;
            } else if (commandEnum == Command.restore) {
                //runningTask.getControlsLayout().enableControls(false, Controls.run);
            }
        }
        break;

    case connect:
        VerticalLayout connectLayout = new VerticalLayout();
        addComponent(connectLayout);

        final Validator validator = new Password2Validator(connectPassword);

        passwordOption.addItem(true);
        passwordOption.setItemCaption(true, "Authenticate with root user");
        passwordOption.addItem(false);
        passwordOption.setItemCaption(false, "Authenticate with SSH Key");
        passwordOption.setImmediate(true);
        passwordOption.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 0x4C656F6E6172646FL;

            @Override
            public void valueChange(ValueChangeEvent event) {
                usePassword = (Boolean) event.getProperty().getValue();
                if (usePassword) {
                    connectPassword2.addValidator(validator);
                } else {
                    connectPassword2.removeValidator(validator);
                }
                connectPassword.setVisible(usePassword);
                connectPassword.setRequired(usePassword);
                connectPassword2.setVisible(usePassword);
                connectPassword2.setRequired(usePassword);
                connectKey.setVisible(!usePassword);
                connectKey.setRequired(!usePassword);
                boolean isValid;
                if (runningTask.getControlsLayout() != null) {
                    if (usePassword) {
                        isValid = connectPassword.isValid();
                    } else {
                        isValid = connectKey.isValid();
                    }
                    if (isValid) {
                        connectParamsListener.valueChange(null);
                    } else {
                        form.setComponentError(null);
                        form.setValidationVisible(false);
                        runningTask.getControlsLayout().enableControls(false, Controls.Run);
                    }
                }
            }
        });
        connectLayout.addComponent(passwordOption);
        passwordOption.select(false);

        connectLayout.addComponent(form);
        form.setImmediate(true);
        form.setFooter(null);
        Layout layout = form.getLayout();

        form.addField("connectPassword", connectPassword);
        connectPassword.setImmediate(true);
        connectPassword.setRequiredError("Root Password is a required field");
        connectPassword.addValueChangeListener(connectParamsListener);

        form.addField("connectPassword2", connectPassword2);
        connectPassword2.setImmediate(true);
        connectPassword2.setRequiredError("Confirm Password is a required field");
        connectPassword2.addValueChangeListener(connectParamsListener);

        form.addField("connectKey", connectKey);
        connectKey.setStyleName("sshkey");
        connectKey.setColumns(41);
        connectKey.setImmediate(true);
        connectKey.setRequiredError("SSH Key is a required field");
        connectKey.addValueChangeListener(connectParamsListener);
        break;

    default:
        isParameterReady = true;
        break;

    }

}

From source file:com.skysql.manager.ui.components.SystemLayout.java

License:Open Source License

/**
 * Instantiates a new system layout./*from   w w w  . ja  va 2s. c  o m*/
 *
 * @param systemRecord the system record
 */
public SystemLayout(SystemRecord systemRecord) {

    addStyleName("systemLayout");
    setWidth(Sizeable.SIZE_UNDEFINED, Sizeable.Unit.PERCENTAGE);
    setMargin(new MarginInfo(false, true, false, false));

    final HorizontalLayout systemHeader = new HorizontalLayout();
    systemHeader.addStyleName("panelHeaderLayout");
    systemHeader.setSpacing(true);
    systemHeader.setWidth("100%");
    systemHeader.setHeight("23px");
    addComponent(systemHeader);

    backButton = new NativeButton();
    backButton.setStyleName("backButton");
    backButton.setDescription("Back to Systems");
    systemHeader.addComponent(backButton);
    backButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {

            VaadinSession session = getSession();
            SystemInfo systemInfo = session.getAttribute(SystemInfo.class);
            OverviewPanel overviewPanel = session.getAttribute(OverviewPanel.class);
            ComponentButton button = systemInfo.getCurrentSystem().getButton();
            String parentID = systemInfo.getCurrentSystem().getParentID();
            systemInfo.setCurrentSystem(parentID);
            session.setAttribute(SystemInfo.class, systemInfo);
            ManagerUI.log("new systemID: " + parentID);
            overviewPanel.clickLayout(button, false);
            overviewPanel.refresh();
        }

    });

    final Label systemLabel = new Label("Systems");
    systemLabel.setSizeUndefined();
    systemHeader.addComponent(systemLabel);
    systemHeader.setComponentAlignment(systemLabel, Alignment.MIDDLE_LEFT);
    systemHeader.setExpandRatio(systemLabel, 1.0f);

    systemSlot = new HorizontalLayout();
    addComponent(systemSlot);

    // initialize System button
    refresh(null, null);

}

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

License:Open Source License

/**
 * Time layout.//from  ww w.  j a v a2  s  .c  o  m
 *
 * @return the vertical layout
 */
private VerticalLayout timeLayout() {

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setSpacing(true);
    layout.setMargin(new MarginInfo(false, true, false, true));

    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setSpacing(true);
    layout.addComponent(titleLayout);

    final Label title = new Label("<h3>Date & Time Presentation</h3>", ContentMode.HTML);
    title.setSizeUndefined();
    titleLayout.addComponent(title);

    Embedded info = new Embedded(null, new ThemeResource("img/info.png"));
    info.addStyleName("infoButton");
    info.setDescription(
            "Determines if date & time stamps are displayed in the originally recorded format or adjusted to the local timezone.<br/>The format can be customized by using the following Java 6 SimpleDateFormat patterns:"
                    + "</blockquote>"
                    + " <table border=0 cellspacing=3 cellpadding=0 summary=\"Chart shows pattern letters, date/time component, presentation, and examples.\">\n"
                    + "     <tr bgcolor=\"#ccccff\">\n" + "         <th align=left>Letter\n"
                    + "         <th align=left>Date or Time Component\n"
                    + "         <th align=left>Presentation\n" + "         <th align=left>Examples\n"
                    + "     <tr>\n" + "         <td><code>G</code>\n" + "         <td>Era designator\n"
                    + "         <td><a href=\"#text\">Text</a>\n" + "         <td><code>AD</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>y</code>\n"
                    + "         <td>Year\n" + "         <td><a href=\"#year\">Year</a>\n"
                    + "         <td><code>1996</code>; <code>96</code>\n" + "     <tr>\n"
                    + "         <td><code>M</code>\n" + "         <td>Month in year\n"
                    + "         <td><a href=\"#month\">Month</a>\n"
                    + "         <td><code>July</code>; <code>Jul</code>; <code>07</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>w</code>\n"
                    + "         <td>Week in year\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>27</code>\n" + "     <tr>\n" + "         <td><code>W</code>\n"
                    + "         <td>Week in month\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>2</code>\n" + "     <tr bgcolor=\"#eeeeff\">\n"
                    + "         <td><code>D</code>\n" + "         <td>Day in year\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>189</code>\n"
                    + "     <tr>\n" + "         <td><code>d</code>\n" + "         <td>Day in month\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>10</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>F</code>\n"
                    + "         <td>Day of week in month\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>2</code>\n" + "     <tr>\n" + "         <td><code>E</code>\n"
                    + "         <td>Day in week\n" + "         <td><a href=\"#text\">Text</a>\n"
                    + "         <td><code>Tuesday</code>; <code>Tue</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>a</code>\n"
                    + "         <td>Am/pm marker\n" + "         <td><a href=\"#text\">Text</a>\n"
                    + "         <td><code>PM</code>\n" + "     <tr>\n" + "         <td><code>H</code>\n"
                    + "         <td>Hour in day (0-23)\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>0</code>\n" + "     <tr bgcolor=\"#eeeeff\">\n"
                    + "         <td><code>k</code>\n" + "         <td>Hour in day (1-24)\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>24</code>\n"
                    + "     <tr>\n" + "         <td><code>K</code>\n" + "         <td>Hour in am/pm (0-11)\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>0</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>h</code>\n"
                    + "         <td>Hour in am/pm (1-12)\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>12</code>\n" + "     <tr>\n" + "         <td><code>m</code>\n"
                    + "         <td>Minute in hour\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>30</code>\n" + "     <tr bgcolor=\"#eeeeff\">\n"
                    + "         <td><code>s</code>\n" + "         <td>Second in minute\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>55</code>\n"
                    + "     <tr>\n" + "         <td><code>S</code>\n" + "         <td>Millisecond\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>978</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>z</code>\n"
                    + "         <td>Time zone\n" + "         <td><a href=\"#timezone\">General time zone</a>\n"
                    + "         <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>\n"
                    + "     <tr>\n" + "         <td><code>Z</code>\n" + "         <td>Time zone\n"
                    + "         <td><a href=\"#rfc822timezone\">RFC 822 time zone</a>\n"
                    + "         <td><code>-0800</code>\n" + " </table>\n" + " </blockquote>\n" + "");
    titleLayout.addComponent(info);
    titleLayout.setComponentAlignment(info, Alignment.MIDDLE_CENTER);

    final DateConversion dateConversion = VaadinSession.getCurrent().getAttribute(DateConversion.class);

    OptionGroup option = new OptionGroup("Display options");
    option.addItem(false);
    option.setItemCaption(false, "Show time in UTC/GMT");
    option.addItem(true);
    option.setItemCaption(true, "Adjust to local timezone (" + dateConversion.getClientTZname() + ")");

    String propertyTimeAdjust = userObject.getProperty(UserObject.PROPERTY_TIME_ADJUST);
    option.select(propertyTimeAdjust == null ? DEFAULT_TIME_ADJUST : Boolean.valueOf(propertyTimeAdjust));
    option.setNullSelectionAllowed(false);
    option.setHtmlContentAllowed(true);
    option.setImmediate(true);
    layout.addComponent(option);

    final HorizontalLayout defaultLayout = new HorizontalLayout();
    defaultLayout.setSpacing(true);
    layout.addComponent(defaultLayout);

    final Form form = new Form();
    form.setFooter(null);
    final TextField timeFormat = new TextField("Format");
    form.addField("timeFormat", timeFormat);
    defaultLayout.addComponent(form);

    option.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent event) {
            boolean value = (Boolean) event.getProperty().getValue();
            dateConversion.setAdjustedToLocal(value);
            userObject.setProperty(UserObject.PROPERTY_TIME_ADJUST, String.valueOf(value));
            settingsDialog.setRefresh(true);
            if (value == false) {
                timeFormat.removeAllValidators();
                timeFormat.setComponentError(null);
                form.setComponentError(null);
                form.setValidationVisible(false);
                settingsDialog.setClose(true);
            } else {
                timeFormat.addValidator(new TimeFormatValidator());
                timeFormat.setInputPrompt(DateConversion.DEFAULT_TIME_FORMAT);
                //timeFormat.setClickShortcut(KeyCode.ENTER);
            }
        }
    });

    String propertyTimeFormat = userObject.getProperty(UserObject.PROPERTY_TIME_FORMAT);
    propertyTimeFormat = (propertyTimeFormat == null ? DateConversion.DEFAULT_TIME_FORMAT
            : String.valueOf(propertyTimeFormat));

    timeFormat.setColumns(16);
    timeFormat.setValue(propertyTimeFormat);
    timeFormat.setImmediate(true);
    timeFormat.setRequired(true);
    timeFormat.setRequiredError("Format cannot be empty.");
    timeFormat.addValidator(new TimeFormatValidator());

    timeFormat.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent event) {
            String value = (String) event.getProperty().getValue();
            try {
                form.setComponentError(null);
                form.commit();
                timeFormat.setComponentError(null);
                form.setValidationVisible(false);
                dateConversion.setFormat(value);
                userObject.setProperty(UserObject.PROPERTY_TIME_FORMAT, value);
                settingsDialog.setClose(true);
                settingsDialog.setRefresh(true);
            } catch (InvalidValueException e) {
                settingsDialog.setClose(false);
                timeFormat.setComponentError(new UserError("Invalid Format (Java SimpleDateFormat)."));
                timeFormat.focus();
            }
        }
    });

    Button defaultButton = new Button("Restore Default");
    defaultLayout.addComponent(defaultButton);
    defaultLayout.setComponentAlignment(defaultButton, Alignment.MIDDLE_LEFT);
    defaultButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(Button.ClickEvent event) {
            timeFormat.setValue(DateConversion.DEFAULT_TIME_FORMAT);
        }
    });

    return layout;
}

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

License:Open Source License

/**
 * Instantiates a new monitors settings.
 *
 * @param settingsDialog the settings dialog
 * @param systemID the system id//from w  w w . ja  v a  2 s . c om
 * @param systemType the system type
 */
MonitorsSettings(SettingsDialog settingsDialog, String systemID, String systemType) {
    this.settingsDialog = settingsDialog;
    this.systemID = systemID;
    this.systemType = systemType;

    addStyleName("monitorsTab");
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    HorizontalLayout selectLayout = new HorizontalLayout();
    addComponent(selectLayout);
    selectLayout.setSizeFull();
    selectLayout.setSpacing(true);

    Monitors.reloadMonitors();
    monitorsAll = Monitors.getMonitorsList(systemType);

    select = new ListSelect("Monitors");
    select.setImmediate(true);
    for (MonitorRecord monitor : monitorsAll.values()) {
        String id = monitor.getID();
        select.addItem(id);
        select.setItemCaption(id, monitor.getName());
    }
    select.setNullSelectionAllowed(false);
    selectLayout.addComponent(select);
    select.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            String monitorID = (String) event.getProperty().getValue();
            displayMonitorRecord(monitorID);
            MonitorRecord monitor = monitorsAll.get(monitorID);
            if (monitor != null) {
                String monitorType = monitor.getType();

                for (Monitors.EditableMonitorType editable : EditableMonitorType.values()) {
                    if (editable.name().equals(monitorType)) {
                        editMonitor.setEnabled(true);
                        break;
                    }
                }
            }
        }
    });

    selectLayout.addLayoutClickListener(new LayoutClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void layoutClick(LayoutClickEvent event) {

            Component child;
            if (event.isDoubleClick() && (child = event.getChildComponent()) != null
                    && (child instanceof ListSelect)) {
                // Get the child component which was double-clicked
                ListSelect select = (ListSelect) child;
                String monitorID = (String) select.getValue();
                MonitorRecord monitor = monitorsAll.get(monitorID);
                String monitorType = monitor.getType();
                for (Monitors.EditableMonitorType editable : EditableMonitorType.values()) {
                    if (editable.name().equals(monitorType)) {
                        editMonitor(monitor);
                        break;
                    }
                }
            }
        }
    });

    monitorLayout = new FormLayout();
    selectLayout.addComponent(monitorLayout);
    selectLayout.setExpandRatio(monitorLayout, 1.0f);
    monitorLayout.setSpacing(false);

    id.setCaption("ID:");
    monitorLayout.addComponent(id);
    name.setCaption("Name:");
    monitorLayout.addComponent(name);
    description.setCaption("Description:");
    monitorLayout.addComponent(description);
    unit.setCaption("Unit:");
    monitorLayout.addComponent(unit);
    // type.setCaption("Type:");
    // monitorLayout.addComponent(type);
    delta.setCaption("Is Delta:");
    monitorLayout.addComponent(delta);
    average.setCaption("Is Average:");
    monitorLayout.addComponent(average);
    chartType.setCaption("Chart Type:");
    monitorLayout.addComponent(chartType);
    interval.setCaption("Interval:");
    monitorLayout.addComponent(interval);
    sql.setCaption("Statement:");
    monitorLayout.addComponent(sql);

    HorizontalLayout selectButtons = new HorizontalLayout();
    selectButtons.setSizeFull();
    addComponent(selectButtons);
    selectButtons.setSpacing(true);

    Button addMonitor = new Button("Add...");
    selectButtons.addComponent(addMonitor);
    selectButtons.setComponentAlignment(addMonitor, Alignment.MIDDLE_LEFT);
    addMonitor.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            addMonitor();
        }
    });

    deleteMonitor = new Button("Delete");
    deleteMonitor.setEnabled(false);
    selectButtons.addComponent(deleteMonitor);
    selectButtons.setComponentAlignment(deleteMonitor, Alignment.MIDDLE_LEFT);
    deleteMonitor.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            String monitorID = (String) select.getValue();
            if (monitorID != null) {
                deleteMonitor(monitorsAll.get(monitorID));
            }
        }
    });

    editMonitor = new Button("Edit...");
    editMonitor.setEnabled(false);
    selectButtons.addComponent(editMonitor);
    selectButtons.setComponentAlignment(editMonitor, Alignment.MIDDLE_CENTER);
    selectButtons.setExpandRatio(editMonitor, 1.0f);
    editMonitor.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            String monitorID = (String) select.getValue();
            if (monitorID != null) {
                editMonitor(monitorsAll.get(monitorID));
            }
        }
    });

}

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

License:Open Source License

/**
 * Instantiates a new node form./* w w  w. j  a  v  a 2  s  .  c o  m*/
 *
 * @param node the node
 * @param description the description
 */
NodeForm(final NodeInfo node, String description) {
    this.node = node;

    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(false);

    isGalera = node.getSystemType().equals(SystemTypes.Type.galera.name());

    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>Name</code>"
            + "         <td>Name of the Node" + "     <tr bgcolor=\"#eeeeff\">"
            + "         <td><code>Hostname</code>"
            + "         <td>In some systems, a hostname that identifies the node" + "     <tr>"
            + "         <td><code>Instance ID</code>"
            + "         <td>The instance ID field is for information only and is not used within the Manager"
            + "     <tr bgcolor=\"#eeeeff\">" + "         <td><code>Public IP</code>"
            + "         <td>In some systems, the public IP address of the node" + "     <tr>"
            + "         <td><code>Private IP</code>"
            + "         <td>The IP address that accesses the node internally to the manager";

    if (!isGalera) {
        infoText += "     <tr bgcolor=\"#eeeeff\">" + "         <td><code>Database Username</code>"
                + "         <td>Node system override for database user name" + "     <tr>"
                + "         <td><code>Database Password</code>"
                + "         <td>Node system override for database password" + "     <tr bgcolor=\"#eeeeff\">"
                + "         <td><code>Replication Username</code>"
                + "         <td>Node system override for replication user name" + "     <tr>"
                + "         <td><code>Replication Password</code>"
                + "         <td>Node system override for replication password";

    }
    infoText += " </table>" + " </blockquote>";
    info.setDescription(infoText);

    formDescription.addComponent(info);
    Label labelDescription = new Label(description);
    formDescription.addComponent(labelDescription);
    formDescription.setComponentAlignment(labelDescription, Alignment.MIDDLE_LEFT);
    addComponent(formDescription);

    addComponent(form);
    form.setImmediate(false);
    form.setFooter(null);
    form.setDescription(null);

    String value;
    if ((value = node.getName()) != null) {
        name.setValue(value);
    }
    form.addField("name", name);
    name.focus();
    name.setImmediate(true);
    name.addValidator(new NodeNameValidator(node.getName()));

    if ((value = node.getHostname()) != null) {
        hostname.setValue(value);
    }
    form.addField("hostname", hostname);

    if ((value = node.getInstanceID()) != null) {
        instanceID.setValue(value);
    }
    form.addField("instanceID", instanceID);

    if ((value = node.getPublicIP()) != null) {
        publicIP.setValue(value);
    }
    form.addField("publicIP", publicIP);

    if ((value = node.getPrivateIP()) != null) {
        privateIP.setValue(value);
    }
    form.addField("privateIP", privateIP);
    privateIP.setRequired(true);
    privateIP.setRequiredError("Private IP is a required field");

    if (!isGalera) {
        if ((value = node.getDBUsername()) != null) {
            dbUsername.setValue(value);
        }
        form.addField("dbusername", dbUsername);
        dbUsername.setRequired(true);
        dbUsername.setImmediate(false);
        dbUsername.setRequiredError("Database Username is a required field");
        dbUsername.addValidator(new UserNotRootValidator(dbUsername.getCaption()));

        if ((value = node.getDBPassword()) != null) {
            dbPassword.setValue(value);
        }
        form.addField("dbpassword", dbPassword);
        dbPassword.setRequired(true);
        dbPassword.setImmediate(false);
        dbPassword.setRequiredError("Database Password is a required field");

        if ((value = node.getDBPassword()) != null) {
            dbPassword2.setValue(value);
        }
        form.addField("dbpassword2", dbPassword2);
        dbPassword2.setRequired(true);
        dbPassword2.setImmediate(true);
        dbPassword2.setRequiredError("Confirm Password is a required field");
        dbPassword2.addValidator(new Password2Validator(dbPassword));

        if ((value = node.getRepUsername()) != null) {
            repUsername.setValue(value);
        }
        form.addField("repusername", repUsername);
        repUsername.setRequired(true);
        repUsername.setImmediate(false);
        repUsername.setRequiredError("Replication Username is a required field");
        repUsername.addValidator(new UserNotRootValidator(repUsername.getCaption()));

        if ((value = node.getRepPassword()) != null) {
            repPassword.setValue(value);
        }
        form.addField("reppassword", repPassword);
        repPassword.setRequired(true);
        repPassword.setImmediate(false);
        repPassword.setRequiredError("Replication Password is a required field");

        if ((value = node.getRepPassword()) != null) {
            repPassword2.setValue(value);
        }
        form.addField("reppassword2", repPassword2);
        repPassword2.setRequired(true);
        repPassword2.setImmediate(true);
        repPassword2.setRequiredError("Confirm Password is a required field");
        repPassword2.addValidator(new Password2Validator(repPassword));
    }

    if (node.getID() == null) {
        Layout layout = form.getLayout();

        {
            Label spacer = new Label();
            spacer.setWidth("40px");
            layout.addComponent(spacer);
        }

        HorizontalLayout optionLayout = new HorizontalLayout();
        optionLayout.addStyleName("formInfoLayout");
        optionLayout.setSpacing(true);
        optionLayout.setSizeUndefined();
        layout.addComponent(optionLayout);

        Label padding = new Label("\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0");
        optionLayout.addComponent(padding);

        Embedded info2 = new Embedded(null, new ThemeResource("img/info.png"));
        info2.addStyleName("infoButton");
        info2.setDescription(connectionInfo);
        optionLayout.addComponent(info2);

        final Validator validator = new Password2Validator(connectPassword);

        final OptionGroup connectOption = new OptionGroup("Connection options");
        connectOption.setSizeUndefined();
        connectOption.addItem(false);
        connectOption.setItemCaption(false, "Node is not available, user will run connect later");
        connectOption.addItem(true);
        connectOption.setItemCaption(true, "Node is available now, connect automatically");
        connectOption.setImmediate(true);
        connectOption.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 0x4C656F6E6172646FL;

            @Override
            public void valueChange(ValueChangeEvent event) {
                runConnect = (Boolean) event.getProperty().getValue();
                passwordOption.setVisible(runConnect);
                connectPassword.setRequired(runConnect && usePassword);
                connectPassword2.setRequired(runConnect && usePassword);
                connectKey.setRequired(runConnect && !usePassword);
                if (!runConnect) {
                    connectPassword.setVisible(false);
                    connectPassword2.setVisible(false);
                    connectPassword2.removeValidator(validator);
                    connectKey.setVisible(false);
                } else {
                    if (usePassword) {
                        connectPassword.setVisible(true);
                        connectPassword2.setVisible(true);
                        connectPassword2.addValidator(validator);
                    } else {
                        connectKey.setVisible(true);
                    }
                }
                form.setComponentError(null);
                form.setValidationVisible(false);
            }
        });
        optionLayout.addComponent(connectOption);
        optionLayout.setComponentAlignment(connectOption, Alignment.MIDDLE_LEFT);
        connectOption.select(true);

        passwordOption.addItem(true);
        passwordOption.setItemCaption(true, "Authenticate with root user");
        passwordOption.addItem(false);
        passwordOption.setItemCaption(false, "Authenticate with SSH Key");
        passwordOption.setImmediate(true);
        passwordOption.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 0x4C656F6E6172646FL;

            @Override
            public void valueChange(ValueChangeEvent event) {
                usePassword = (Boolean) event.getProperty().getValue();
                if (usePassword) {
                    connectPassword2.addValidator(validator);
                } else {
                    connectPassword2.removeValidator(validator);
                }
                connectPassword.setVisible(usePassword);
                connectPassword.setRequired(usePassword);
                connectPassword2.setVisible(usePassword);
                connectPassword2.setRequired(usePassword);
                connectKey.setVisible(!usePassword);
                connectKey.setRequired(!usePassword);
                form.setComponentError(null);
                form.setValidationVisible(false);
            }
        });
        layout.addComponent(passwordOption);
        passwordOption.select(false);

        form.addField("connectPassword", connectPassword);
        connectPassword.setImmediate(false);
        connectPassword.setRequiredError("Root Password is a required field");

        form.addField("connectPassword2", connectPassword2);
        connectPassword2.setImmediate(true);
        connectPassword2.setRequiredError("Confirm Password is a required field");

        form.addField("connectKey", connectKey);
        connectKey.setStyleName("sshkey");
        connectKey.setColumns(41);
        connectKey.setRequiredError("SSH Key is a required field");
    }

}

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

License:Open Source License

/**
 * Select command./*from  ww w. j ava  2s  .  c  om*/
 *
 * @param command the command
 */
public void selectCommand(String command) {
    RunningTask runningTask = nodeInfo.getCommandTask();

    ManagerUI.log("selectCommand() - runningTask: " + runningTask);

    runningTask = new RunningTask(command, nodeInfo, commandSelect);
    runningTask.addRefreshListener(refreshListener);

    // add SCRIPTING layout
    VerticalLayout newScriptingLayout = runningTask.getLayout();
    newLayout.replaceComponent(runningContainerLayout, newScriptingLayout);
    newLayout.setComponentAlignment(newScriptingLayout, Alignment.MIDDLE_LEFT);
    runningContainerLayout = newScriptingLayout;

}

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

License:Open Source License

/**
 * Creates the info layout./*  w  ww  . ja v a 2s  .c o  m*/
 */
private void createInfoLayout() {

    infoLayout = new VerticalLayout();
    infoLayout.addStyleName("infoLayout");
    infoLayout.setWidth(PANEL_SPLIT_X, Unit.PIXELS);
    infoLayout.setSpacing(true);
    addComponent(infoLayout);

    final HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.addStyleName("panelHeaderLayout");
    headerLayout.setWidth("100%");
    headerLayout.setSpacing(true);
    headerLayout.setMargin(new MarginInfo(false, true, false, true));
    infoLayout.addComponent(headerLayout);

    nameLabel = new Label();
    nameLabel.addStyleName("nameLabel");
    nameLabel.setSizeUndefined();
    headerLayout.addComponent(nameLabel);
    headerLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);

    final Button editButton = new Button("Edit");
    editButton.setEnabled(false);
    headerLayout.addComponent(editButton);
    headerLayout.setComponentAlignment(editButton, Alignment.MIDDLE_RIGHT);

    // this will become the editing function of what properties are displayed in the info layout
    /***
    final Button saveButton = new Button("Done");
    editButton.addClickListener(new Button.ClickListener() {
            
       public void buttonClick(ClickEvent event) {
    nameField = new TextField();
    nameField.setImmediate(true);
    nameField.setValue(nameLabel.getValue());
    nameField.setWidth("12em");
    nameField.focus();
    nameField.addValueChangeListener(new ValueChangeListener() {
            
       public void valueChange(ValueChangeEvent event) {
          saveButton.click();
       }
    });
    headerLayout.replaceComponent(nameLabel, nameField);
    headerLayout.setComponentAlignment(nameField, Alignment.MIDDLE_LEFT);
    headerLayout.replaceComponent(editButton, saveButton);
    headerLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
       }
    });
            
    saveButton.addClickListener(new Button.ClickListener() {
            
       public void buttonClick(ClickEvent event) {
    String name = nameField.getValue();
    nameLabel.setValue(name);
    headerLayout.replaceComponent(nameField, nameLabel);
    headerLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    headerLayout.replaceComponent(saveButton, editButton);
    headerLayout.setComponentAlignment(editButton, Alignment.MIDDLE_RIGHT);
    lastComponent.setName(name);
    if (lastComponent instanceof NodeInfo) {
       //((NodeInfo) lastComponent).saveName(name);
    } else if (lastComponent instanceof SystemRecord) {
       //systemInfo.saveName(name);
    }
    ComponentButton componentButton = lastComponent.getButton();
    componentButton.setName(name);
       }
    });
     ***/

    systemLabels = new Label[systemLabelsStrings.length];
    systemGrid = createCurrentInfo(systemLabels, systemLabelsStrings);
    nodeLabels = new Label[nodeLabelsStrings.length];
    nodeGrid = createCurrentInfo(nodeLabels, nodeLabelsStrings);
}