Example usage for com.vaadin.ui HorizontalLayout setSpacing

List of usage examples for com.vaadin.ui HorizontalLayout setSpacing

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setSpacing.

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.siemens.ct.osgi.vaadin.pm.bundleview.BundleView.java

License:Open Source License

@SuppressWarnings("serial")
@Override//from  w w  w.ja v  a 2  s . c  o  m
public Component getView(Application application) {
    if (view == null) {
        VerticalLayout verticalLayout = new VerticalLayout();
        verticalLayout.setMargin(true);
        verticalLayout.setSpacing(true);

        table = new Table();
        table.addContainerProperty("Bundle Symbolic Name", String.class, new ThemeResource("icons/bundle.png"));
        table.addContainerProperty("Version", String.class, null);
        table.addContainerProperty("State", String.class, null);
        table.addContainerProperty("Active", CheckBox.class, null);
        table.setWidth("100%");
        table.setPageLength(8);
        table.setSortContainerPropertyId("Bundle Symbolic Name");
        table.setSortAscending(true);
        table.setImmediate(true);

        refreshTable();
        verticalLayout.addComponent(table);

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

        Button refreshButton = new Button("Refresh Table");
        refreshButton.addListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                refreshTable();
            }
        });
        horizontalLayout.addComponent(refreshButton);

        Button selectAllButton = new Button("Select All");
        selectAllButton.addListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                for (Bundle bundle : bundles) {
                    try {
                        bundle.start();
                    } catch (BundleException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    refreshTable();
                }
            }
        });
        horizontalLayout.addComponent(selectAllButton);

        Button deselectAllButton = new Button("Deselect All");
        deselectAllButton.addListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                for (Bundle bundle : bundles) {
                    try {
                        bundle.stop();
                    } catch (BundleException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    refreshTable();
                }
            }
        });
        horizontalLayout.addComponent(deselectAllButton);

        verticalLayout.addComponent(horizontalLayout);
        view = verticalLayout;
    }
    return view;
}

From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java

License:Open Source License

private Layout getHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setMargin(true);/*  w  w w  .j a v a  2  s. c  o  m*/
    header.setSpacing(true);
    // header.setStyleName(Reindeer.LAYOUT_BLACK);

    CssLayout titleLayout = new CssLayout();
    H2 title = new H2("Dynamic Vaadin OSGi Demo");
    titleLayout.addComponent(title);
    SmallText description = new SmallText(
            "Select the \"Bundle View\" tab and activate/stop OSGi bundles dynamically.");
    description.setSizeUndefined();
    titleLayout.addComponent(description);

    header.addComponent(titleLayout);

    return header;
}

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

License:Open Source License

/**
 * Inits the layout content./*from   w w  w.  j  av  a  2 s . com*/
 */
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.CalendarDialog.java

License:Open Source License

/**
 * Initializes a modal window to edit schedule event.
 *
 * @param event the event/*from w  w  w  . ja v a  2  s  .  com*/
 * @param newEvent the new event
 */
