Example usage for com.vaadin.ui Label setStyleName

List of usage examples for com.vaadin.ui Label setStyleName

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:ru.codeinside.gses.webui.components.ProcessDefinitionShowUi.java

License:Mozilla Public License

private Component buildMainLayout() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();/*from w  w w. j  a  v  a2  s  .co  m*/
    layout.setSpacing(true);
    layout.setMargin(true);

    Label label = new Label();
    String name = getProcessDefinitionById(processDefinitionId).getName();
    label.setCaption(name);
    label.setStyleName(Reindeer.LABEL_H2);

    Button showScheme = new Button("");
    showScheme.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -5911713385519847639L;

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            VerticalLayout imageLayout = new VerticalLayout();
            Button back = new Button("?");
            back.addListener(new Button.ClickListener() {
                private static final long serialVersionUID = 4154712522487297925L;

                @Override
                public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                    changer.back();
                }
            });
            imageLayout.addComponent(back);
            imageLayout.setMargin(true);
            imageLayout.setSpacing(true);
            imageLayout.setWidth(1100, Sizeable.UNITS_PIXELS);
            imageLayout.setHeight(600, Sizeable.UNITS_PIXELS);
            final Panel panel = new Panel();
            panel.getContent().setSizeUndefined();
            TaskGraph tg = new TaskGraph(processDefinitionId, null);
            panel.addComponent(tg);
            panel.setSizeFull();
            panel.setScrollable(true);
            imageLayout.addComponent(panel);
            imageLayout.setExpandRatio(back, 0.01f);
            imageLayout.setExpandRatio(panel, 0.99f);
            changer.change(imageLayout);
        }
    });
    layout.addComponent(showScheme);

    Table table = new Table();
    table.setSizeFull();
    table.setImmediate(true);
    table.setSelectable(true);
    table.setSortDisabled(true);
    table.setPageLength(0);
    table.setSelectable(false);
    table.addContainerProperty("id", String.class, null);
    table.addContainerProperty("name", String.class, null);
    table.addContainerProperty("accessPermissions", Component.class, null);
    table.addContainerProperty("formProperties", Component.class, null);
    table.addContainerProperty("other", String.class, null);
    table.setColumnHeaders(new String[] { " ?", "?",
            /*" ?",*/ " ?", "? ",
            "? " });
    table.setColumnExpandRatio("id", 0.1f);
    table.setColumnExpandRatio("name", 0.1f);
    table.setColumnExpandRatio("accessPermissions", 0.1f);
    table.setColumnExpandRatio("formProperties", 0.4f);
    table.setColumnExpandRatio("other", 0.2f);
    fillTable(table);

    layout.addComponent(label);
    layout.setExpandRatio(label, 1);

    layout.addComponent(table);
    layout.setExpandRatio(table, 40);

    return layout;
}

From source file:ru.codeinside.gses.webui.form.GridForm.java

License:Mozilla Public License

