Example usage for com.vaadin.ui Button setDescription

List of usage examples for com.vaadin.ui Button setDescription

Introduction

In this page you can find the example usage for com.vaadin.ui Button setDescription.

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

From source file:com.esofthead.mycollab.vaadin.ui.DefaultMassItemActionHandlersContainer.java

License:Open Source License

public void addActionItem(final String id, Resource resource, String groupId, String description) {
    ButtonGroup group = groupMap.get(groupId);

    if (group == null) {
        group = new ButtonGroup();
        groupMap.put(groupId, group);//from   ww  w . j a v  a2s.c om

        this.addComponent(group);
    }

    Button optionBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            changeOption(id);
        }
    });
    optionBtn.setIcon(resource);
    if ("delete".equals(groupId)) {
        optionBtn.addStyleName(UIConstants.THEME_RED_LINK);
    } else {
        optionBtn.addStyleName(UIConstants.THEME_BLUE_LINK);
    }
    optionBtn.addStyleName("small-padding");
    optionBtn.setDescription(description);

    group.addButton(optionBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.DefaultMassItemActionHandlersContainer.java

License:Open Source License

public void addDownloadActionItem(final String id, Resource resource, String groupId, String downloadFileName,
        String description) {//from w  w  w.  j a v  a2s .c  om
    ButtonGroup group = groupMap.get(groupId);

    if (group == null) {
        group = new ButtonGroup();
        groupMap.put(groupId, group);
        this.addComponent(group);
    }

    Button optionBtn = new Button("");
    FileDownloader fileDownler = new FileDownloader(
            new StreamResource(new LazyStreamSource(id), downloadFileName));
    fileDownler.extend(optionBtn);
    optionBtn.setIcon(resource);
    optionBtn.addStyleName(UIConstants.THEME_BLUE_LINK);
    optionBtn.addStyleName("small-padding");
    optionBtn.setDescription(description);
    group.addButton(optionBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.ProjectPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) {

    Button optionParentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override//from w  ww  .  j  av  a 2s. com
                public void buttonClick(ClickEvent event) {
                    optionBtn.setPopupVisible(true);
                }
            });

    optionBtn = new SplitButton(optionParentBtn);
    optionBtn.setWidthUndefined();
    optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK);

    if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                optionBtn.setPopupVisible(false);
                final T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }
        });
        addBtn.setIcon(FontAwesome.PLUS);
        addBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(addBtn);
        editButtons.setComponentAlignment(addBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                optionBtn.setPopupVisible(false);
                final T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }
        });
        editBtn.setIcon(FontAwesome.EDIT);
        editBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(editBtn);
        editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireDeleteForm(item);
            }
        });
        deleteBtn.setIcon(FontAwesome.TRASH_O);
        deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
        editButtons.addComponent(deleteBtn);
        editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
        assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireAssignForm(item);
            }
        });
        assignBtn.setIcon(FontAwesome.SHARE_SQUARE_O);
        assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(assignBtn, 0);

    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                optionBtn.setPopupVisible(false);
                final T item = previewForm.getBean();
                previewForm.fireCloneForm(item);
            }
        });
        cloneBtn.setIcon(FontAwesome.ROAD);
        cloneBtn.setStyleName("link");
        popupButtonsControl.addComponent(cloneBtn);
    }

    if (popupButtonsControl.getComponentCount() > 0) {
        optionBtn.setContent(popupButtonsControl);
        editButtons.addComponent(optionBtn);
        editButtons.setComponentAlignment(optionBtn, Alignment.MIDDLE_CENTER);
    }

    layout.addComponent(editButtons);
    layout.setComponentAlignment(editButtons, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(editButtons, 1.0f);

    if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
        ButtonGroup navigationBtns = new ButtonGroup();
        navigationBtns.setStyleName("navigation-btns");
        Button previousItem = new Button("<", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }
        });

        previousItem.setStyleName(UIConstants.THEME_GREEN_LINK);
        previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
        navigationBtns.addButton(previousItem);

        Button nextItemBtn = new Button(">", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }
        });

        nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));

        navigationBtns.addButton(nextItemBtn);
        layout.addComponent(navigationBtns);
        layout.setComponentAlignment(navigationBtns, Alignment.MIDDLE_RIGHT);
    }

    if (permissionItem != null) {
        final boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        final boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);

        if (assignBtn != null) {
            assignBtn.setEnabled(canWrite);
        }

        if (addBtn != null) {
            addBtn.setEnabled(canWrite);
        }

        if (editBtn != null) {
            editBtn.setEnabled(canWrite);
        }

        if (cloneBtn != null) {
            cloneBtn.setEnabled(canWrite);
        }

        if (deleteBtn != null) {
            deleteBtn.setEnabled(canAccess);
        }
    }
    return layout;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.OptionPopupContent.java

