Example usage for com.vaadin.ui Button setCaption

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

Introduction

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

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadField.java

License:Open Source License

/**
 * Create Delete button./*w  ww.  j  a  v  a  2s  .  c  o  m*/
 */
protected Button createDeleteButton() {
    Button deleteButton = new Button();
    deleteButton.setHtmlContentAllowed(true);
    deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>");
    deleteButton.addStyleName("inline");
    deleteButton.setDescription(i18n.translate(deleteCaption));

    deleteButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            resetDataSource();
            updateDisplay();
        }
    });
    return deleteButton;
}

From source file:info.magnolia.vaadin.periscope.Periscope.java

License:Open Source License

private Component createSpeechButton() {
    final Button startStopButton = new Button();
    startStopButton.addStyleName("record-button");
    startStopButton.setCaptionAsHtml(true);
    startStopButton.setCaption("<span class=\"ion-mic-a\"></span>");
    startStopButton.setClickShortcut(ShortcutAction.KeyCode.R, ShortcutAction.ModifierKey.SHIFT,
            ShortcutAction.ModifierKey.ALT);

    final AtomicBoolean isRecording = new AtomicBoolean(false);

    speechRecognizer.addSpeechResultListener(transcript -> {
        input.setValue(transcript);/*  w w  w.  j  a v  a 2 s .c o m*/
        this.consumeQuery(transcript, true);

        startStopButton.removeStyleName("recording");
        isRecording.set(false);
    });

    startStopButton.addClickListener((Button.ClickListener) event -> {
        if (isRecording.get()) {
            return;
        }

        speechRecognizer.record();

        startStopButton.addStyleName("recording");
        isRecording.set(true);
    });

    final VerticalLayout speechWrapper = new VerticalLayout(startStopButton, speechRecognizer);
    speechWrapper.addStyleName("speech-recognition");
    return speechWrapper;
}

From source file:io.mateu.ui.vaadin.framework.MyUI.java

License:Apache License

/**
 * construye una opcin del men//w  w  w  .j a v a2s.  c o m
 *
 */
private void addMenu(AbstractArea area, MenuEntry e) {

    Button b = null;

    if (e instanceof AbstractMenu) {
        b = new Button(e.getName(), new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                setAreaActual(area);
                setMenuActual(e);
                Page.getCurrent().open("#!" + getApp().getAreaId(area) + "/" + getApp().getMenuId(e) + "/menu",
                        (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName());
            }
        });
        b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">"
                + ((AbstractMenu) e).getEntries().size() + "</span>");
    }

    if (e instanceof AbstractAction) {

        b = new Button(e.getName(), new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                setAreaActual(area);
                setMenuActual(e);
                ((AbstractAction) e).setModifierPressed(event.isAltKey() || event.isCtrlKey()).run();
            }
        });

    }

    if (b != null) {
        b.setCaptionAsHtml(true);
        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);

        //b.setIcon(testIcon.get());  // sin iconos en el men
        menuItemsLayout.addComponent(b);

        botonesMenu.put(e, b);

    }

}

From source file:it.vige.greenarea.bpm.custom.ui.form.GreenareaFormPropertiesForm.java

License:Apache License

private void addButtons() {
    GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) formPropertiesComponent;
    List<String> operationsFromRenderers = getOperationsFromRenderers(greenareaFormPropertiesComponent);
    FormProperty operations = greenareaFormPropertiesComponent.getOperations();
    if (operations != null) {
        @SuppressWarnings("unchecked")
        Map<String, String> mapOperations = (Map<String, String>) operations.getType().getInformation("values");

        buttons = new HorizontalLayout();
        buttons.setSpacing(true);//from w ww  . ja  va 2 s. c o  m
        buttons.setWidth(100, UNITS_PERCENTAGE);
        buttons.addStyleName(STYLE_DETAIL_BLOCK);
        for (String operation : mapOperations.keySet()) {
            if (!operationsFromRenderers.contains(operation)) {
                final String finalOperation = operation;
                final Button button = new Button();
                button.setCaption(i18nManager.getMessage(operation));
                buttons.addComponent(button);
                buttons.setComponentAlignment(button, BOTTOM_RIGHT);
                button.addListener(new ClickListener() {

                    private static final long serialVersionUID = -6091586145870618870L;

                    public void buttonClick(ClickEvent event) {
                        // Extract the submitted values from the form.
                        // Throws
                        // exception
                        // when validation fails.
                        try {
                            Map<String, String> formProperties = formPropertiesComponent
                                    .getFormPropertyValues();
                            setOperation(formProperties, finalOperation);
                            mainTitle.setPropertyDataSource(new ObjectProperty<String>(
                                    mainTitle.getValue() + " > " + finalOperation, String.class));
                            fireEvent(new FormPropertiesEvent(GreenareaFormPropertiesForm.this, TYPE_SUBMIT,
                                    formProperties));
                            button.setComponentError(null);
                        } catch (InvalidValueException ive) {
                            // Error is presented to user by the form
                            // component
                        }
                    }
                });
            }
        }

        Label buttonSpacer = new Label();
        buttons.addComponent(buttonSpacer);
        buttons.setExpandRatio(buttonSpacer, 1.0f);
        addComponent(buttons);
    } else {
        submitFormButton = new Button();
        cancelFormButton = new Button();

        HorizontalLayout buttons = new HorizontalLayout();
        buttons.setSpacing(true);
        buttons.setWidth(100, UNITS_PERCENTAGE);
        buttons.addStyleName(STYLE_DETAIL_BLOCK);
        buttons.addComponent(submitFormButton);
        buttons.setComponentAlignment(submitFormButton, BOTTOM_RIGHT);

        // buttons.addComponent(cancelFormButton);
        // buttons.setComponentAlignment(cancelFormButton, BOTTOM_RIGHT);

        Label buttonSpacer = new Label();
        buttons.addComponent(buttonSpacer);
        buttons.setExpandRatio(buttonSpacer, 1.0f);
        addComponent(buttons);
        setSubmitButtonCaption(i18nManager.getMessage(TASK_COMPLETE));
        // setCancelButtonCaption(i18nManager.getMessage(TASK_RESET_FORM));
    }
}