void buildControls(final FieldTree.Entry entry, int level) {
    switch (entry.type) {
    case ITEM://www . j a  v a2s  .  c o m
    case BLOCK:
        if (!entry.readable)
            break; // ?   ? ? ?,       
        if (isNotBlank(entry.caption)) {
            Label caption = new Label(entry.caption);
            caption.setStyleName("right");
            if (entry.type == FieldTree.Type.BLOCK) {
                caption.addStyleName("bold");
            }
            caption.setWidth(300, UNITS_PIXELS);
            caption.setHeight(100, UNITS_PERCENTAGE);
            gridLayout.addComponent(caption, level, entry.index, valueColumn - 1, entry.index);
            gridLayout.setComponentAlignment(caption, Alignment.TOP_RIGHT);
        }
        final Component sign = entry.sign;
        if (sign != null) {
            gridLayout.addComponent(sign, valueColumn + 1, entry.index);
            gridLayout.setComponentAlignment(sign, Alignment.TOP_LEFT);
            if (!entry.readOnly) {
                entry.field.addListener(new ValueChangeListener() {
                    @Override
                    public void valueChange(Property.ValueChangeEvent event) {
                        entry.field.removeListener(this);
                        gridLayout.removeComponent(sign);
                        entry.sign = null;
                    }
                });
            }
        }
        // ???  
        addField(entry.path, entry.field);
        break;
    case CONTROLS:
        HorizontalLayout layout = new HorizontalLayout();
        layout.setImmediate(true);
        layout.setSpacing(true);
        layout.setMargin(false, false, true, false);
        Button plus = createButton("+");
        Button minus = createButton("-");
        layout.addComponent(plus);
        layout.addComponent(minus);
        FieldTree.Entry block = getBlock(entry);
        plus.addListener(new AppendAction(entry, minus));
        minus.addListener(new RemoveAction(entry, plus));
        if (block.field != null) {
            final StringBuilder sb = new StringBuilder();
            if (!isBlank(block.caption)) {
                sb.append(' ').append('\'').append(block.caption).append('\'');
            }
            if (block.field.getDescription() != null) {
                sb.append(' ').append('(').append(block.field.getDescription()).append(')');
            }
            plus.setDescription("" + sb);
            minus.setDescription("" + sb);
        }
        updateCloneButtons(plus, minus, block);
        gridLayout.addComponent(layout, valueColumn, entry.index, valueColumn, entry.index);
        break;
    case CLONE:
        int y = entry.index;
        int dy = entry.getControlsCount() - 1;
        Label cloneCaption = new Label(entry.cloneIndex + ")");
        cloneCaption.setWidth(20, UNITS_PIXELS);
        cloneCaption.setStyleName("right");
        cloneCaption.addStyleName("bold");
        gridLayout.addComponent(cloneCaption, level - 1, y, level - 1, y + dy);
        gridLayout.setComponentAlignment(cloneCaption, Alignment.TOP_RIGHT);
        break;
    case ROOT:
        break;
    default:
        throw new IllegalStateException(
                "??? ?  ? " + entry.type);
    }

    if (entry.items != null) { //  ?  ?
        if (entry.type == FieldTree.Type.BLOCK) {
            level++;
        }
        for (FieldTree.Entry child : entry.items) {
            buildControls(child, level);
        }
    }
}

From source file:ru.codeinside.gses.webui.form.TaskForm.java

License:Mozilla Public License

private void addLabel(ComponentContainer container, String text, String style) {
    text = StringUtils.trimToNull(text);
    if (text != null) {
        Label label = new Label(text);
        if (style != null) {
            label.setStyleName(style);
        }/*www. j  ava2 s .  c  om*/
        container.addComponent(label);
    }
}

From source file:ru.codeinside.gses.webui.supervisor.ConfirmWindow.java

License:Mozilla Public License

public ConfirmWindow(String confirmMessage) {
    setCaption("!");
    setWidth("30%");
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();/* w  ww . j  a  v  a2  s . co m*/
    vl.setSpacing(true);
    Label messageLabel = new Label(confirmMessage);
    messageLabel.setStyleName("h1");
    vl.addComponent(messageLabel);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeFull();
    hl.setSpacing(true);
    Button okButton = new Button("");
    Button noButton = new Button("?");
    okButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            fireEvent(new ConfirmOkEvent(event.getComponent()));
            close();
        }
    });
    noButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });
    hl.addComponent(okButton);
    hl.addComponent(noButton);
    hl.setExpandRatio(okButton, 0.99f);
    vl.addComponent(hl);
    addComponent(vl);
    center();
}

From source file:ru.codeinside.gses.webui.supervisor.SupervisorWorkplace.java

License:Mozilla Public License