private void createCalendarEventPopup(CalendarCustomEvent event, boolean newEvent) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    Date occurrence = event.getOccurrence();
    if (!newEvent && occurrence != null) {
        Form form = new Form();
        form.setCaption("This is a repeat occurrence");
        layout.addComponent(form);

        DateField dateField = new DateField("Occurrence Start");
        if (useSecondResolution) {
            dateField.setResolution(Resolution.SECOND);
        } else {
            dateField.setResolution(Resolution.MINUTE);
        }
        dateField.setValue(event.getStart());
        dateField.setEnabled(false);
        form.addField("dateField", dateField);
        form.setFooter(null);

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

        final Label label = new Label("Click to change the original event below:");
        editLayout.addComponent(label);
        editLayout.setComponentAlignment(label, Alignment.BOTTOM_LEFT);

        editOriginalButton = new Button("Edit", new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent clickEvent) {
                scheduleEventForm.setEnabled(true);
                applyEventButton.setEnabled(true);
                label.setValue("Editing original event:");
                editOriginalButton.setVisible(false);
            }
        });
        editLayout.addComponent(editOriginalButton);

        scheduleEventForm.setEnabled(false);
    } else {
        scheduleEventForm.setEnabled(true);
    }

    layout.addComponent(scheduleEventForm);

    applyEventButton = new Button("Add", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            commitCalendarEvent();
        }
    });
    Button cancel = new Button("Cancel", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("Delete", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(cancel);
    buttons.addComponent(applyEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

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

License:Open Source License

/**
 * Show delete popup./*www  .  j  a  v  a2 s .c  om*/
 *
 * @param event the event
 */
private void showDeletePopup(final CalendarCustomEvent event) {
    if (event == null) {
        return;
    }

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    deleteSchedulePopup = new Window("Delete Recurring Event", layout);
    deleteSchedulePopup.setWidth("740px");
    deleteSchedulePopup.setModal(true);
    deleteSchedulePopup.center();
    deleteSchedulePopup.setContent(layout);
    deleteSchedulePopup.addCloseListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            UI.getCurrent().removeWindow(deleteSchedulePopup);
        }
    });

    Label warning = new Label(
            "Do you want to delete the original event, or this and all future occurrences of the event, or only the selected occurrence?");
    layout.addComponent(warning);

    Button cancel = new Button("Cancel", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(deleteSchedulePopup);
        }
    });

    Button deleteAll = new Button("Delete Original Event", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent dummy) {
            String scheduleID = (String) event.getData();
            Schedule.delete(scheduleID);

            schedule.getScheduleList().remove(scheduleID);

            ArrayList<CalendarCustomEvent> eventsList = eventsMap.remove(scheduleID);
            for (CalendarCustomEvent removeEvent : eventsList) {
                if (dataSource.containsEvent(removeEvent)) {
                    dataSource.removeEvent(removeEvent);
                }
            }

            UI.getCurrent().removeWindow(deleteSchedulePopup);

            UI.getCurrent().removeWindow(scheduleEventPopup);

        }
    });

    Button deleteFuture = new Button("Delete All Future Events", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent dummy) {
            String scheduleID = (String) event.getData();
            ScheduleRecord scheduleRecord = schedule.getScheduleList().get(scheduleID);
            VEvent vEvent = iCalSupport.readVEvent(scheduleRecord.getICal());
            ManagerUI.log("before Delete All Future Events\n" + vEvent);
            iCalSupport.deleteAllFuture(vEvent, event.getStart());
            ManagerUI.log("after Delete All Future Events\n" + vEvent);
            scheduleRecord.setICal(vEvent.toString());

            Schedule.update(scheduleID, vEvent.toString());
            ArrayList<CalendarCustomEvent> eventsList = eventsMap.remove(scheduleID);
            for (CalendarCustomEvent removeEvent : eventsList) {
                if (dataSource.containsEvent(removeEvent)) {
                    dataSource.removeEvent(removeEvent);
                }
            }

            schedule.getScheduleList().put(scheduleID, scheduleRecord);

            addEventsToMap(scheduleID, vEvent, event.getNode());
            eventsList = eventsMap.get(scheduleID);
            for (CalendarCustomEvent addEvent : eventsList) {
                if (!dataSource.containsEvent(addEvent)) {
                    dataSource.addEvent(addEvent);
                }
            }

            UI.getCurrent().removeWindow(deleteSchedulePopup);

            UI.getCurrent().removeWindow(scheduleEventPopup);

        }
    });

    Button deleteSelected = new Button("Delete Only This Event", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent dummy) {
            String scheduleID = (String) event.getData();
            ScheduleRecord scheduleRecord = schedule.getScheduleList().get(scheduleID);
            VEvent vEvent = iCalSupport.readVEvent(scheduleRecord.getICal());
            ManagerUI.log("before Exclude\n" + vEvent);
            iCalSupport.addExcludedDate(vEvent, event.getStart());
            ManagerUI.log("after Exclude\n" + vEvent);
            scheduleRecord.setICal(vEvent.toString());

            Schedule.update(scheduleID, vEvent.toString());
            ArrayList<CalendarCustomEvent> eventsList = eventsMap.remove(scheduleID);
            for (CalendarCustomEvent removeEvent : eventsList) {
                if (dataSource.containsEvent(removeEvent)) {
                    dataSource.removeEvent(removeEvent);
                }
            }

            schedule.getScheduleList().put(scheduleID, scheduleRecord);

            addEventsToMap(scheduleID, vEvent, event.getNode());
            eventsList = eventsMap.get(scheduleID);
            for (CalendarCustomEvent addEvent : eventsList) {
                if (!dataSource.containsEvent(addEvent)) {
                    dataSource.addEvent(addEvent);
                }
            }

            UI.getCurrent().removeWindow(deleteSchedulePopup);

            UI.getCurrent().removeWindow(scheduleEventPopup);

        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(cancel);
    buttons.addComponent(deleteAll);
    buttons.addComponent(deleteFuture);
    buttons.addComponent(deleteSelected);
    deleteSelected.focus();

    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);

    if (!UI.getCurrent().getWindows().contains(deleteSchedulePopup)) {
        UI.getCurrent().addWindow(deleteSchedulePopup);
    }
}

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   ww w.  j ava  2s .  c  om*/
 * @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.ChartsDialog.java

License:Open Source License

/**
 * Instantiates a new charts dialog./*w  w  w.j a v a2s  . c om*/
 *
 * @param chartsLayout the charts layout
 * @param chartButton the chart button
 */
