Example usage for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS.

Prototype

String BUTTON_BORDERLESS

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS.

Click Source Link

Document

Borderless button.

Usage

From source file:net.sourceforge.javydreamercsw.validation.manager.web.tester.ExecutionScreen.java

License:Apache License

public ExecutionScreen() {
    testCaseTree = new TreeTable("available.tests");
    testCaseTree.setAnimationsEnabled(true);
    testCaseTree.addContainerProperty("general.name", String.class, "");
    testCaseTree.addGeneratedColumn("general.status", (Table source, Object itemId, Object columnId) -> {
        if ("general.status".equals(columnId) && itemId instanceof String) {
            String id = (String) itemId;
            String message;/*from   ww w . ja v a  2  s .  c om*/
            HorizontalLayout icons = new HorizontalLayout();
            Button label = new Button();
            Button label2 = new Button();
            icons.addComponent(label2);
            icons.addComponent(label);
            label.addStyleName(ValoTheme.BUTTON_BORDERLESS + " labelButton");
            label2.addStyleName(ValoTheme.BUTTON_BORDERLESS + " labelButton");
            Map<String, Integer> summary = new HashMap<>();
            boolean locked = false;
            if (id.startsWith("tce")) {
                TestCaseExecutionServer tce = new TestCaseExecutionServer(Integer.parseInt(id.substring(3)));
                summary = getSummary(tce, -1);
                locked = isLocked(tce);
            } else if (id.startsWith("es")) {
                ExecutionStepServer es = new ExecutionStepServer(extractExecutionStepPK(id));
                summary = getSummary(es.getTestCaseExecution(),
                        Integer.parseInt(id.substring(id.lastIndexOf("-") + 1)));
                locked = es.getLocked();
            }
            if (locked) {
                label2.setIcon(VaadinIcons.LOCK);
                label2.setDescription(TRANSLATOR.translate("message.locked"));
            }
            if (!summary.isEmpty()) {
                if (summary.containsKey("result.fail")) {
                    //At least one failure means the test case is failing
                    message = "result.fail";
                } else if (summary.containsKey("result.blocked")) {
                    //It is blocked
                    message = "result.blocked";
                } else if (summary.containsKey("result.pending") && !summary.containsKey("result.pass")) {
                    //Still not done
                    message = "result.pending";
                } else if (summary.containsKey("result.pending") && summary.containsKey("result.pass")) {
                    //In progress
                    message = "result.progress";
                } else {
                    //All is pass
                    message = "result.pass";
                }
                label.setCaption(TRANSLATOR.translate(message));
                label.setDescription(TRANSLATOR.translate(message));
                //Completed. Now check result
                switch (message) {
                case "result.pass":
                    label.setIcon(VaadinIcons.CHECK);
                    break;
                case "result.fail":
                    label.setIcon(VaadinIcons.CLOSE);
                    break;
                case "result.blocked":
                    label.setIcon(VaadinIcons.PAUSE);
                    break;
                case "result.pending":
                    label.setIcon(VaadinIcons.CLOCK);
                    break;
                case "result.progress":
                    label.setIcon(VaadinIcons.AUTOMATION);
                    break;
                default:
                    label.setIcon(VaadinIcons.CLOCK);
                    break;
                }
                return icons;
            }
        }
        return new Label();
    });
    testCaseTree.addContainerProperty("general.summary", String.class, "");
    testCaseTree.addContainerProperty("general.assignment.date", String.class, "");
    testCaseTree.setVisibleColumns(
            new Object[] { "general.name", "general.status", "general.summary", "general.assignment.date" });
    testCaseTree.addActionHandler(new Action.Handler() {
        @Override
        public Action[] getActions(Object target, Object sender) {
            List<Action> actions = new ArrayList<>();
            if (target instanceof String) {
                String t = (String) target;
                int tcID = -1;
                TestCaseExecutionServer tce = null;
                if (t.startsWith("es")) {
                    tce = new TestCaseExecutionServer(
                            new ExecutionStepServer(extractExecutionStepPK(t)).getTestCaseExecution().getId());
                    tcID = Integer.parseInt(t.substring(t.lastIndexOf("-") + 1));
                } else if (t.startsWith("tce")) {
                    tce = new TestCaseExecutionServer(Integer.parseInt(t.substring(3)));
                }
                if (!isLocked(tce, tcID) && ExecutionScreen.this instanceof TesterScreenProvider) {
                    actions.add(new Action(TRANSLATOR.translate("general.execute"), VMUI.EXECUTION_ICON));
                } else if (isLocked(tce, tcID) && ExecutionScreen.this instanceof QualityScreenProvider) {
                    actions.add(new Action(TRANSLATOR.translate("general.review"), VaadinIcons.EYE));
                }
                actions.add(new Action(TRANSLATOR.translate("general.export"), VaadinIcons.DOWNLOAD));
            }
            return actions.toArray(new Action[actions.size()]);
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            List<TestCaseExecutionServer> executions = new ArrayList<>();
            int tcID = -1;
            if (((String) target).startsWith("tce")) {
                executions.add(new TestCaseExecutionServer(Integer.parseInt(((String) target).substring(3))));
            } else if (((String) target).startsWith("es")) {
                executions.add(new TestCaseExecutionServer(
                        new ExecutionStepServer(extractExecutionStepPK((String) target)).getTestCaseExecution()
                                .getId()));
                tcID = Integer.parseInt(((String) target).substring(((String) target).lastIndexOf("-") + 1));
            }
            //Parse the information to get the exact Execution Step
            if (action.getCaption().equals(TRANSLATOR.translate("general.export"))) {
                viewExecutionScreen(executions, tcID);
            } else {
                showExecutionScreen(executions, tcID);
            }
        }
    });
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadProgressInfoWindow.java

License:Open Source License

private Button getCloseButton() {
    final Button closeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES,
            SPUIButtonStyleNoBorder.class);
    closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    closeBtn.addClickListener(event -> onClose());
    return closeBtn;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java

License:Open Source License

private Button getMinimizeButton() {
    final Button minimizeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_MINIMIZE_BUTTON_ID, "", "", "", true, FontAwesome.MINUS,
            SPUIButtonStyleSmallNoBorder.class);
    minimizeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    minimizeBtn.addClickListener(event -> minimizeWindow());
    minimizeBtn.setEnabled(true);/*  w  w  w . ja v  a2  s.co m*/
    return minimizeBtn;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java

License:Open Source License

private Button getResizeButton() {
    final Button resizeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_RESIZE_BUTTON_ID, "", "", "", true, FontAwesome.EXPAND,
            SPUIButtonStyleSmallNoBorder.class);
    resizeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    resizeBtn.addClickListener(event -> resizeWindow(event));
    return resizeBtn;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java

License:Open Source License

private Button getCloseButton() {
    final Button closeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES,
            SPUIButtonStyleSmallNoBorder.class);
    closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    closeBtn.addClickListener(event -> onClose());
    return closeBtn;
}