private void buildListPanel() {
    controlledTasksTable.setHeight("255px");
    controlledTasksTable.setWidth("100%");
    controlledTasksTable.setImmediate(true);
    controlledTasksTable.setSelectable(true);
    controlledTasksTable.setSortDisabled(true);
    controlledTasksTable.addContainerProperty("id", Component.class, null);
    controlledTasksTable.addContainerProperty("dateCreated", String.class, null);
    controlledTasksTable.addContainerProperty("task", String.class, null);
    controlledTasksTable.addContainerProperty("procedure", String.class, null);
    controlledTasksTable.addContainerProperty("declarant", String.class, null);
    controlledTasksTable.addContainerProperty("version", String.class, null);
    controlledTasksTable.addContainerProperty("status", String.class, null);
    controlledTasksTable.addContainerProperty("employee", String.class, null);
    controlledTasksTable.addContainerProperty("priority", String.class, null);
    controlledTasksTable.addContainerProperty("bidDays", String.class, null);
    controlledTasksTable.addContainerProperty("taskDays", String.class, null);
    controlledTasksTable.setVisibleColumns(new Object[] { "id", "dateCreated", "task", "procedure", "declarant",
            "version", "status", "employee", "bidDays", "taskDays" });
    controlledTasksTable.setColumnHeaders(new String[] { "?", "  ?",
            "", "", "?", "??", "?",
            "?", "..", ".?." });
    controlledTasksTable.setColumnExpandRatio("id", 0.05f);
    controlledTasksTable.setColumnExpandRatio("dateCreated", 0.15f);
    controlledTasksTable.setColumnExpandRatio("task", 0.2f);
    controlledTasksTable.setColumnExpandRatio("procedure", 0.25f);
    controlledTasksTable.setColumnExpandRatio("declarant", 0.1f);
    controlledTasksTable.setColumnExpandRatio("version", 0.05f);
    controlledTasksTable.setColumnExpandRatio("status", 0.1f);
    controlledTasksTable.setColumnExpandRatio("employee", 0.1f);
    controlledTasksTable.setCellStyleGenerator(new TaskStylist(controlledTasksTable));
    listPanel.addComponent(controlledTasksTable);
    final Button assignButton = new Button("? ??");
    controlledTasksTable.addListener(new Property.ValueChangeListener() {
        @Override/*from ww w. j a  v  a2  s.  co  m*/
        public void valueChange(Property.ValueChangeEvent event) {
            Table table = (Table) event.getProperty();
            Item item = table.getItem(table.getValue());

            if (item != null && item.getItemProperty("id") != null) {
                final String taskId = item.getItemProperty("taskId").getValue().toString();
                final Component procedureHistoryPanel = new ProcedureHistoryPanel(taskId);
                procedureHistoryPanel.addListener(new Listener() {
                    @Override
                    public void componentEvent(Event event) {
                        HistoricTaskInstance historicTaskInstance = ((ProcedureHistoryPanel.HistoryStepClickedEvent) event)
                                .getHistoricTaskInstance();
                        Date endDateTime = historicTaskInstance.getEndTime();
                        if (endDateTime == null) {
                            taskIdToAssign = findTaskByHistoricInstance(historicTaskInstance);
                            if (taskIdToAssign == null) {
                                alreadyGone();
                                return;
                            }
                            assignButton.setVisible(true);
                        } else {
                            assignButton.setVisible(false);
                        }
                    }
                });
                ((VerticalLayout) item1).removeAllComponents();
                Task task = Flash.flash().getProcessEngine().getTaskService().createTaskQuery().taskId(taskId)
                        .singleResult();
                Bid bid = Flash.flash().getAdminService().getBidByTask(taskId);
                String executionId = task.getExecutionId();
                final ProcessDefinition def = ActivitiBean.get()
                        .getProcessDefinition(task.getProcessDefinitionId(), Flash.login());
                final ShowDiagramComponentParameterObject param = new ShowDiagramComponentParameterObject();
                param.changer = bidChanger;
                param.processDefinitionId = def.getId();
                param.executionId = executionId;
                param.height = "300px";
                param.width = null;
                param.windowHeader = bid == null ? ""
                        : bid.getProcedure().getName() + " v. " + bid.getVersion();
                Button showDiagram = new Button("");
                showDiagram.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        Execution execution = Flash.flash().getProcessEngine().getRuntimeService()
                                .createExecutionQuery().executionId(param.executionId).singleResult();
                        if (execution == null) {
                            alreadyGone();
                            return;
                        }
                        ShowDiagramComponent showDiagramComponent = new ShowDiagramComponent(param);
                        VerticalLayout layout = new VerticalLayout();
                        Button back = new Button("?");
                        back.addListener(new Button.ClickListener() {
                            private static final long serialVersionUID = 4154712522487297925L;

                            @Override
                            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                                bidChanger.back();
                            }
                        });
                        layout.addComponent(back);
                        layout.setSpacing(true);
                        layout.addComponent(showDiagramComponent);
                        bidChanger.set(layout, "showDiagram");
                        bidChanger.change(layout);
                    }
                });

                Button deleteBidButton = new Button(" ?");
                deleteBidButton.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        final Window mainWindow = getWindow();
                        final Window rejectWindow = new Window();
                        rejectWindow.setWidth("38%");
                        rejectWindow.center();
                        rejectWindow.setCaption("!");
                        final VerticalLayout verticalLayout = new VerticalLayout();
                        verticalLayout.setSpacing(true);
                        verticalLayout.setMargin(true);
                        final Label messageLabel = new Label(
                                "  ? ?");
                        messageLabel.setStyleName("h2");
                        final TextArea textArea = new TextArea();
                        textArea.setSizeFull();
                        HorizontalLayout buttons = new HorizontalLayout();
                        buttons.setSpacing(true);
                        buttons.setSizeFull();
                        final Button ok = new Button("Ok");
                        Button cancel = new Button("Cancel");

                        buttons.addComponent(ok);
                        buttons.addComponent(cancel);
                        buttons.setExpandRatio(ok, 0.99f);
                        verticalLayout.addComponent(messageLabel);
                        verticalLayout.addComponent(textArea);
                        verticalLayout.addComponent(buttons);
                        verticalLayout.setExpandRatio(textArea, 0.99f);
                        rejectWindow.setContent(verticalLayout);
                        mainWindow.addWindow(rejectWindow);

                        Button.ClickListener ok1 = new Button.ClickListener() {
                            @Override
                            public void buttonClick(Button.ClickEvent event) {
                                ok.setEnabled(false);
                                verticalLayout.removeComponent(messageLabel);
                                verticalLayout.removeComponent(textArea);
                                final byte[] block;
                                final String textAreaValue = (String) textArea.getValue();
                                if (textAreaValue != null) {
                                    block = textAreaValue.getBytes();
                                } else {
                                    block = null;
                                }
                                Label reason = new Label(textAreaValue);
                                reason.setCaption(" :");
                                verticalLayout.addComponent(reason, 0);
                                event.getButton().removeListener(this);

                                SignApplet signApplet = new SignApplet(new SignAppletListener() {

                                    @Override
                                    public void onLoading(SignApplet signApplet) {

                                    }

                                    @Override
                                    public void onNoJcp(SignApplet signApplet) {
                                        verticalLayout.removeComponent(signApplet);
                                        ReadOnly field = new ReadOnly(
                                                "   ?? ?? ?  JCP",
                                                false);
                                        verticalLayout.addComponent(field);

                                    }

                                    @Override
                                    public void onCert(SignApplet signApplet, X509Certificate certificate) {
                                        boolean ok = false;
                                        String errorClause = null;
                                        try {
                                            boolean link = AdminServiceProvider
                                                    .getBoolProperty(CertificateVerifier.LINK_CERTIFICATE);
                                            if (link) {
                                                byte[] x509 = AdminServiceProvider.get()
                                                        .withEmployee(Flash.login(), new CertificateReader());
                                                ok = Arrays.equals(x509, certificate.getEncoded());
                                            } else {
                                                ok = true;
                                            }
                                            CertificateVerifyClientProvider.getInstance()
                                                    .verifyCertificate(certificate);
                                        } catch (CertificateEncodingException e) {
                                        } catch (CertificateInvalid err) {
                                            errorClause = err.getMessage();
                                            ok = false;
                                        }
                                        if (ok) {
                                            signApplet.block(1, 1);
                                        } else {
                                            NameParts subject = X509.getSubjectParts(certificate);
                                            String fieldValue = (errorClause == null)
                                                    ? " " + subject.getShortName()
                                                            + " "
                                                    : errorClause;
                                            ReadOnly field = new ReadOnly(fieldValue, false);
                                            verticalLayout.addComponent(field, 0);
                                        }
                                    }

                                    @Override
                                    public void onBlockAck(SignApplet signApplet, int i) {
                                        logger().fine("AckBlock:" + i);
                                        signApplet.chunk(1, 1, block);
                                    }

                                    @Override
                                    public void onChunkAck(SignApplet signApplet, int i) {
                                        logger().fine("AckChunk:" + i);
                                    }

                                    @Override
                                    public void onSign(SignApplet signApplet, byte[] sign) {
                                        final int i = signApplet.getBlockAck();
                                        logger().fine("done block:" + i);
                                        if (i < 1) {
                                            signApplet.block(i + 1, 1);
                                        } else {
                                            verticalLayout.removeComponent(signApplet);
                                            NameParts subjectParts = X509
                                                    .getSubjectParts(signApplet.getCertificate());
                                            Label field2 = new Label(subjectParts.getShortName());
                                            field2.setCaption("? ?:");
                                            verticalLayout.addComponent(field2, 0);
                                            ok.setEnabled(true);
                                        }
                                    }

                                    private Logger logger() {
                                        return Logger.getLogger(getClass().getName());
                                    }
                                });
                                byte[] x509 = AdminServiceProvider.get().withEmployee(Flash.login(),
                                        new CertificateReader());
                                if (x509 != null) {
                                    signApplet.setSignMode(x509);
                                } else {
                                    signApplet.setUnboundSignMode();
                                }
                                verticalLayout.addComponent(signApplet, 0);

                                ok.addListener(new Button.ClickListener() {
                                    @Override
                                    public void buttonClick(Button.ClickEvent event) {
                                        Task result = Flash.flash().getProcessEngine().getTaskService()
                                                .createTaskQuery().taskId(taskId).singleResult();
                                        if (result == null) {
                                            alreadyGone();
                                            return;
                                        }
                                        ActivitiBean.get().deleteProcessInstance(taskId, textAreaValue);
                                        AdminServiceProvider.get().createLog(Flash.getActor(), "activiti.task",
                                                taskId, "remove", " ?", true);
                                        fireTaskChangedEvent(taskId, SupervisorWorkplace.this);
                                        infoChanger.change(infoComponent);
                                        controlledTasksTable.setValue(null);
                                        controlledTasksTable.refresh();
                                        mainWindow.removeWindow(rejectWindow);
                                    }
                                });
                            }
                        };
                        ok.addListener(ok1);

                        cancel.addListener(new Button.ClickListener() {
                            @Override
                            public void buttonClick(Button.ClickEvent event) {

                                controlledTasksTable.refresh();
                                mainWindow.removeWindow(rejectWindow);
                            }
                        });
                    }
                });

                HorizontalLayout hl = new HorizontalLayout();
                hl.setSizeFull();
                hl.setSpacing(true);
                hl.addComponent(showDiagram);
                hl.addComponent(deleteBidButton);
                hl.setExpandRatio(showDiagram, 0.99f);
                hl.setExpandRatio(deleteBidButton, 0.01f);

                ((VerticalLayout) item1).addComponent(hl);
                ((VerticalLayout) item1).addComponent(procedureHistoryPanel);
                assignButton.setVisible(false);
                assignButton.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        ((Layout) item3).removeAllComponents();
                        if (taskIdToAssign != null) {
                            ((Layout) item3).addComponent(createAssignerToTaskComponent(taskIdToAssign,
                                    (ProcedureHistoryPanel) procedureHistoryPanel, controlledTasksTable));
                            bidChanger.change(item3);
                        } else {
                            alreadyGone();
                        }
                    }
                });
                ((VerticalLayout) item1).addComponent(assignButton);
                infoChanger.change(bidComponent);
                bidChanger.change(item1);
            } else {
                ((VerticalLayout) item1).removeAllComponents();
            }
        }
    });
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.components.configeditor.ConfigNodeValuesEditor.java

