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.peergreen.webconsole.scope.home.FrameView.java

License:Open Source License

private HorizontalLayout createNavRow() {
    HorizontalLayout row = new HorizontalLayout();
    row.setSizeUndefined();//ww  w  .  j  a va2 s.  c  o m
    row.setWidth("100%");
    row.setSpacing(true);
    caption = new Label();
    caption.addStyleName("h4");
    row.addComponent(caption);
    row.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);
    HorizontalLayout buttons = new HorizontalLayout();
    previous = new Button("<");
    previous.addClickListener(new PreviousButtonClickListener());
    previous.setVisible(false);
    buttons.addComponent(previous);
    next = new Button(">");
    next.addClickListener(new NextButtonClickListener());
    next.setVisible(false);
    buttons.addComponent(next);
    row.addComponent(buttons);
    row.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
    return row;
}

From source file:com.peergreen.webconsole.scope.home.HomeScope.java

License:Open Source License

public HomeScope() {
    setSizeFull();//from w w  w. ja v  a2s . c o m
    addStyleName("dashboard-view");

    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setSpacing(true);
    addComponent(top);
    Label title = new Label("Welcome to Peergreen Administration Console");
    title.addStyleName("h1");
    top.addComponent(title);
    top.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    top.setExpandRatio(title, 1);

    HorizontalLayout row1 = new HorizontalLayout();
    row1.setSizeFull();
    row1.setMargin(new MarginInfo(true, true, true, true));
    row1.setSpacing(true);
    row1.addStyleName("row");
    addComponent(row1);
    setExpandRatio(row1, 4);

    HorizontalLayout row2 = new HorizontalLayout();
    row2.setSizeFull();
    row2.setMargin(new MarginInfo(true, true, true, true));
    row2.setSpacing(true);
    row2.addStyleName("row");
    addComponent(row2);
    setExpandRatio(row2, 4);

    topLeftFrame = new FrameView();
    row1.addComponent(topLeftFrame);

    topRightFrame = new FrameView();
    row1.addComponent(topRightFrame);

    bottomLeftFrame = new FrameView();
    row2.addComponent(bottomLeftFrame);

    bottomRightFrame = new FrameView();
    row2.addComponent(bottomRightFrame);
}

From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleTab.java

License:Open Source License