License:Open Source License

public void addOption(Button btn) {
    CssLayout wrap = new CssLayout();
    btn.setWidth("100%");
    btn.setDescription(btn.getCaption());
    btn.addStyleName("action");
    wrap.addStyleName("action-wrap");
    wrap.addComponent(btn);// w ww  .ja v  a 2 s.co  m
    ((ComponentContainer) this.getCompositionRoot()).addComponent(wrap);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.ProjectPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(UIConstants.BOX);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
        boolean canRead = CurrentProjectVariables.canRead(permissionItem);

        if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
            Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireAssignForm(item);
                        }//from   w w  w.j av  a  2 s .  c o  m
                    });
            assignBtn.setIcon(FontAwesome.SHARE);
            assignBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editButtons.addComponent(assignBtn);
            assignBtn.setEnabled(canWrite);
        }

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireAddForm(item);
                        }
                    });
            addBtn.setIcon(FontAwesome.PLUS);
            addBtn.setStyleName(UIConstants.BUTTON_ACTION);
            addBtn.setEnabled(canWrite);
            editButtons.addComponent(addBtn);
        }

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireEditForm(item);
                        }
                    });
            editBtn.setIcon(FontAwesome.EDIT);
            editBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editBtn.setEnabled(canWrite);
            editButtons.addComponent(editBtn);
        }

        if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireDeleteForm(item);
                        }
                    });
            deleteBtn.setIcon(FontAwesome.TRASH_O);
            deleteBtn.setStyleName(UIConstants.BUTTON_DANGER);
            deleteBtn.setEnabled(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
            final PrintButton printBtn = new PrintButton();
            printBtn.addClickListener(new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.firePrintForm(printBtn, item);
                }
            });
            printBtn.setStyleName(UIConstants.BUTTON_OPTION);
            printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_PRINT));
            printBtn.setEnabled(canRead);
            editButtons.addComponent(printBtn);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireCloneForm(item);
                        }
                    });
            cloneBtn.setIcon(FontAwesome.ROAD);
            cloneBtn.setEnabled(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            Button previousItem = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoPrevious(item);
                }
            });
            previousItem.setIcon(FontAwesome.CHEVRON_LEFT);
            previousItem.setCaptionAsHtml(true);
            previousItem.setStyleName(UIConstants.BUTTON_OPTION);
            previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
            previousItem.setEnabled(canRead);
            navigationBtns.addButton(previousItem);

            Button nextItemBtn = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoNextItem(item);
                }
            });
            nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT);
            nextItemBtn.setStyleName(UIConstants.BUTTON_OPTION);
            nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
            nextItemBtn.setEnabled(canRead);
            navigationBtns.addButton(nextItemBtn);

            layout.addComponent(navigationBtns);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.addComponent(optionBtn);
        }
    }

    return layout;
}

From source file:com.esspl.datagen.DataGenApplication.java

License:Open Source License