License:Open Source License

/**
 * Loads the values to edit for the specified node.
 *//*from w  w w  .j av a  2s .c o  m*/
public void refreshData() {

    this.rootLayout.removeAllComponents();

    Label nodeDescription = new Label(this.dataSource.getNodeDescription(), Label.CONTENT_XHTML);
    addComponent(nodeDescription);

    addComponent(new HorizontalLine());

    // If we have a node that there can be only one of or if we have a "many" node where an instance of that
    // "many" node is selected then render the configuration values of that node.
    if (!this.dataSource.isManyNode() || (this.dataSource.isManyNode() && this.dataSource.getIndex() >= 0)) {

        List<APSConfigValueEditModel> nodeValues = this.dataSource.getNodeValues();

        for (APSConfigValueEditModel valueModel : nodeValues) {
            String nameText = "<b>" + valueModel.getName() + "</b>";
            if (valueModel.isConfigEnvironmentSpecific()) {
                nameText += " (" + this.dataSource.getCurrentConfigEnvironment().getName() + ")";
            }
            if (valueModel.getDatePattern().trim().length() > 0) {
                nameText += " [ " + valueModel.getDatePattern().toLowerCase() + " ]";
            }
            Label name = new Label(nameText, Label.CONTENT_XHTML);
            addComponent(name);

            Label description = new Label(valueModel.getDescription());
            addComponent(description);

            ValueComponent valueComponent = null;

            // Date value
            if (valueModel.getDatePattern() != null && valueModel.getDatePattern().trim().length() > 0) {
                valueComponent = new DateValue(valueModel);
            }
            // Boolean value
            else if (valueModel.isBoolean()) {
                valueComponent = new BooleanValue(valueModel);
            }
            // Value with set of valid values.
            else if (valueModel.getValidValues().length > 0) {
                valueComponent = new ValidValuesValue(valueModel);
            }
            // Text value by default
            else {
                valueComponent = new TextValue(valueModel);
            }

            if (valueModel.isMany()) {
                ValueComponentListEditor valueComponentListEditor = new ValueComponentListEditor(valueModel,
                        valueComponent);
                valueComponentListEditor.setWidth("95%");
                valueComponentListEditor.setDataSource(this.dataSource);
                valueComponentListEditor.refreshData();
                addComponent(valueComponentListEditor);
            } else {
                valueComponent.addListener(this.valueChangedListener);
                valueComponent.setComponentValue(this.dataSource.getValue(valueModel), false);
                valueComponent.getComponent().setWidth("95%");
                addComponent(valueComponent.getComponent());
            }
        }

        if (nodeValues.isEmpty()) {
            Label label = new Label("There are no values to edit for this node!");
            label.setStyleName(CSS.APS_NO_CONFIG_VALUES_LABEL);
            addComponent(label);
        }
    }
    // Otherwise the user has selected the root/parent node of a "many" type node, whose instances are rendered as children of
    // that node. A "many" type node cannot be edited without having an instance of it. Therefore we display some help text
    // instead here.
    else {
        Label label = new Label(
                "You have selected a configuration node that there are zero or more of. This node only represents the "
                        + "type. Select one of the indexed instances of this node shown as children of this node to edit that "
                        + "specific instance. Or press the [ + ] button to add an instance node. Press the [ - ] button "
                        + "to delete the selected instance.");
        addComponent(label);
    }
}