public ChartsDialog(final ChartsLayout chartsLayout, final ChartButton chartButton) {

    this.chartButton = chartButton;
    this.chartsLayout = chartsLayout;

    dialogWindow = new ModalWindow("Monitors to Chart mapping", "775px");

    HorizontalLayout wrapper = new HorizontalLayout();
    //wrapper.setWidth("100%");
    wrapper.setMargin(true);

    UI.getCurrent().addWindow(dialogWindow);

    newUserChart = (chartButton != null) ? new UserChart((UserChart) chartButton.getData()) : newUserChart();

    ArrayList<String> monitorIDs = newUserChart.getMonitorIDs();
    MonitorsLayout monitorsLayout = new MonitorsLayout(monitorIDs);
    wrapper.addComponent(monitorsLayout);

    VerticalLayout separator = new VerticalLayout();
    separator.setSizeFull();
    Embedded rightArrow = new Embedded(null, new ThemeResource("img/right_arrow.png"));
    separator.addComponent(rightArrow);
    separator.setComponentAlignment(rightArrow, Alignment.MIDDLE_CENTER);
    wrapper.addComponent(separator);

    ChartPreviewLayout chartPreviewLayout = new ChartPreviewLayout(newUserChart, chartsLayout.getTime(),
            chartsLayout.getInterval());
    wrapper.addComponent(chartPreviewLayout);
    monitorsLayout.addChartPreview(chartPreviewLayout);

    HorizontalLayout buttonsBar = new HorizontalLayout();
    buttonsBar.setStyleName("buttonsBar");
    buttonsBar.setSizeFull();
    buttonsBar.setSpacing(true);
    buttonsBar.setMargin(true);
    buttonsBar.setHeight("49px");

    Label filler = new Label();
    buttonsBar.addComponent(filler);
    buttonsBar.setExpandRatio(filler, 1.0f);

    Button cancelButton = new Button("Cancel");
    buttonsBar.addComponent(cancelButton);
    buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

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

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
        }
    });

    Button okButton = new Button(chartButton != null ? "Save Changes" : "Add Chart");
    okButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            try {
                ChartButton newChartButton = new ChartButton(newUserChart);
                newChartButton.setChartsLayout(chartsLayout);
                newChartButton.setEditable(true);
                if (chartButton != null) {
                    chartsLayout.replaceComponent(chartButton, newChartButton);
                } else {
                    chartsLayout.addComponent(newChartButton);
                }

            } catch (Exception e) {
                ManagerUI.error(e.getMessage());
            }

            dialogWindow.close();
        }
    });
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) dialogWindow.getContent();
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(wrapper);
    windowLayout.addComponent(buttonsBar);

}

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

License:Open Source License

/**
 * Instantiates a new backup scheduled layout.
 *///from  ww  w .  j  a  v a 2 s.  c  o m
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.SystemLayout.java

License:Open Source License

/**
 * Instantiates a new system layout./*from  w w w.  ja v  a  2 s.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.ErrorDialog.java

License:Open Source License

/**
 * Instantiates a new error dialog.//from  w  ww  .ja  v  a 2  s  . c  o  m
 *
 * @param e the exception
 * @param humanizedError the humanized error
 */
public ErrorDialog(Exception e, String humanizedError) {

    if (e != null) {
        ManagerUI.error(e.getMessage());
    }

    dialogWindow = new ModalWindow("An Error has occurred", "775px");
    dialogWindow.setHeight("340px");
    dialogWindow.addCloseListener(this);
    UI current = UI.getCurrent();
    if (current.getContent() == null) {
        current.setContent(new ErrorView(Notification.Type.ERROR_MESSAGE, null));
    }
    current.addWindow(dialogWindow);

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setSizeFull();
    wrapper.setMargin(true);

    VerticalLayout iconLayout = new VerticalLayout();
    iconLayout.setWidth("100px");
    wrapper.addComponent(iconLayout);
    Embedded image = new Embedded(null, new ThemeResource("img/error.png"));
    iconLayout.addComponent(image);

    VerticalLayout textLayout = new VerticalLayout();
    textLayout.setHeight("100%");
    textLayout.setSpacing(true);
    wrapper.addComponent(textLayout);
    wrapper.setExpandRatio(textLayout, 1.0f);

    if (humanizedError != null || e != null) {
        String error = (humanizedError != null) ? humanizedError : e.toString();
        ManagerUI.error(error);
        Label label = new Label(error, ContentMode.HTML);
        label.addStyleName("warning");
        textLayout.addComponent(label);
        textLayout.setComponentAlignment(label, Alignment.TOP_CENTER);
    }

    if (e != null) {
        TextArea stackTrace = new TextArea("Error Log");
        stackTrace.setSizeFull();
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        stackTrace.setValue(sw.toString());
        textLayout.addComponent(stackTrace);
        textLayout.setComponentAlignment(stackTrace, Alignment.TOP_LEFT);
        textLayout.setExpandRatio(stackTrace, 1.0f);
    }

    HorizontalLayout buttonsBar = new HorizontalLayout();
    buttonsBar.setStyleName("buttonsBar");
    buttonsBar.setSizeFull();
    buttonsBar.setSpacing(true);
    buttonsBar.setMargin(true);
    buttonsBar.setHeight("49px");

    Label filler = new Label();
    buttonsBar.addComponent(filler);
    buttonsBar.setExpandRatio(filler, 1.0f);

    Button cancelButton = new Button("Close");
    buttonsBar.addComponent(cancelButton);
    buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

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

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
            //UI.getCurrent().close();
        }
    });

    Button okButton = new Button("Send Error");
    okButton.setEnabled(false);
    okButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
        }
    });
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) dialogWindow.getContent();
    windowLayout.setHeight("100%");
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(wrapper);
    windowLayout.setExpandRatio(wrapper, 1.0f);
    windowLayout.addComponent(buttonsBar);

}