private void buildMainLayout() {
    log.debug("DataGenApplication - buildMainLayout() start");
    VerticalLayout rootLayout = new VerticalLayout();
    final Window root = new Window("DATA Gen", rootLayout);
    root.setStyleName("tData");

    setMainWindow(root);// w w w  .j a  v  a  2 s . co m

    rootLayout.setSizeFull();
    rootLayout.setMargin(false, true, false, true);

    // Top area, containing logo and header
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    root.addComponent(top);

    // Create the placeholders for all the components in the top area
    HorizontalLayout header = new HorizontalLayout();

    // Add the components and align them properly
    top.addComponent(header);
    top.setComponentAlignment(header, Alignment.TOP_LEFT);

    top.setStyleName("top");
    top.setHeight("75px"); // Same as the background image height

    // header controls
    Embedded logo = new Embedded();
    logo.setSource(DataGenConstant.LOGO);
    logo.setWidth("100%");
    logo.setStyleName("logo");
    header.addComponent(logo);
    header.setSpacing(false);

    //Show which connection profile is connected
    connectedString = new Label("Connected to - Oracle");
    connectedString.setStyleName("connectedString");
    connectedString.setWidth("500px");
    connectedString.setVisible(false);
    top.addComponent(connectedString);

    //Toolbar
    toolbar = new ToolBar(this);
    top.addComponent(toolbar);
    top.setComponentAlignment(toolbar, Alignment.TOP_RIGHT);

    listing = new Table();
    listing.setHeight("240px");
    listing.setWidth("100%");
    listing.setStyleName("dataTable");
    listing.setImmediate(true);

    // turn on column reordering and collapsing
    listing.setColumnReorderingAllowed(true);
    listing.setColumnCollapsingAllowed(true);
    listing.setSortDisabled(true);

    // Add the table headers
    listing.addContainerProperty("Sl No.", Integer.class, null);
    listing.addContainerProperty("Column Name", TextField.class, null);
    listing.addContainerProperty("Data Type", Select.class, null);
    listing.addContainerProperty("Format", Select.class, null);
    listing.addContainerProperty("Examples", Label.class, null);
    listing.addContainerProperty("Additional Data", HorizontalLayout.class, null);
    listing.setColumnAlignments(new String[] { Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER,
            Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER });

    //From the starting create 5 rows
    addRow(5);

    //Add different style for IE browser
    WebApplicationContext context = ((WebApplicationContext) getMainWindow().getApplication().getContext());
    WebBrowser browser = context.getBrowser();

    //Create a TabSheet
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    if (!browser.isIE()) {
        tabSheet.setStyleName("tabSheet");
    }

    //Generator Tab content start
    generator = new VerticalLayout();
    generator.setMargin(true, true, false, true);

    generateTypeHl = new HorizontalLayout();
    generateTypeHl.setMargin(false, false, false, true);
    generateTypeHl.setSpacing(true);
    List<String> generateTypeList = Arrays.asList(new String[] { "Sql", "Excel", "XML", "CSV" });
    generateType = new OptionGroup("Generation Type", generateTypeList);
    generateType.setNullSelectionAllowed(false); // user can not 'unselect'
    generateType.select("Sql"); // select this by default
    generateType.setImmediate(true); // send the change to the server at once
    generateType.addListener(this); // react when the user selects something
    generateTypeHl.addComponent(generateType);

    //SQL Options
    sqlPanel = new Panel("SQL Options");
    sqlPanel.setHeight("180px");
    if (browser.isIE()) {
        sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }
    VerticalLayout vl1 = new VerticalLayout();
    vl1.setMargin(false);
    Label lb1 = new Label("DataBase");
    database = new Select();
    database.addItem("Oracle");
    database.addItem("Sql Server");
    database.addItem("My Sql");
    database.addItem("Postgress Sql");
    database.addItem("H2");
    database.select("Oracle");
    database.setWidth("160px");
    database.setNullSelectionAllowed(false);
    HorizontalLayout dbBar = new HorizontalLayout();
    dbBar.setMargin(false, false, false, false);
    dbBar.setSpacing(true);
    dbBar.addComponent(lb1);
    dbBar.addComponent(database);
    vl1.addComponent(dbBar);

    Label tblLabel = new Label("Table Name");
    tblName = new TextField();
    tblName.setWidth("145px");
    tblName.setStyleName("mandatory");
    HorizontalLayout tableBar = new HorizontalLayout();
    tableBar.setMargin(true, false, false, false);
    tableBar.setSpacing(true);
    tableBar.addComponent(tblLabel);
    tableBar.addComponent(tblName);
    vl1.addComponent(tableBar);

    createQuery = new CheckBox("Include CREATE TABLE query");
    createQuery.setValue(true);
    HorizontalLayout createBar = new HorizontalLayout();
    createBar.setMargin(true, false, false, false);
    createBar.addComponent(createQuery);
    vl1.addComponent(createBar);
    sqlPanel.addComponent(vl1);

    generateTypeHl.addComponent(sqlPanel);
    generator.addComponent(generateTypeHl);

    //CSV Option
    csvPanel = new Panel("CSV Options");
    csvPanel.setHeight("130px");
    if (browser.isIE()) {
        csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }
    Label delimiter = new Label("Delimiter Character(s)");
    VerticalLayout vl2 = new VerticalLayout();
    vl2.setMargin(false);
    csvDelimiter = new TextField();
    HorizontalLayout csvBar = new HorizontalLayout();
    csvBar.setMargin(true, false, false, false);
    csvBar.setSpacing(true);
    csvBar.addComponent(delimiter);
    csvBar.addComponent(csvDelimiter);
    vl2.addComponent(csvBar);
    csvPanel.addComponent(vl2);

    //XML Options
    xmlPanel = new Panel("XML Options");
    xmlPanel.setHeight("160px");
    if (browser.isIE()) {
        xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }

    VerticalLayout vl3 = new VerticalLayout();
    vl3.setMargin(false);
    Label lb4 = new Label("Root node name");
    rootNode = new TextField();
    rootNode.setWidth("125px");
    rootNode.setStyleName("mandatory");
    HorizontalLayout nodeBar = new HorizontalLayout();
    nodeBar.setMargin(true, false, false, false);
    nodeBar.setSpacing(true);
    nodeBar.addComponent(lb4);
    nodeBar.addComponent(rootNode);
    vl3.addComponent(nodeBar);

    Label lb5 = new Label("Record node name");
    recordNode = new TextField();
    recordNode.setWidth("112px");
    recordNode.setStyleName("mandatory");
    HorizontalLayout recordBar = new HorizontalLayout();
    recordBar.setMargin(true, false, false, false);
    recordBar.setSpacing(true);
    recordBar.addComponent(lb5);
    recordBar.addComponent(recordNode);
    vl3.addComponent(recordBar);
    xmlPanel.addComponent(vl3);

    HorizontalLayout noOfRowHl = new HorizontalLayout();
    noOfRowHl.setSpacing(true);
    noOfRowHl.setMargin(true, false, false, true);
    noOfRowHl.addComponent(new Label("Number of Results"));
    resultNum = new TextField();
    resultNum.setImmediate(true);
    resultNum.setNullSettingAllowed(false);
    resultNum.setStyleName("mandatory");
    resultNum.addValidator(new IntegerValidator("Number of Results must be an Integer"));
    resultNum.setWidth("5em");
    resultNum.setMaxLength(5);
    resultNum.setValue(50);
    noOfRowHl.addComponent(resultNum);
    generator.addComponent(noOfRowHl);

    HorizontalLayout addRowHl = new HorizontalLayout();
    addRowHl.setMargin(true, false, true, true);
    addRowHl.setSpacing(true);
    addRowHl.addComponent(new Label("Add"));
    rowNum = new TextField();
    rowNum.setImmediate(true);
    rowNum.setNullSettingAllowed(true);
    rowNum.addValidator(new IntegerValidator("Row number must be an Integer"));
    rowNum.setWidth("4em");
    rowNum.setMaxLength(2);
    rowNum.setValue(1);
    addRowHl.addComponent(rowNum);
    rowsBttn = new Button("Row(s)");
    rowsBttn.setIcon(DataGenConstant.ADD);
    rowsBttn.addListener(ClickEvent.class, this, "addRowButtonClick"); // react to clicks
    addRowHl.addComponent(rowsBttn);
    generator.addComponent(addRowHl);

    //Add the Grid
    generator.addComponent(listing);

    //Generate Button
    Button bttn = new Button("Generate");
    bttn.setDescription("Generate Gata");
    bttn.addListener(ClickEvent.class, this, "generateButtonClick"); // react to clicks
    bttn.setIcon(DataGenConstant.VIEW);
    bttn.setStyleName("generate");
    generator.addComponent(bttn);
    //Generator Tab content end

    //Executer Tab content start - new class created to separate execution logic
    executor = new ExecutorView(this);
    //Executer Tab content end

    //Explorer Tab content start - new class created to separate execution logic
    explorer = new ExplorerView(this, databaseSessionManager);
    //explorer.setMargin(true);
    //Explorer Tab content end

    //About Tab content start
    VerticalLayout about = new VerticalLayout();
    about.setMargin(true);
    Label aboutRichText = new Label(DataGenConstant.ABOUT_CONTENT);
    aboutRichText.setContentMode(Label.CONTENT_XHTML);
    about.addComponent(aboutRichText);
    //About Tab content end

    //Help Tab content start
    VerticalLayout help = new VerticalLayout();
    help.setMargin(true);
    Label helpText = new Label(DataGenConstant.HELP_CONTENT);
    helpText.setContentMode(Label.CONTENT_XHTML);
    help.addComponent(helpText);

    Embedded helpScreen = new Embedded();
    helpScreen.setSource(DataGenConstant.HELP_SCREEN);
    help.addComponent(helpScreen);

    Label helpStepsText = new Label(DataGenConstant.HELP_CONTENT_STEPS);
    helpStepsText.setContentMode(Label.CONTENT_XHTML);
    help.addComponent(helpStepsText);
    //Help Tab content end

    //Add the respective contents to the tab sheet
    tabSheet.addTab(generator, "Generator", DataGenConstant.HOME_ICON);
    executorTab = tabSheet.addTab(executor, "Executor", DataGenConstant.EXECUTOR_ICON);
    explorerTab = tabSheet.addTab(explorer, "Explorer", DataGenConstant.EXPLORER_ICON);
    tabSheet.addTab(about, "About", DataGenConstant.ABOUT_ICON);
    tabSheet.addTab(help, "Help", DataGenConstant.HELP_ICON);

    HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();
    content.addComponent(tabSheet);

    rootLayout.addComponent(content);
    rootLayout.setExpandRatio(content, 1);
    log.debug("DataGenApplication - buildMainLayout() end");
}

