Example usage for com.vaadin.ui HorizontalLayout addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java

License:Open Source License

private Component generateMemberBlock(final SimpleProjectMember member) {
    HorizontalLayout blockContent = new HorizontalLayout();
    blockContent.setStyleName("member-block");
    if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) {
        blockContent.addStyleName("inactive");
    }//from   www .ja  v a 2 s . co  m
    blockContent.setWidth("350px");

    Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(),
            100);
    memberAvatar.addStyleName(UIConstants.CIRCLE_BOX);
    memberAvatar.setWidthUndefined();
    blockContent.addComponent(memberAvatar);

    MVerticalLayout blockTop = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withFullWidth();

    MButton editBtn = new MButton("",
            clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, member)))
                    .withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_LINK)
                    .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    editBtn.setDescription("Edit user '" + member.getDisplayName() + "' information");

    MButton deleteBtn = new MButton("", clickEvent -> {
        ConfirmDialogExt.show(UI.getCurrent(),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                    if (confirmDialog.isConfirmed()) {
                        ProjectMemberService prjMemberService = AppContextUtil
                                .getSpringBean(ProjectMemberService.class);
                        prjMemberService.removeWithSession(member, UserUIContext.getUsername(),
                                MyCollabUI.getAccountId());
                        EventBusFactory.getInstance()
                                .post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null));
                    }
                });
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK)
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    deleteBtn.setDescription("Remove user '" + member.getDisplayName() + "' out of this project");

    MHorizontalLayout buttonControls = new MHorizontalLayout(editBtn, deleteBtn);
    blockTop.addComponent(buttonControls);
    blockTop.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT);

    A memberLink = new A(
            ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername()))
                    .appendText(member.getMemberFullName()).setTitle(member.getMemberFullName());
    ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS)
            .withFullWidth();

    blockTop.with(memberNameLbl, ELabel.hr());

    String roleLink = String.format("<a href=\"%s%s%s\"", MyCollabUI.getSiteUrl(),
            GenericLinkUtils.URL_PREFIX_PARAM,
            ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid()));
    ELabel memberRole = new ELabel("", ContentMode.HTML).withFullWidth()
            .withStyleName(UIConstants.TEXT_ELLIPSIS);
    if (member.isProjectOwner()) {
        memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", roleLink,
                UserUIContext.getMessage(ProjectRoleI18nEnum.OPT_ADMIN_ROLE_DISPLAY)));
    } else {
        memberRole.setValue(
                String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", roleLink, member.getRoleName()));
    }
    blockTop.addComponent(memberRole);

    if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) {
        Label memberEmailLabel = ELabel
                .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername()))
                .withStyleName(UIConstants.META_INFO).withFullWidth();
        blockTop.addComponent(memberEmailLabel);
    }

    ELabel memberSinceLabel = ELabel
            .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE,
                    UserUIContext.formatPrettyTime(member.getJoindate())))
            .withDescription(UserUIContext.formatDateTime(member.getJoindate())).withFullWidth();
    blockTop.addComponent(memberSinceLabel);

    if (ProjectMemberStatusConstants.ACTIVE.equals(member.getStatus())) {
        ELabel lastAccessTimeLbl = ELabel
                .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN,
                        UserUIContext.formatPrettyTime(member.getLastAccessTime())))
                .withDescription(UserUIContext.formatDateTime(member.getLastAccessTime()));
        blockTop.addComponent(lastAccessTimeLbl);
    }

    String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " "
            + new Span().appendText("" + member.getNumOpenTasks())
                    .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS))
            + "  " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " "
            + new Span().appendText("" + member.getNumOpenBugs())
                    .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS))
            + " " + FontAwesome.MONEY.getHtml() + " "
            + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime()))
                    .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS))
            + "  " + FontAwesome.GIFT.getHtml() + " "
            + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime()))
                    .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS));

    blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO));

    blockContent.addComponent(blockTop);
    blockContent.setExpandRatio(blockTop, 1.0f);
    return blockContent;
}

From source file:com.naoset.framework.frontend.view.window.DialogWindow.java

private HorizontalLayout buildFooter() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    layout.setWidth(100.0f, Unit.PERCENTAGE);
    return layout;
}

From source file:com.naoset.framework.frontend.view.window.Window.java

