Example usage for com.vaadin.ui TabSheet TabSheet

List of usage examples for com.vaadin.ui TabSheet TabSheet

Introduction

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

Prototype

public TabSheet() 

Source Link

Document

Constructs a new TabSheet.

Usage

From source file:com.dungnv.streetfood.view.DishLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());

    VerticalLayout vLayout = new VerticalLayout();

    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();//from w  w  w . java 2 s. co  m
    vLayout.addComponent(tabSheet);

    // CategoryDish
    tuiCategory = new TwinColumnUI("name");
    tuiCategory.setLeftLabelCaption(BundleUtils.getLanguage("lbl.category.avaiable.list"));
    tuiCategory.setRightLabelCaption(BundleUtils.getLanguage("lbl.category.selected.list"));
    tabSheet.addTab(tuiCategory, BundleUtils.getLanguage("lbl.dish.categoryDish.tab"));

    // RestaurantDish
    tuiRestaurant = new TwinColumnUI("name");
    tuiRestaurant.setLeftLabelCaption(BundleUtils.getLanguage("lbl.restaurant.avaiable.list"));
    tuiRestaurant.setRightLabelCaption(BundleUtils.getLanguage("lbl.restaurant.selected.list"));
    tabSheet.addTab(tuiRestaurant, BundleUtils.getLanguage("lbl.dish.restaurantDish.tab"));

    // DishArticle
    tuiArticle = new TwinColumnUI("title");
    tuiArticle.setLeftLabelCaption(BundleUtils.getLanguage("lbl.article.avaiable.list"));
    tuiArticle.setRightLabelCaption(BundleUtils.getLanguage("lbl.article.selected.list"));
    tabSheet.addTab(tuiArticle, BundleUtils.getLanguage("lbl.dish.dishArticle.tab"));

    setContent(tabSheet);
}

From source file:com.dungnv.streetfood.view.RestaurantLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());

    VerticalLayout vLayout = new VerticalLayout();

    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();//www .  j a  va 2 s  . co m
    vLayout.addComponent(tabSheet);

    // RestaurantDish
    tuiDish = new TwinColumnUI("name");
    tuiDish.setLeftLabelCaption(BundleUtils.getLanguage("lbl.dish.avaiable.list"));
    tuiDish.setRightLabelCaption(BundleUtils.getLanguage("lbl.dish.selected.list"));
    tabSheet.addTab(tuiDish, BundleUtils.getLanguage("lbl.restaurant.restaurantDish.tab"));

    // RestaurantArticle
    tuiArticle = new TwinColumnUI("title");
    tuiArticle.setLeftLabelCaption(BundleUtils.getLanguage("lbl.article.avaiable.list"));
    tuiArticle.setRightLabelCaption(BundleUtils.getLanguage("lbl.article.selected.list"));
    tabSheet.addTab(tuiArticle, BundleUtils.getLanguage("lbl.restaurant.RestaurantArticle.tab"));

    setContent(tabSheet);
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskAddPopup.java

License:Open Source License

public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) {

    final VerticalLayout taskLayout = new VerticalLayout();
    taskLayout.addStyleName("taskadd-popup");

    final VerticalLayout popupHeader = new VerticalLayout();
    popupHeader.setWidth("100%");
    popupHeader.setMargin(true);/*from   ww w .j a  va2  s.co m*/
    popupHeader.addStyleName("popup-header");

    final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE));
    titleLbl.addStyleName("bold");
    popupHeader.addComponent(titleLbl);
    taskLayout.addComponent(popupHeader);

    this.task = new SimpleTask();
    TabSheet taskContainer = new TabSheet();
    final TaskInputForm taskInputForm = new TaskInputForm();
    taskInputForm.setWidth("100%");
    taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE));

    this.taskNoteComponent = new TaskNoteLayout();
    taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT));

    taskLayout.addComponent(taskContainer);

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true);
    controlsLayout.addStyleName("popup-footer");

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskDisplayComp.closeTaskAdd();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    if (taskInputForm.validateForm()) {
                        final ProjectTaskService taskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);

                        task.setTasklistid(taskList.getId());
                        task.setProjectid(CurrentProjectVariables.getProjectId());
                        task.setSaccountid(AppContext.getAccountId());
                        task.setNotes(taskNoteComponent.getNote());

                        taskService.saveWithSession(task, AppContext.getUsername());
                        taskNoteComponent.saveContentsToRepo(task.getId());
                        taskDisplayComp.saveTaskSuccess(task);
                        taskDisplayComp.closeTaskAdd();
                    }
                }
            });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    taskLayout.addComponent(controlsLayout);
    taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT);

    this.setCompositionRoot(taskLayout);
}

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);/*from w ww  .  j  a v  a 2s .  c  o 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 v a2  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.esspl.datagen.ui.TableDetailsView.java

License:Open Source License

public TableDetailsView(JdbcTable table, Connection connection, DataGenApplication dataApp) {
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();/* w  w  w .  j a v a  2  s.  c  o m*/
    tabSheet.addStyleName(Runo.TABSHEET_SMALL);
    setCompositionRoot(tabSheet);

    TableStructureView tableStructureView = new TableStructureView(table, connection);
    tableStructureView.setSizeFull();

    TableDataView tableContentView = new TableDataView(table, connection, dataApp);
    tableContentView.setSizeFull();

    tabSheet.addTab(tableStructureView);
    tabSheet.addTab(tableContentView);
}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());//w  ww. j  a  va  2  s  .c  o  m
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

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

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}

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