From source file:com.esspl.datagen.ui.ExecutorView.java

License:Open Source License

public ExecutorView(DataGenApplication application) {
    log.debug("ExecutorView - constructor start");
    dataGenApplication = application;/*from w w w.  j a va 2  s.co  m*/
    setSizeFull();

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    setCompositionRoot(vl);

    splitPanel = new VerticalSplitPanel();
    splitPanel.setSizeFull();

    //Script TextArea
    sqlScript = new TextArea();
    sqlScript.setSizeFull();
    sqlScript.setWordwrap(false);
    sqlScript.setStyleName("noResizeTextArea");

    HorizontalLayout queryOptions = new HorizontalLayout();
    queryOptions.setMargin(false, false, false, true);
    queryOptions.setSpacing(true);
    queryOptions.setWidth("100%");
    queryOptions.setHeight("40px");

    Button executeButton = new Button("Execute", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Execute Button clicked");
            executeScript(sqlScript.getValue().toString());
        }
    });
    executeButton.addStyleName("small");
    executeButton.setIcon(DataGenConstant.EXECUTOR_ICON);
    executeButton.setDescription("Press Ctrl+Enter to execute the query");

    Button clearQueryButton = new Button("Clear SQL", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Clear SQL Button clicked");
            sqlScript.setValue("");
        }
    });
    clearQueryButton.addStyleName("small");
    clearQueryButton.setIcon(DataGenConstant.CLEAR_SMALL);
    clearQueryButton.setDescription("Clears the Sql");

    Button clearConsoleButton = new Button("Clear Console", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            log.info("ExecutorView - Clear Console Button clicked");
            logText.setValue("");
        }
    });
    clearConsoleButton.addStyleName("small");
    clearConsoleButton.setIcon(DataGenConstant.CLEAR_SMALL);
    clearConsoleButton.setDescription("Clears the Console");

    maxRowsBox = new ComboBox(null, Arrays.asList(10, 100, 500, 1000, 5000, 10000));
    maxRowsBox.setDescription("Max number of rows to retrieve");
    maxRowsBox.setWidth(100, UNITS_PIXELS);
    maxRowsBox.setNewItemsAllowed(false);
    maxRowsBox.setNullSelectionAllowed(false);
    maxRowsBox.setValue(100);

    //Bottom section components
    resultSheet = new TabSheet();
    resultSheet.setSizeFull();
    resultSheet.addStyleName(Runo.TABSHEET_SMALL);

    logText = new Label();
    logText.setContentMode(Label.CONTENT_XHTML);
    logText.setSizeFull();

    //Panel to add refresher
    logPanel = new Panel();
    logPanel.setSizeFull();
    logPanel.setScrollable(true);
    logPanel.setStyleName(Runo.PANEL_LIGHT);
    logPanel.addComponent(logText);

    //Refresher added to show instant log messages
    refresher = new Refresher();
    logPanel.addComponent(refresher);

    //Loading image
    loadingImg = new Embedded("", DataGenConstant.LOADING_ICON);
    loadingImg.setVisible(false);
    logPanel.addComponent(loadingImg);

    resultSheet.addTab(logPanel, "Console");
    resultTab = resultSheet.addTab(new Label(), "Results");

    queryOptions.addComponent(executeButton);
    queryOptions.setComponentAlignment(executeButton, Alignment.MIDDLE_LEFT);
    queryOptions.addComponent(clearQueryButton);
    queryOptions.setComponentAlignment(clearQueryButton, Alignment.MIDDLE_LEFT);
    queryOptions.addComponent(clearConsoleButton);
    queryOptions.setComponentAlignment(clearConsoleButton, Alignment.MIDDLE_LEFT);
    queryOptions.setExpandRatio(clearConsoleButton, 1);
    queryOptions.addComponent(maxRowsBox);
    queryOptions.setComponentAlignment(maxRowsBox, Alignment.MIDDLE_RIGHT);

    splitPanel.setFirstComponent(sqlScript);
    splitPanel.setSecondComponent(resultSheet);

    vl.addComponent(queryOptions);
    vl.addComponent(splitPanel);
    vl.setExpandRatio(splitPanel, 1);

    sqlScript.addShortcutListener(new ShortcutListener("Execute Script", null, ShortcutAction.KeyCode.ENTER,
            ShortcutAction.ModifierKey.CTRL) {

        @Override
        public void handleAction(Object sender, Object target) {
            executeScript(sqlScript.getValue().toString());
        }
    });
    log.debug("ExecutorView - constructor end");
}