private HorizontalLayout buildFooter() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    layout.setWidth(100.0f, Unit.PERCENTAGE);

    //Si el objeto a mostrar hereda de Widget, mostraremos su cabecera con el men en la ventana.
    if (Widget.class.isInstance(body)) {
        //if (details.getClass().isInstance(Widget.class)) {
        Widget aux = (Widget) body;//  w w  w  . j  a  va 2 s  .  c o  m
        HorizontalLayout header = aux.getHeader();
        header.setWidth(100.0f, Unit.PERCENTAGE);
        layout.addComponent(header);
        //layout.setComponentAlignment(header, Alignment.TOP_LEFT);
        layout.setExpandRatio(header, 1);
    }

    Button ok = new Button("Cerrar");
    ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
    ok.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            Boolean canClose = true;
            if (Widget.class.isInstance(body)) {
                Widget aux = (Widget) body;
                canClose = !aux.isModified();
            }
            if (canClose) {
                close();
            } else {

                buildConfirmCloseDialog();

            }

        }
    });
    ok.focus();
    layout.addComponent(ok);
    layout.setComponentAlignment(ok, Alignment.TOP_RIGHT);
    return layout;
}

From source file:com.peergreen.webconsole.core.exception.ExceptionView.java

License:Open Source License

public ExceptionView(Exception ex) {

    setSizeFull();//from   ww  w  . j a v  a  2 s.  c o m
    addStyleName("dashboard-view");

    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setSpacing(true);
    top.addStyleName("toolbar");
    addComponent(top);
    final Label title = new Label("Oops ! A problem occurred when drawing this view");
    title.setSizeUndefined();
    title.addStyleName("h1");
    top.addComponent(title);
    top.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    top.setExpandRatio(title, 1);

    HorizontalLayout row = new HorizontalLayout();
    row.setSizeFull();
    row.setMargin(new MarginInfo(true, true, false, true));
    row.setSpacing(true);
    addComponent(row);
    setExpandRatio(row, 1.5f);

    Table t = new Table();
    t.setCaption("Stack trace");
    t.addContainerProperty("<p style=\"display:none\">Stack</p>", String.class, null);
    t.setWidth("100%");
    t.setImmediate(true);
    t.addStyleName("plain");
    t.addStyleName("borderless");
    t.setSortEnabled(false);
    t.setImmediate(true);
    t.setSizeFull();

    int i = 1;
    t.addItem(new Object[] { ex.toString() }, i++);
    for (StackTraceElement element : ex.getStackTrace()) {
        t.addItem(new Object[] { element.toString() }, i++);
    }
    CssLayout panel = new CssLayout();
    panel.addStyleName("layout-panel");
    panel.setSizeFull();

    panel.addComponent(t);

    row.addComponent(panel);
}

From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java

License:Open Source License

/**
 * Build login view/*from   ww w . j a v  a  2 s .c o  m*/
 *
 * @param exit
 */