From source file:jp.primecloud.auto.ui.ServiceTable.java

License:Open Source License

Button getLoadBalancerButton(LoadBalancerDto lbDto) {
    Button btn = new Button();
    btn.setCaption(lbDto.getLoadBalancer().getLoadBalancerName());
    btn.setIcon(Icons.LOADBALANCER_TAB.resource());
    btn.setData(lbDto);/*from  w  w w.java 2 s  .  com*/
    btn.addStyleName("borderless");
    btn.addStyleName("loadbalancer-button");
    btn.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            loadBalancerButtonClick(event);
        }
    });
    return btn;
}

From source file:kn.uni.gis.ui.AdminWindow.java

License:Apache License

private Component loginComponent() {
    final VerticalLayout layout = new VerticalLayout();

    final PasswordField passwordField = new PasswordField("Old Hunters Age");
    passwordField.setWidth("-1px");
    passwordField.setHeight("-1px");
    passwordField.focus();//from  w  w w .j  a  va 2  s  .  c  o  m

    Button button_2 = new Button();
    button_2.setCaption("Login");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (password.equals(passwordField.getValue())) {
                AdminWindow.this.removeComponent(layout);
                AdminWindow.this.addComponent(createTable());
            } else {
                AdminWindow.this.showNotification("Wrong age!");
            }
        }
    });

    layout.addComponent(passwordField);
    layout.addComponent(button_2);

    layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER);
    layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER);

    return layout;
}

From source file:kn.uni.gis.ui.GameApplication.java

License:Apache License

private Window createGameWindow() {

    tabsheet = new TabSheet();
    tabsheet.setImmediate(true);//from   w  w w . j a  va2s  .  co  m
    tabsheet.setCloseHandler(new CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {

            Game game = ((GameComposite) tabContent).getGame();

            GameComposite remove = gameMap.remove(game);

            // closes the game and the running thread!
            remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent());

            eventBus.unregister(remove);
            eventBus.unregister(remove.getLayer());

            map.removeLayer(remove.getLayer());

            tabsheet.removeComponent(tabContent);

            if (gameMap.isEmpty()) {
                pi.setVisible(false);
            }
        }
    });

    final Window mywindow = new Window("Games");
    mywindow.setPositionX(0);
    mywindow.setPositionY(0);
    mywindow.setHeight("50%");
    mywindow.setWidth("25%");
    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout lay = new HorizontalLayout();

    final Button button_1 = new Button();
    button_1.setCaption("Open Game");
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");

    button_1.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final String id = textField_1.getValue().toString();

            if (id.length() < 5) {
                window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE);
            } else {
                String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s"
                        + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER);

                final Game game = new Game(id);
                final PreparedStatement statement = geoUtil.getConn()
                        .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER
                                + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT "
                                + MAX_STATES_IN_MEM);

                try {
                    geoUtil.getConn().executeSafeQuery(sql, new DoWithin() {

                        @Override
                        public void doIt(ResultSet executeQuery) throws SQLException {

                            while (executeQuery.next()) {
                                if (statement == null) {

                                }
                                String playerId = executeQuery.getString(1);
                                Timestamp min = executeQuery.getTimestamp(3);
                                Timestamp max = executeQuery.getTimestamp(4);
                                game.addPlayer(playerId, executeQuery.getString(2), min, max,
                                        new TimingIterator(geoUtil, id, playerId, min.getTime(), statement));
                            }
                        }
                    }, id + "%");
                } catch (SQLException e) {
                    LOGGER.info("error on sql!", e);

                }

                game.finish(statement);

                if (!!!gameMap.containsKey(game)) {
                    if (game.getStates().size() == 0) {
                        window.showNotification("game not found!");
                    } else {
                        LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size());

                        GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus,
                                game, createColorMap(game));

                        final GameComposite gameComposite = new GameComposite(GameApplication.this, game,
                                gameVectorLayer, eventBus);

                        eventBus.register(gameComposite);
                        eventBus.register(gameVectorLayer);

                        map.addLayer(gameVectorLayer);
                        gameMap.put(game, gameComposite);

                        // Add the component to the tab sheet as a new tab.
                        Tab addTab = tabsheet.addTab(gameComposite);
                        addTab.setCaption(game.getId().substring(0, 5));
                        addTab.setClosable(true);

                        pi.setVisible(true);
                        // pl.get
                        PlayerState playerState = game.getStates().get(game.getFox()).peek();
                        map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint())));
                    }
                }
            }
        }

        private Map<Player, Integer> createColorMap(Game game) {
            Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size());

            ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder();

            int i = 0;

            for (Player play : game.getStates().keySet()) {
                builder.put(play, getColor(scale.apply((double) i++)));
            }

            return builder.build();
        }

        private Integer getColor(double dob) {

            int toReturn = 0;
            toReturn = toReturn | 255 - (int) Math.round(255 * dob);
            toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16);
            return toReturn;
            // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob +
            // 5 * dob);
        }

    });

    Button button_2 = new Button();
    button_2.setCaption("All seeing Hunter");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (adminWindow == null) {
                adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() {
                    @Override
                    public void itemClick(ItemClickEvent event) {

                        textField_1.setValue(event.getItemId().toString());
                        mywindow.bringToFront();
                        button_1.focus();
                    }
                });
                window.addWindow(adminWindow);
                adminWindow.setWidth("30%");
                adminWindow.setHeight("40%");
                adminWindow.addListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        adminWindow = null;
                    }
                });
            }
        }
    });

    lay.addComponent(button_1);
    textField_1 = new TextField();
    textField_1.setImmediate(false);
    textField_1.setWidth("-1px");
    textField_1.setHeight("-1px");
    lay.addComponent(textField_1);
    lay.addComponent(button_2);
    lay.addComponent(pi);

    lay.setComponentAlignment(pi, Alignment.TOP_RIGHT);

    layout.addComponent(lay);
    layout.addComponent(tabsheet);

    mywindow.addComponent(layout);
    mywindow.setClosable(false);

    /* Add the window inside the main window. */
    return mywindow;
}