private void init() {

    setMargin(true);//from w  w  w  .j  a  v a 2s .  c  om
    setSpacing(true);

    // ----------------------------------------------------
    // Title
    // ----------------------------------------------------

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setMargin(true);

    Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(),
            getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion()));
    title.addStyleName("h1");
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    addComponent(header);

    // ----------------------------------------------------
    // Action(s) Bar
    // ----------------------------------------------------

    HorizontalLayout actions = new HorizontalLayout();
    if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) {
        Button changeState = new Button();
        changeState.addClickListener(new StartBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Start");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png"));
        actions.addComponent(changeState);
    }
    if (BundleHelper.isState(bundle, Bundle.ACTIVE)) {
        Button changeState = new Button();
        changeState.addClickListener(new StopBundleClickListener(bundle, notifierService));
        //changeState.addStyleName("no-padding");
        changeState.setCaption("Stop");
        changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png"));
        actions.addComponent(changeState);
    }

    // Update
    Button update = new Button();
    update.addClickListener(new UpdateBundleClickListener(bundle, notifierService));
    //update.addStyleName("no-padding");
    update.setCaption("Update");
    update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png"));
    actions.addComponent(update);

    // Trash
    Button trash = new Button();
    trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService));
    //trash.addStyleName("no-padding");
    trash.setCaption("Remove");
    trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png"));
    actions.addComponent(trash);
    addComponent(actions);
    setComponentAlignment(actions, Alignment.MIDDLE_RIGHT);

    // ----------------------------------------------------
    // Standard Section
    // ----------------------------------------------------

    Table table = new Table();
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setWidth("100%");

    Section mainSection = new Section("Standard", table);
    addComponent(mainSection);

    table.addContainerProperty("label", Label.class, null);
    table.addContainerProperty("value", Label.class, null);

    table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) },
            "bundle.id");
    for (Map.Entry<String, String> entry : HEADERS.entrySet()) {
        String value = getHeader(bundle, entry.getKey());
        if (value != null) {
            table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey());
        }
    }
    table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location");
    Date date = new Date(bundle.getLastModified());
    table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified");

    // ----------------------------------------------------
    // Packages Section
    // ----------------------------------------------------

    FilteredPackageTable exported = new FilteredPackageTable("Exported");

    FilteredPackageTable imported = new FilteredPackageTable("Imported");

    GridLayout packages = new GridLayout(2, 1);
    packages.addComponent(exported);
    packages.addComponent(imported);
    packages.setSpacing(true);
    packages.setWidth("100%");

    Section packagesSection = new Section("Packages", packages);
    addComponent(packagesSection);

    BundleWiring wiring = bundle.adapt(BundleWiring.class);
    if (wiring != null) {
        for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) {
            String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE);
            Version version = (Version) capability.getAttributes()
                    .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE);
            exported.addPackage(format("%s (%s)", name, version));
        }
        for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) {
            String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE);
            imported.addPackage(filter);
        }
    }

    // ----------------------------------------------------
    // Services Section
    // ----------------------------------------------------

    FilteredServiceTable registered = new FilteredServiceTable("Registered");

    FilteredServiceTable used = new FilteredServiceTable("Used Services");

    VerticalLayout services = new VerticalLayout(registered, used);
    services.setSpacing(true);
    services.setWidth("100%");

    ServiceReference<?>[] registeredServices = bundle.getRegisteredServices();
    if (registeredServices != null) {
        for (ServiceReference<?> reference : registeredServices) {
            registered.addService(reference);
        }
    }

    ServiceReference<?>[] inUseServices = bundle.getServicesInUse();
    if (inUseServices != null) {
        for (ServiceReference<?> reference : inUseServices) {
            used.addService(reference);
        }
    }

    if (!registered.isEmpty() || !used.isEmpty()) {
        Section servicesSection = new Section("Services", services);
        addComponent(servicesSection);
    }

    // ----------------------------------------------------
    // Raw Manifest Section
    // ----------------------------------------------------

    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".monospaced-font {font-family: monospace !important; }");

    Table manifest = new Table();
    manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    manifest.setWidth("100%");
    manifest.addStyleName("monospaced-font");
    manifest.setPageLength(15);
    manifest.addContainerProperty("name", String.class, null);
    manifest.addContainerProperty("value", String.class, null);

    Dictionary<String, String> headers = bundle.getHeaders();
    for (String key : Collections.list(headers.keys())) {
        manifest.addItem(new Object[] { key, headers.get(key) }, null);
    }

    Section manifestSection = new Section("Manifest", manifest);
    addComponent(manifestSection);

}

From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleView.java

License:Open Source License