private void buildLoginView(final boolean exit) {
    if (exit) {
        root.removeAllComponents();
    }
    notifierService.closeAll();

    addStyleName("login");

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setId("webconsole_loginlayout_id");
    loginLayout.setSizeFull();
    loginLayout.addStyleName("login-layout");
    root.addComponent(loginLayout);

    final CssLayout loginPanel = new CssLayout();
    loginPanel.addStyleName("login-panel");

    HorizontalLayout labels = new HorizontalLayout();
    labels.setWidth(MAX_WIDTH);
    labels.setMargin(true);
    loginPanel.addComponent(labels);

    Label welcome = new Label("Welcome");
    welcome.addStyleName("h4");
    labels.addComponent(welcome);
    labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT);

    Label title = new Label(consoleName);
    //title.setSizeUndefined();
    title.addStyleName("h2");
    title.addStyleName("light");
    labels.addComponent(title);
    labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.setMargin(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.focus();
    username.setId("webconsole_login_username");
    fields.addComponent(username);

    final PasswordField password = new PasswordField("Password");
    password.setId("webconsole_login_password");
    fields.addComponent(password);

    final Button signin = new Button("Sign In");
    signin.setId("webconsole_login_signin");
    signin.addStyleName("default");
    fields.addComponent(signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            signin.click();
        }
    };

    signin.addShortcutListener(enter);
    loginPanel.addComponent(fields);

    HorizontalLayout bottomRow = new HorizontalLayout();
    bottomRow.setWidth(MAX_WIDTH);
    bottomRow.setMargin(new MarginInfo(false, true, false, true));
    final CheckBox keepLoggedIn = new CheckBox("Keep me logged in");
    bottomRow.addComponent(keepLoggedIn);
    bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT);
    // Add new error message
    final Label error = new Label("Wrong username or password.", ContentMode.HTML);
    error.setId("webconsole_login_error");
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    // Add animation
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    bottomRow.addComponent(error);
    bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT);
    loginPanel.addComponent(bottomRow);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (authenticate(username.getValue(), password.getValue())) {
                //                    if (keepLoggedIn.getValue()) {
                //                        //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME);
                //                       if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) {
                //                            // Get a token for this user and create a cooki
                //                            Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'",
                //                                    PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath()));
                //                        } else {
                //                            // update token
                //                            userCookie.setValue(token);
                //                            userCookie.setPath(VaadinService.getCurrentRequest().getContextPath());
                //                        }
                //                    }

                buildMainView();
            } else {
                error.setVisible(true);
            }
        }
    });

    loginLayout.addComponent(loginPanel);
    loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();//from  w  w  w  .  ja  va2  s  .c  o  m

    TreeTable table = new TreeTable();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

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

    // Deployment Plan name
    Label deploymentPlanNameLabel = new Label("Plan");
    toolBar.addComponent(deploymentPlanNameLabel);
    toolBar.setExpandRatio(deploymentPlanNameLabel, 1);

    deploymentPlanName = new TextField();
    deploymentPlanName.setInputPrompt(getDefaultName());
    deploymentPlanName.setWidth("100%");
    toolBar.addComponent(deploymentPlanName);
    toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(deploymentPlanName, 3);

    error = new Label("", ContentMode.HTML);
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    toolBar.addComponent(error);
    toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT);
    toolBar.setExpandRatio(error, 1);
    mainContent.addComponent(toolBar);
    mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT);
    mainContent.setExpandRatio(toolBar, 1);

    VerticalLayout deploymentPlanContainer = new VerticalLayout();
    DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer);
    DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this,
            notifierService);
    deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler);
    deploymentPlanContainerWrapper.setSizeFull();
    mainContent.addComponent(deploymentPlanContainerWrapper);
    mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED));
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler));
    table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            Table table = (Table) target;
            Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue();
            for (DeployableEntry deployableEntry : deployableEntries) {
                removeDeployable(deployableEntry);
            }
        }
    });
    deploymentPlanContainer.addComponent(table);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeFull();
    footer.setSpacing(true);
    footer.setMargin(true);
    footer.addStyleName("footer");
    footer.setWidth("100%");

    deployIt = new CheckBox("Deploy this deployment plan");
    footer.addComponent(deployIt);
    footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    Button cancel = new Button("Cancel");
    cancel.addClickListener(new CancelButtonListener());
    Button create = new Button("Create");
    create.addClickListener(new CreateButtonListener());
    create.addStyleName("wide");
    create.addStyleName("default");
    buttons.addComponent(cancel);
    buttons.addComponent(create);
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT);

    mainContent.addComponent(footer);
    mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT);
    mainContent.setExpandRatio(footer, 1);
}

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

License:Open Source License