From source file:lv.polarisit.demosidemenu.ValoThemeUI.java

License:Apache License

CssLayout buildMenu() {
    // Add items/* w  w w . j a  va2  s. c o m*/
    menuItems.put("MessageView", "First Message");
    menuItems.put("MessageView1", "Second Message");
    /*
    menuItems.put("labels", "Labels");
    menuItems.put("buttons-and-links", "Buttons & Links");
    menuItems.put("textfields", "Text Fields");
    menuItems.put("datefields", "Date Fields");
    menuItems.put("comboboxes", "Combo Boxes");
    menuItems.put("selects", "Selects");
    menuItems.put("checkboxes", "Check Boxes & Option Groups");
    menuItems.put("sliders", "Sliders & Progress Bars");
    menuItems.put("colorpickers", "Color Pickers");
    menuItems.put("menubars", "Menu Bars");
    menuItems.put("trees", "Trees");
    menuItems.put("tables", "Tables");
    menuItems.put("dragging", "Drag and Drop");
    menuItems.put("panels", "Panels");
    menuItems.put("splitpanels", "Split Panels");
    menuItems.put("tabs", "Tabs");
    menuItems.put("accordions", "Accordions");
    menuItems.put("popupviews", "Popup Views");
    // menuItems.put("calendar", "Calendar");
    menuItems.put("forms", "Forms");
    */
    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);
    menu.addComponent(createThemeSelect());

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    /*
    final StringGenerator sg = new StringGenerator();
    final MenuItem settingsItem = settings.addItem(sg.nextString(true)
        + " " + sg.nextString(true) + sg.nextString(false),
        new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"),
        null);
            
    settingsItem.addItem("Edit Profile", null);
    settingsItem.addItem("Preferences", null);
    settingsItem.addSeparator();
    settingsItem.addItem("Sign Out", null);
                */
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    Label label = null;
    int count = -1;
    for (final Entry<String, String> item : menuItems.entrySet()) {
        if (item.getKey().equals("labels")) {
            label = new Label("Components", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("panels")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Containers", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("forms")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Other", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        final Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        if (count == 2) {
            b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>");
        }
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        //            b.setIcon(testIcon.get());
        menuItemsLayout.addComponent(b);
        count++;
    }
    if (label != null)
        label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");

    return menu;
}

From source file:me.uni.emuseo.view.common.paging.PagedTableLayout.java

License:Open Source License

private Button createPageButton(int i) {
    Button pageButton = new Button();
    pageButton.setCaption(((Integer) i).toString());
    pageButton.setData(i - 1);//  w  ww .  j a v  a 2s.  com
    pageButton.addClickListener(pageButtonListener);
    return pageButton;
}

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;/* w  w w . j a v  a2  s .  co m*/
            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);
            }
        }
    });
}