From source file:ubu.digit.ui.components.Footer.java

License:Creative Commons License

/**
 * Aade la informacin del proyecto.//from w ww  .j  a va 2 s. co m
 */
private void addInformation() {
    VerticalLayout information = new VerticalLayout();
    information.setMargin(false);
    information.setSpacing(true);

    Label subtitle = new Label(INFORMACION);
    subtitle.setStyleName(SUBTITLE_STYLE);

    Label version2 = new Label("Versin 2.0 creada por Javier de la Fuente Barrios");
    Link link2 = new Link("jfb0019@alu.ubu.es", new ExternalResource("mailto:jfb0019@alu.ubu.es"));
    link2.setIcon(FontAwesome.ENVELOPE);

    Label version1 = new Label("Versin 1.0 creada por Beatriz Zurera Martnez-Acitores");
    Link link1 = new Link("bzm0001@alu.ubu.es", new ExternalResource("mailto:bzm0001@alu.ubu.es"));
    link1.setIcon(FontAwesome.ENVELOPE);

    Label tutor = new Label("Tutorizado por Carlos Lpez Nozal");
    Link linkT = new Link("clopezno@ubu.es", new ExternalResource("mailto:clopezno@alu.ubu.es"));
    linkT.setIcon(FontAwesome.ENVELOPE);

    Label copyright = new Label("Copyright @ LSI");

    information.addComponents(subtitle, version2, link2, version1, link1, tutor, linkT, copyright);
    content.addComponent(information);
}