From source file:com.expressui.core.view.export.ExportForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);//from  w  w w.ja v a 2 s .  c  o  m
    footerLayout.setMargin(true);

    Button closeButton = new Button(uiMessageSource.getMessage("exportForm.close"), this, "close");
    closeButton.setDescription(uiMessageSource.getToolTip("exportForm.close.toolTip"));
    closeButton.setIcon(new ThemeResource("../expressui/icons/16/delete.png"));
    closeButton.addStyleName("small default");
    footerLayout.addComponent(closeButton);

    exportButton = new Button(uiMessageSource.getMessage("exportForm.export"));
    exportButton.setDescription(uiMessageSource.getToolTip("exportForm.export.toolTip"));
    exportButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp"));
    exportButton.addStyleName("small default");
    footerLayout.addComponent(exportButton);
}

From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout");
    navigationFormLayout.setDebugId(id);
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout");
    previousButtonLayout.setDebugId(id);

    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();/*from   w  w w .  j  a  v a2  s  .  co m*/
    previousButtonLayout.addComponent(spaceLabel);

    Button previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout,
                "previousButtonHorizontalLayout");
        previousButtonHorizontalLayout.setDebugId(id);
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout");
    nextButtonLayout.setDebugId(id);
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    Button nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout");
    nextButtonHorizontalLayout.setDebugId(id);
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.expressui.core.view.form.SearchForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);/* w w  w.j  a v  a  2  s  . c  o  m*/
    footerLayout.setMargin(true);

    Button clearButton = new Button(uiMessageSource.getMessage("searchForm.clear"), this, "clear");
    clearButton.setDescription(uiMessageSource.getToolTip("searchForm.clear.toolTip"));
    clearButton.setIcon(new ThemeResource("../expressui/icons/16/clear.png"));
    clearButton.addStyleName("small default");
    footerLayout.addComponent(clearButton);

    Button searchButton = new Button(uiMessageSource.getMessage("searchForm.search"), this, "search");
    searchButton.setDescription(uiMessageSource.getToolTip("searchForm.search.toolTip"));
    searchButton.setIcon(new ThemeResource("../expressui/icons/16/search.png"));
    searchButton.addStyleName("small default");
    footerLayout.addComponent(searchButton);
}