public HomeScope() {
    setSizeFull();//from  ww  w. ja  v  a  2  s .  c om
    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.rex.components.valo.ComboBoxes.java

License:Apache License

public ComboBoxes() {
    setMargin(true);/*from ww  w  .  jav a  2  s.co m*/

    Label h1 = new Label("Combo Boxes");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    ComboBox combo = new ComboBox("Normal");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png"));
    row.addComponent(combo);

    CssLayout group = new CssLayout();
    group.setCaption("Grouped with a Button");
    group.addStyleName("v-component-group");
    row.addComponent(group);

    combo = new ComboBox();
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.setWidth("240px");
    group.addComponent(combo);
    Button today = new Button("Do It");
    group.addComponent(today);

    combo = new ComboBox("Explicit size");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setWidth("260px");
    combo.setHeight("60px");
    row.addComponent(combo);

    combo = new ComboBox("No text input allowed");
    combo.setInputPrompt("You can click here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setTextInputAllowed(false);
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    row.addComponent(combo);

    combo = new ComboBox("Error");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(combo);

    combo = new ComboBox("Error, borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Disabled");
    combo.setInputPrompt("You can't type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setEnabled(false);
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("color1");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("color2");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("color3");
    row.addComponent(combo);

    combo = new ComboBox("Small");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("small");
    row.addComponent(combo);

    combo = new ComboBox("Large");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("large");
    row.addComponent(combo);

    combo = new ComboBox("Borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Tiny");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("tiny");
    row.addComponent(combo);

    combo = new ComboBox("Huge");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("huge");
    row.addComponent(combo);
}

From source file:com.rex.components.valo.Sliders.java

License:Apache License

public Sliders() {
    setMargin(true);//from   ww  w.  j  av  a  2  s  . c o m

    Label h1 = new Label("Sliders");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    Slider slider = new Slider("Horizontal");
    slider.setValue(50.0);
    row.addComponent(slider);

    slider = new Slider("Horizontal, sized");
    slider.setValue(50.0);
    slider.setWidth("200px");
    row.addComponent(slider);

    slider = new Slider("Custom handle");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("color1");
    row.addComponent(slider);

    slider = new Slider("Custom track");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("color2");
    row.addComponent(slider);

    slider = new Slider("Custom indicator");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("color3");
    row.addComponent(slider);

    slider = new Slider("No indicator");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("no-indicator");
    row.addComponent(slider);

    slider = new Slider("With ticks (not in IE8 & IE9)");
    slider.setValue(3.0);
    slider.setWidth("200px");
    slider.setMax(4);
    slider.addStyleName("ticks");
    row.addComponent(slider);

    slider = new Slider("Toggle imitation");
    slider.setWidth("50px");
    slider.setResolution(0);
    slider.setMin(0);
    slider.setMax(1);
    row.addComponent(slider);

    slider = new Slider("Vertical");
    slider.setValue(50.0);
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Vertical, sized");
    slider.setValue(50.0);
    slider.setOrientation(SliderOrientation.VERTICAL);
    slider.setHeight("200px");
    row.addComponent(slider);

    slider = new Slider("Custom handle");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("color1");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Custom track");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("color2");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Custom indicator");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("color3");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("No indicator");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("no-indicator");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("With ticks");
    slider.setValue(3.0);
    slider.setHeight("200px");
    slider.setMax(4);
    slider.addStyleName("ticks");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Disabled");
    slider.setValue(50.0);
    slider.setEnabled(false);
    row.addComponent(slider);

    h1 = new Label("Progress Bars");
    h1.addStyleName("h1");
    addComponent(h1);

    row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    pb = new ProgressBar();
    pb.setCaption("Default");
    pb.setWidth("300px");
    // pb.setValue(0.6f);
    row.addComponent(pb);

    pb2 = new ProgressBar();
    pb2.setCaption("Point style");
    pb2.setWidth("300px");
    pb2.addStyleName("point");
    // pb2.setValue(0.6f);
    row.addComponent(pb2);

    if (!ReportEngineUI.isTestMode()) {
        ProgressBar pb3 = new ProgressBar();
        pb3.setIndeterminate(true);
        pb3.setCaption("Indeterminate");
        row.addComponent(pb3);
    }
}

From source file:com.rex.components.valo.Tables.java

License:Apache License

public Tables() {
    setMargin(true);// w w w .j  a  v a  2 s.com
    setSpacing(true);

    Label h1 = new Label("Tables & Grids");
    h1.addStyleName("h1");
    addComponent(h1);

    Label disclaimer = new Label(
            "<p>Note that most of the toggles only affect the Table component. The Grid component supports footers, expand ratios, row indexes/captions/icons and cell renderers, but those have not been implemented here.</p>",
            ContentMode.HTML);
    disclaimer.setCaption("Toggle features/styles");
    addComponent(disclaimer);
    disclaimer.addStyleName(ValoTheme.LABEL_SMALL);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.addStyleName("wrapping");
    wrap.setSpacing(true);
    addComponent(wrap);

    wrap.addComponents(hierarchical, footer, sized, expandRatios, stripes, verticalLines, horizontalLines,
            borderless, headers, compact, small, rowIndex, rowCaption, rowIcon, componentsInCells);

    ValueChangeListener update = new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            if (table == null) {
                table = new Table("Table component");
                table.setContainerDataSource(normalContainer);
                addComponent(table);
            }
            if (grid == null) {
                grid = new Grid("Grid component");
                grid.setContainerDataSource(gridContainer);
                addComponent(grid);
            }
            if (hierarchical.getValue() && table instanceof Table) {
                removeComponent(table);
                table = new TreeTable();
                table.setContainerDataSource(hierarchicalContainer);
                addComponent(table);
                removeComponent(grid);
            } else if (!hierarchical.getValue() && table instanceof TreeTable) {
                removeComponent(table);
                table = new Table();
                table.setContainerDataSource(normalContainer);
                addComponent(table);
                addComponent(grid);
            }

            configure(table, grid, footer.getValue(), sized.getValue(), expandRatios.getValue(),
                    stripes.getValue(), verticalLines.getValue(), horizontalLines.getValue(),
                    borderless.getValue(), headers.getValue(), compact.getValue(), small.getValue(),
                    rowIndex.getValue(), rowCaption.getValue(), rowIcon.getValue(),
                    componentsInCells.getValue());
        }
    };

    hierarchical.addValueChangeListener(update);
    footer.addValueChangeListener(update);
    sized.addValueChangeListener(update);
    expandRatios.addValueChangeListener(update);
    stripes.addValueChangeListener(update);
    verticalLines.addValueChangeListener(update);
    horizontalLines.addValueChangeListener(update);
    borderless.addValueChangeListener(update);
    headers.addValueChangeListener(update);
    compact.addValueChangeListener(update);
    small.addValueChangeListener(update);
    rowIndex.addValueChangeListener(update);
    rowCaption.addValueChangeListener(update);
    rowIcon.addValueChangeListener(update);
    componentsInCells.addValueChangeListener(update);

    footer.setValue(false);

}