@PostConstruct
public void createView() {
    setMargin(true);/*from   w ww . j a  va2 s  .  c  o  m*/
    setSpacing(true);

    /*
    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".no-padding {padding: 0em 0em 0em 0em !important; }");
    */

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

    Label title = new Label("OSGi Bundles");
    title.addStyleName("h1");
    //        title.setSizeUndefined();
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    final TextField filter = new TextField();
    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            data.removeAllContainerFilters();
            String trimmed = event.getText().trim();
            Container.Filter or = new Or(new SimpleStringFilter(BUNDLE_ID_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(BUNDLE_NAME_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(BUNDLE_SYMBOLICNAME_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(VERSION_COLUMN, trimmed, true, false),
                    new SimpleStringFilter(PRETTY_STATE_COLUMN, trimmed, true, false));

            data.addContainerFilter(or);
        }
    });

    filter.setInputPrompt("Filter");
    filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            filter.setValue("");
            data.removeAllContainerFilters();
        }
    });
    header.addComponent(filter);
    header.setExpandRatio(filter, 1);
    header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);

    // Store the header in the vertical layout (this)
    addComponent(header);

    addComponent(tabSheet);

    table = new Table();
    table.setContainerDataSource(data);
    table.setSizeFull();
    table.setSortContainerPropertyId(BUNDLE_ID_COLUMN);
    table.setSortAscending(true);
    table.setImmediate(true);
    table.setColumnHeader(BUNDLE_ID_COLUMN, "Bundle ID");
    table.setColumnHeader(PRETTY_NAME_COLUMN, "Bundle Name");
    table.setColumnHeader(VERSION_COLUMN, "Version");
    table.setColumnHeader(PRETTY_STATE_COLUMN, "State");
    table.setColumnHeader("actions", "Actions");

    table.setColumnWidth(BUNDLE_ID_COLUMN, 100);

    table.setColumnAlignment(BUNDLE_ID_COLUMN, Table.Align.CENTER);
    table.setColumnAlignment(PRETTY_STATE_COLUMN, Table.Align.CENTER);
    table.setColumnAlignment(VERSION_COLUMN, Table.Align.CENTER);

    table.addGeneratedColumn("actions", new Table.ColumnGenerator() {
        @Override
        public Object generateCell(final Table source, final Object itemId, final Object columnId) {
            HorizontalLayout layout = new HorizontalLayout();
            BeanItem<BundleItem> item = (BeanItem<BundleItem>) source.getContainerDataSource().getItem(itemId);
            Bundle bundle = item.getBean().getBundle();
            if (BundleHelper.isState(bundle, Bundle.INSTALLED)
                    || BundleHelper.isState(bundle, Bundle.RESOLVED)) {
                Button changeState = new Button();
                changeState.addClickListener(new StartBundleClickListener(bundle, notifierService));
                //changeState.addStyleName("no-padding");
                changeState.setCaption("Start");
                //changeState.setIcon(new ClassResource(BundleViewer.class, "/images/go-next.png"));
                if (!securityManager.isUserInRole("admin")) {
                    changeState.setDisableOnClick(true);
                }
                layout.addComponent(changeState);
            }
            if (BundleHelper.isState(bundle, Bundle.ACTIVE)) {
                Button changeState = new Button();
                changeState.addClickListener(new StopBundleClickListener(bundle, notifierService));
                //changeState.addStyleName("no-padding");
                changeState.setCaption("Stop");
                if (!securityManager.isUserInRole("admin")) {
                    changeState.setDisableOnClick(true);
                }
                //changeState.setIcon(new ClassResource(BundleViewer.class, "/images/media-record.png"));
                layout.addComponent(changeState);
            }

            // Update
            Button update = new Button();
            update.addClickListener(new UpdateBundleClickListener(bundle, notifierService));
            //update.addStyleName("no-padding");
            update.setCaption("Update");
            if (!securityManager.isUserInRole("admin")) {
                update.setDisableOnClick(true);
            }
            //update.setIcon(new ClassResource(BundleViewer.class, "/images/view-refresh.png"));
            layout.addComponent(update);

            // Trash
            Button trash = new Button();
            trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService));
            //trash.addStyleName("no-padding");
            trash.setCaption("Delete");
            if (!securityManager.isUserInRole("admin")) {
                trash.setDisableOnClick(true);
            }
            //trash.setIcon(new ClassResource(BundleViewer.class, "/images/user-trash-full.png"));
            layout.addComponent(trash);

            return layout;
        }
    });

    table.setVisibleColumns(BUNDLE_ID_COLUMN, PRETTY_NAME_COLUMN, VERSION_COLUMN, PRETTY_STATE_COLUMN,
            "actions");

    table.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(final ItemClickEvent event) {
            if (event.isDoubleClick()) {
                BeanItem<BundleItem> item = (BeanItem<BundleItem>) table.getContainerDataSource()
                        .getItem(event.getItemId());
                Bundle bundle = item.getBean().getBundle();
                showBundle(bundle);
            }
        }
    });

    createBundleTracker();

    tabSheet.setSizeFull();
    selectedTabListener = new SelectedTabListener(uiContext.getViewNavigator());
    selectedTabListener.addLocation(table, uiContext.getViewNavigator().getLocation(this.getClass().getName()));
    tabSheet.addSelectedTabChangeListener(selectedTabListener);
    tabSheet.addTab(table, "Bundles", new ClassResource(BundleView.class, "/images/22x22/user-home.png"));
    setExpandRatio(tabSheet, 1.5f);

    tabSheet.setCloseHandler(new TabSheet.CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {
            for (Map.Entry<Long, Component> tab : openTabs.entrySet()) {
                if (tabContent.equals(tab.getValue())) {
                    openTabs.remove(tab.getKey());
                }
            }
            tabsheet.removeComponent(tabContent);
            selectedTabListener.removeLocation(tabContent);
        }
    });
}