From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java

License:Open Source License

private DragAndDropWrapper createDeleteWrapperLayout() {
    final Button dropToDelete = new Button(i18n.getMessage("label.components.drop.area"));
    dropToDelete.setCaptionAsHtml(true);
    dropToDelete.setIcon(FontAwesome.TRASH_O);
    dropToDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    dropToDelete.addStyleName("drop-to-delete-button");
    dropToDelete.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
    dropToDelete.addStyleName(SPUIStyleDefinitions.DEL_ACTION_BUTTON);
    dropToDelete.addStyleName("delete-icon");

    final DragAndDropWrapper wrapper = new DragAndDropWrapper(dropToDelete);
    wrapper.setStyleName(ValoTheme.BUTTON_PRIMARY);
    wrapper.setId(getDeleteAreaId());/* ww w .  j a v  a  2s .  c  om*/
    wrapper.setDropHandler(this);
    wrapper.addStyleName("delete-button-border");
    return wrapper;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder.java

License:Open Source License

/**
 * Decorate Button and return.//  ww w  .j  a v a2s  .  com
 * 
 * @param button
 *            as Button
 * @param style
 *            as String
 * @param setStyle
 *            as String
 * @param icon
 *            as resource
 * @return Button
 */
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    if (style != null && setStyle) {
        button.addStyleName(style);
    }
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    if (icon != null) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.addStyleName("button-no-border");
        button.setIcon(icon);
    }

    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder.java

License:Open Source License

/**
 * Decorate Button and return.//from  w  w  w .  ja va 2s . c  o m
 * 
 * @param button
 *            as Button
 * @param style
 *            as String
 * @param setStyle
 *            as String
 * @param icon
 *            as resource
 * @return Button
 */
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    // Set Style
    if (null != style && setStyle) {
        button.addStyleName(style);
    }
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.addStyleName("button-no-border");
        button.setIcon(icon);
    }

    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorderUHS.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    button.setHeightUndefined();/*from w ww .j  a  va  2s.c  o  m*/
    button.setSizeUndefined();
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUITagButtonStyle.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {

    button.setImmediate(true);//from   w  ww . j  ava 2  s .  co  m
    button.addStyleName("generatedColumnPadding button-no-border" + " " + ValoTheme.BUTTON_BORDERLESS + " "
            + "button-tag-no-border");

    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.setIcon(icon);
    }
    return button;
}