License:Open Source License

@PostConstruct
@Override/*from w  ww  .ja v  a2  s.  co  m*/
public void postConstruct() {
    super.postConstruct();

    String typeName = domainMessageSource.getMessage(getType().getName(), getType().getSimpleName());
    labelRegistry.putTypeLabel(getType().getName(), typeName);

    List<ToManyRelationship> toManyRelationships = getViewableToManyRelationships();
    if (toManyRelationships.size() > 0) {
        toManyRelationshipTabs = new TabSheet();
        setDebugId(toManyRelationshipTabs, "toManyRelationshipTabs");
        toManyRelationshipTabs.setSizeUndefined();
        for (ToManyRelationship toManyRelationship : toManyRelationships) {
            toManyRelationshipTabs.addTab(toManyRelationship);
            toManyRelationship.getResultsTable().addExecuteQueryListener(this, "requestRepaintAll");
            labelRegistry.putFieldLabel(getType().getName(), toManyRelationship.getChildPropertyId(),
                    "Relationship", toManyRelationship.getTypeCaption());
        }

        HorizontalLayout toManyRelationshipLayout = new HorizontalLayout();
        setDebugId(toManyRelationshipLayout, "toManyRelationshipLayout");
        toManyRelationshipLayout.setSizeUndefined();
        Label label = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        toManyRelationshipLayout.addComponent(label);
        toManyRelationshipLayout.addComponent(toManyRelationshipTabs);
        addComponent(toManyRelationshipLayout);
    }

    addCodePopupButtonIfEnabled(Alignment.MIDDLE_RIGHT, EntityForm.class);
}

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

License:Open Source License

private void initializeTabs(VerticalLayout layout) {
    final Set<String> tabNames = getFormFieldSet().getTabNames();

    formTabSheet = new TabSheet();
    setDebugId(formTabSheet, "formTabSheet");
    formTabSheet.addStyleName("borderless");
    formTabSheet.setSizeUndefined();//from   www  . ja v  a 2 s .co  m
    int tabPosition = 0;
    for (String tabName : tabNames) {
        Assert.PROGRAMMING.isTrue(!tabName.isEmpty(), "Tab name may not be empty string");
        Label emptyLabel = new Label();
        emptyLabel.setSizeUndefined();
        formTabSheet.addTab(emptyLabel, tabName, null);
        tabPositions.put(tabName, tabPosition++);
    }

    layout.addComponent(formTabSheet);

    formTabSheet.addListener(new TabSheet.SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            String tabName = getCurrentlySelectedTabName();
            form.getLayout().removeAllComponents();
            FormGridLayout gridLayout = (FormGridLayout) form.getLayout();
            gridLayout.setFormColumns(getFormFieldSet().getColumns(tabName));
            gridLayout.setRows(getFormFieldSet().getRows(tabName));
            Set<FormField> formFields = getFormFieldSet().getFormFields(tabName);
            for (FormField formField : formFields) {
                String propertyId = formField.getPropertyId();
                Field field = formField.getField();
                form.attachField(propertyId, field);
            }
            gridLayout.requestRepaint();
        }
    });
}

From source file:com.expressui.core.view.util.CodePopup.java

License:Open Source License

/**
 * Opens popup for given classes.//w w w.j  av  a  2 s.  com
 *
 * @param classes classes for displaying related source code and Javadoc. If
 *                class is within com.expressui.core or com.expressui.domain,
 *                then Javadoc is displayed, otherwise source code.
 */
public void open(Class... classes) {

    Window codeWindow = new Window();
    codeWindow.addStyleName("code-popup");
    codeWindow.setPositionX(20);
    codeWindow.setPositionY(40);
    codeWindow.setWidth("90%");
    codeWindow.setHeight("90%");

    TabSheet codePopupTabSheet = new TabSheet();
    String id = StringUtil.generateDebugId("e", this, codePopupTabSheet, "codePopupTabSheet");
    codePopupTabSheet.setDebugId(id);

    codePopupTabSheet.setSizeFull();
    codeWindow.addComponent(codePopupTabSheet);

    String windowCaption = "";
    Set<String> shownUrls = new HashSet<String>();
    for (Class clazz : classes) {
        String tabCaption;
        String url;
        if (clazz.getName().startsWith("com.expressui.core")
                || clazz.getName().startsWith("com.expressui.domain")) {
            url = applicationProperties.getDocUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + " API";
            Embedded embedded = getEmbeddedDoc(url);
            codePopupTabSheet.addTab(embedded, tabCaption);
        } else {
            url = applicationProperties.getCodeUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + ".java";
            String code = getCodeContents(url);
            Label label = new CodeLabel(code);
            codePopupTabSheet.addTab(label, tabCaption);
        }
        shownUrls.add(url);
        if (windowCaption.length() > 0)
            windowCaption += ", ";

        windowCaption += tabCaption;
    }

    codeWindow.setCaption(windowCaption);
    MainApplication.getInstance().getMainWindow().addWindow(codeWindow);
}