From source file:com.peergreen.webconsole.scope.system.internal.bundle.ui.FilteredPackageTable.java

License:Open Source License

public FilteredPackageTable(final String label) {
    this.label = label;

    title = new Label(label);
    title.addStyleName("h3");

    filter = new TextField();
    filter.setInputPrompt("filter...");

    header.addComponent(title);/*from   w w w.  j  av  a2 s.  c o m*/
    header.addComponent(filter);
    header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    header.setSpacing(true);

    data.addContainerProperty(DESCRIPTION, String.class, "aaa");

    table = new Table();
    table.setPageLength(DEFAULT_PAGE_LENGTH);
    table.setWidth("100%");
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setContainerDataSource(data);

    addComponent(header);
    addComponent(table);

    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            data.removeAllContainerFilters();
            data.addContainerFilter(new SimpleStringFilter(DESCRIPTION, event.getText().trim(), true, false));
        }
    });
    filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            filter.setValue("");
            data.removeAllContainerFilters();
        }
    });

}

From source file:com.peergreen.webconsole.scope.system.internal.bundle.ui.FilteredServiceTable.java

License:Open Source License

public FilteredServiceTable(final String label) {
    this.label = label;

    title = new Label(label);
    title.addStyleName("h3");

    filter = new TextField();
    filter.setInputPrompt("filter...");

    header.addComponent(title);/*from  w  ww .j a  va 2s  .c o m*/
    header.addComponent(filter);
    header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    header.setSpacing(true);

    data.addContainerProperty(SERVICE_ID, String.class, "");
    data.addContainerProperty(SERVICE_DETAILS, Label.class, null);

    table = new Table();
    table.setPageLength(DEFAULT_PAGE_LENGTH);
    table.setWidth("100%");
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setContainerDataSource(data);

    addComponent(header);
    addComponent(table);

    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            data.removeAllContainerFilters();
            data.addContainerFilter(
                    new SimpleStringFilter(SERVICE_DETAILS, event.getText().trim(), true, false));
        }
    });
    filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            filter.setValue("");
            data.removeAllContainerFilters();
        }
    });

}

From source file:com.peergreen.webconsole.scope.system.internal.service.ServiceViewer.java

License:Open Source License

private void initHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setSpacing(true);//from  ww  w  .j  av a 2s. c  o  m
    header.setMargin(true);

    Label title = new Label("OSGi Services");
    title.addStyleName("h1");
    title.setSizeUndefined();
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    final TextField filter = new TextField();
    filter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            data.removeAllContainerFilters();
            String trimmed = event.getText().trim();
            Container.Filter or = new Or(new SimpleStringFilter(SERVICE_ID_COLUMN, trimmed, true, false),
                    new InterfacesFilter(trimmed), new BundleFilter(trimmed),
                    new ServicePropertiesFilter(trimmed));

            data.addContainerFilter(or);
        }
    });

    filter.setInputPrompt("Filter");
    filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            filter.setValue("");
            data.removeAllContainerFilters();
        }
    });
    header.addComponent(filter);
    header.setExpandRatio(filter, 1);
    header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);

    // Store the header in the vertical layout (this)
    addComponent(header);
}

From source file:com.peergreen.webconsole.scope.system.internal.shell.ShellConsoleView.java

License:Open Source License

private void initHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setSpacing(true);// ww w  .  j a v a2 s  .  co m
    header.setMargin(true);

    Label title = new Label("Shell Console");
    title.addStyleName("h1");
    title.setSizeUndefined();
    header.addComponent(title);
    header.setComponentAlignment(title, Alignment.MIDDLE_LEFT);

    // Store the header in the vertical layout (this)
    addComponent(header);
}

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  w w w .  j a v a 2s .  c  o  m
                });
                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.pms.component.ganttchart.DemoUI.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);/*w w w. ja  va  2  s. c  o m*/
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    controls.addComponent(localeSelect);
    controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    controls.addComponent(createStep);
    controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);

    return panel;
}