From source file:ui.helper.TaskView.java

public TaskView(T achievement) {
    this.achievement = achievement;
    setSizeFull();//from  w  ww  .j  ava 2  s  .  c  o  m
    initTotals();

    Label value = new Label(String.valueOf(Math.round((totalNotNull / (double) total) * 100)) + "%");
    value.setStyleName("h1");

    Label valueAll = new Label(
            String.valueOf(Math.round((totalNotNullEquivalenceClass / (double) totalEquivalenceClass) * 100))
                    + "%");
    valueAll.setStyleName("h2");

    addComponents(value, valueAll);
}

From source file:uk.co.intec.keyDatesApp.pages.HomeView.java

License:Apache License

/**
 * Loads the main content for the page. Only called on first entry to the
 * page, because calling method sets <i>isLoaded</i> to true after
 * successfully completing.//from w w w . j a  v a2s . com
 */
public void loadContent() {
    if ("Anonymous".equals(GenericDatabaseUtils.getUserName())) {
        final Label warning = new Label();
        warning.setStyleName(ValoTheme.LABEL_H2);
        warning.setStyleName(ValoTheme.LABEL_FAILURE);
        warning.setValue("Anonymous access is not allowed on this application!");
        addComponent(warning);
    } else {
        if (GenericDatabaseUtils.doesDbExist()) {
            final Label intro = new Label();
            intro.setStyleName(ValoTheme.LABEL_H2);
            intro.setValue("Welcome to Key Dates OSGi Application");
            addComponent(intro);
        } else {
            final Label warning = new Label();
            warning.setStyleName(ValoTheme.LABEL_H2);
            warning.setStyleName(ValoTheme.LABEL_FAILURE);
            warning.setContentMode(ContentMode.HTML);
            warning.setValue(
                    "We cannot open the data database. Most likely reasons are:<ul><li>You don't have access to the database, in which case you should contact IT.</li>"
                            + "<li>The Key Dates database has not been set up at the filepath "
                            + AppUtils.getDataDbFilepath()
                            + ". Create the data database at that location or amend the 'dataDbFilePath' context parameter in WebContent > WEB-INF > web.xml of the application and issue 'restart task http' to the Domino server</li></ul>");
            addComponent(warning);
        }
    }
}

From source file:uk.co.intec.keyDatesApp.pages.MainView.java

License:Apache License

/**
 * Removes any existing row data loaded to the page and loads
 * ViewEntryWrappers passed to this method. If no entries were passed to the
 * method, the message "No entries found matching criteria" is displayed.
 * Otherwise writes the entries to the page, grouped under the date each Key
 * Date is for./* w  w  w.  java 2 s . c  o  m*/
 *
 * @param data
 *            Map of data where key is a java.sql.Date (so does not include
 *            a time element) and value is the wrapped ViewEntries for that
 *            date.
 */
public void loadRowData(final Map<Object, List<ViewEntryWrapper>> data) {
    body.removeAllComponents();
    if (null == data || data.isEmpty()) {
        final Label msg = new Label("No entries found matching criteria");
        msg.setStyleName(ValoTheme.LABEL_FAILURE);
        body.addComponent(msg);
    } else {
        for (final Object key : data.keySet()) {
            if (key instanceof java.sql.Date) { // It will be!
                // Add the header
                final VerticalLayout catContainer = new VerticalLayout();
                catContainer.addStyleName(ValoTheme.MENU_TITLE);
                catContainer.addStyleName("category-header");
                final Label category = new Label();
                final java.sql.Date sqlDate = (java.sql.Date) key;
                category.setValue(DATE_ONLY.format(sqlDate));
                catContainer.addComponent(category);
                body.addComponent(catContainer);

                // Load the entries
                for (final ViewEntryWrapper veWrapped : data.get(key)) {
                    final VerticalLayout entryRow = new VerticalLayout();
                    final KeyDateEntryWrapper entry = (KeyDateEntryWrapper) veWrapped;
                    final StringBuilder suffixTitle = new StringBuilder("");
                    if (getViewWrapper().getViewName().equals(KeyDateViewWrapper.ViewType.BY_DATE)) {
                        if (StringUtils.isNotEmpty(entry.getCustomer())) {
                            suffixTitle.append(" (" + entry.getCustomer());
                            if (StringUtils.isNotEmpty(entry.getContact())) {
                                suffixTitle.append(" - " + entry.getContact());
                            }
                            suffixTitle.append(")");
                        }
                    } else {
                        if (StringUtils.isNotEmpty(entry.getContact())) {
                            suffixTitle.append(" - " + entry.getContact());
                        }
                    }
                    final Button title = new Button(entry.getTitle() + suffixTitle.toString());
                    title.addStyleName(ValoTheme.BUTTON_LINK);
                    // Add click event
                    title.addClickListener(new DocLinkListener(KeyDateView.VIEW_NAME, entry.getNoteId()));
                    entryRow.addComponent(title);

                    // Add summary, if appropriate
                    if (StringUtils.isNotEmpty(entry.getDescription())) {
                        final Label summary = new Label(entry.getDescription());
                        summary.setContentMode(ContentMode.HTML);
                        summary.addStyleName(ValoTheme.LABEL_SMALL);
                        summary.addStyleName("view-desc");
                        entryRow.addComponent(summary);
                    }

                    body.addComponent(entryRow);
                }
            }
        }

    }
}