Example usage for com.vaadin.ui Label addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

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

License:Apache License

private void addInputField() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);// w w  w  .j  a v  a  2 s .  co  m
    layout.setWidth(100, UNITS_PERCENTAGE);
    loginPanel.addComponent(layout);

    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be
    // attached to panels or windows
    textFieldPanel.addStyleName(PANEL_LIGHT);
    textFieldPanel.setContent(new VerticalLayout());
    textFieldPanel.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(textFieldPanel);
    layout.setExpandRatio(textFieldPanel, 1.0f);

    Label labelUserName = new Label(i18nManager.getMessage(USER_NAME_TITLE));
    labelUserName.addStyleName(LABEL_SMALL);
    userNameInputField = new TextField();
    userNameInputField.setWidth(100, UNITS_PERCENTAGE);
    Label labelPassword = new Label(i18nManager.getMessage(PASSWORD_TITLE));
    labelPassword.addStyleName(LABEL_SMALL);
    passwordInputField = new PasswordField();
    passwordInputField.setWidth(100, UNITS_PERCENTAGE);
    textFieldPanel.addComponent(labelUserName);
    textFieldPanel.addComponent(userNameInputField);
    textFieldPanel.addComponent(labelPassword);
    textFieldPanel.addComponent(passwordInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        private static final long serialVersionUID = 6928598745792215505L;

        public void handleAction(Action action, Object sender, Object target) {
            login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString());
        }

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ENTER, null) };
        }
    });

    Button loginButton = new Button(i18nManager.getMessage(LOGIN));
    layout.addComponent(loginButton);
    layout.setComponentAlignment(loginButton, MIDDLE_LEFT);
    loginButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 7781253151592188006L;

        public void buttonClick(ClickEvent event) {
            login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString());
        }
    });
}

From source file:it.vige.greenarea.bpm.custom.ui.operatorelogistico.OperatoreLogisticoDetailPanel.java

License:Apache License

private void addTitle(Item item) {

    if (item != null) {
        String name = (String) item.getItemProperty("name").getValue();
        Label title = new Label(name.toUpperCase());
        title.addStyleName(LABEL_H2);
        addComponent(title);/*from w w w  . java2 s  .c o  m*/
    } else {
        String name = i18nManager.getMessage(MAIN_MENU_OPERATORE_LOGISTICO_HOME);
        Label title = new Label(name.toUpperCase());
        title.addStyleName(LABEL_H2);
        addComponent(title);
    }
}

From source file:it.vige.greenarea.bpm.custom.ui.societaditrasporto.SocietaDiTrasportoDetailPanel.java

License:Apache License

private void addTitle(Item item) {

    if (item != null) {
        String name = (String) item.getItemProperty("name").getValue();
        Label title = new Label(name.toUpperCase());
        title.addStyleName(LABEL_H2);
        addComponent(title);/*w w  w.ja va  2s .co  m*/
    } else {
        String name = i18nManager.getMessage(MAIN_MENU_SOCIETA_DI_TRASPORTO_HOME);
        Label title = new Label(name.toUpperCase());
        title.addStyleName(LABEL_H2);
        addComponent(title);
    }
}

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

License:Open Source License

public DialogConfirm(String caption, String message, Buttons buttons, Layout optionLayout) {
    super(caption);

    setModal(true);/* w w w. jav  a2 s  . c o  m*/
    setResizable(false);
    setClosable(false);
    setWidth("380px");
    addStyleName("dialog-confirm");
    setIcon(Icons.DLGWARNING.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setWidth("100%");
    layout.setMargin(false, true, false, true);
    layout.setSpacing(false);

    if (message != null && message.length() > 0) {

        // ?"\n"?"\t"???????"PREFORMATTED"??
        Label lbl;
        if (message.indexOf("\n") != -1 || message.indexOf("\t") != -1) {
            lbl = new Label(message, Label.CONTENT_PREFORMATTED);
        } else {
            lbl = new Label(message, Label.CONTENT_TEXT);
        }
        lbl.addStyleName("dialog-message");
        layout.addComponent(lbl);
    }

    // ????
    if (optionLayout != null) {
        optionLayout.addStyleName("dialog-confirm-option");
        addComponent(optionLayout);
        layout.setComponentAlignment(optionLayout, Alignment.MIDDLE_CENTER);
    }

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);

    // 
    okButton = new Button(ViewProperties.getCaption("button.ok"), this, "buttonClick");
    okButton.setDescription(ViewProperties.getCaption("description.ok"));
    okButton.setData(Result.OK);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    cancelButton = new Button(ViewProperties.getCaption("button.cancel"), this, "buttonClick");
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.setData(Result.Cancel);

    switch (buttons) {
    case OK:
        hl.addComponent(okButton);
        break;
    case OKCancel:
        hl.addComponent(okButton);
        hl.addComponent(cancelButton);
        break;
    case OKCancelConfirm:
        hl.addComponent(okButton);
        hl.addComponent(cancelButton);
        okButton.setEnabled(false);

        confirm = new ComboBox();
        confirm.setWidth("200px");
        confirm.setImmediate(true);
        confirm.addStyleName("dialog-confirm");
        confirm.setInputPrompt(ViewProperties.getCaption("description.dialogConfirmComboBox"));
        confirm.addItem(ViewProperties.getCaption("field.dialogConfirmComboBox"));
        confirm.addListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (confirm.getValue() != null) {
                    okButton.setEnabled(true);
                } else {
                    okButton.setEnabled(false);
                }
            }
        });
        layout.addComponent(confirm);
        layout.setComponentAlignment(confirm, Alignment.MIDDLE_CENTER);
        break;
    default:
        break;
    }

    layout.addComponent(hl);
    layout.setComponentAlignment(hl, Alignment.BOTTOM_CENTER);
}

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

License:Open Source License

@Override
public void attach() {
    addStyleName("loadbalancer-table-operation");
    setWidth("100%");
    setMargin(true);//from  ww w .j  a  v  a  2s .  co m

    // Add
    addButton = new Button(ViewProperties.getCaption("button.addLoadBalancer"));
    addButton.setDescription(ViewProperties.getCaption("description.addLoadBalancer"));
    addButton.setIcon(Icons.ADD.resource());
    addButton.addStyleName("left");
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            addButtonClick(event);
        }
    });
    addComponent(addButton);

    // 
    Label spacer = new Label(" ", Label.CONTENT_XHTML);
    spacer.setWidth("30px");
    spacer.addStyleName("left");
    addComponent(spacer);

    // Edit
    editButton = new Button(ViewProperties.getCaption("button.editLoadBalancer"));
    editButton.setDescription(ViewProperties.getCaption("description.editLoadBalancer"));
    editButton.setWidth("90px");
    editButton.setIcon(Icons.EDITMINI.resource());
    editButton.addStyleName("left");
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            editButtonClick(event);
        }
    });
    addComponent(editButton);

    // Delete
    deleteButton = new Button(ViewProperties.getCaption("button.deleteLoadBalancer"));
    deleteButton.setDescription(ViewProperties.getCaption("description.deleteLoadBalancer"));
    deleteButton.setWidth("90px");
    deleteButton.setIcon(Icons.DELETEMINI.resource());
    deleteButton.addStyleName("left");
    deleteButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            deleteButtonClick(event);
        }
    });
    addComponent(deleteButton);

    // Stop
    stopButton = new Button(ViewProperties.getCaption("button.stopLoadBalancer"));
    stopButton.setDescription(ViewProperties.getCaption("description.stopLoadBalancer"));
    stopButton.setWidth("90px");
    stopButton.setIcon(Icons.STOPMINI.resource());
    stopButton.addStyleName("right");
    stopButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            stopButtonClick(event);
        }
    });
    addComponent(stopButton);

    // Start
    startButton = new Button(ViewProperties.getCaption("button.startLoadBalancer"));
    startButton.setDescription(ViewProperties.getCaption("description.startLoadBalancer"));
    startButton.setWidth("90px");
    startButton.setIcon(Icons.PLAYMINI.resource());
    startButton.addStyleName("right");
    startButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            startButtonClick(event);
        }
    });
    addComponent(startButton);

    initialize();
}

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

License:Open Source License

@Override
public void attach() {
    setWidth("100%");
    setMargin(true);/* ww w . ja v  a2  s . c  om*/
    addStyleName("server-buttons");

    // Add
    addButton = new Button(ViewProperties.getCaption("button.addServer"));
    addButton.setDescription(ViewProperties.getCaption("description.addServer"));
    addButton.setIcon(Icons.ADD.resource());
    addButton.addStyleName("left");
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            addButtonClick(event);
        }
    });
    addComponent(addButton);

    // 
    Label spacer = new Label(" ", Label.CONTENT_XHTML);
    spacer.setWidth("30px");
    spacer.addStyleName("left");
    addComponent(spacer);

    // Edit
    editButton = new Button(ViewProperties.getCaption("button.editServer"));
    editButton.setDescription(ViewProperties.getCaption("description.editServer"));
    editButton.setWidth("90px");
    editButton.setIcon(Icons.EDITMINI.resource());
    editButton.addStyleName("left");
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            editButtonClick(event);
        }
    });
    addComponent(editButton);

    // Delete
    deleteButton = new Button(ViewProperties.getCaption("button.deleteServer"));
    deleteButton.setDescription(ViewProperties.getCaption("description.deleteServer"));
    deleteButton.setWidth("90px");
    deleteButton.setIcon(Icons.DELETEMINI.resource());
    deleteButton.addStyleName("left");
    deleteButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            deleteButtonClick(event);
        }
    });
    addComponent(deleteButton);

    // Stop
    stopButton = new Button(ViewProperties.getCaption("button.stopServer"));
    stopButton.setDescription(ViewProperties.getCaption("description.stopServer"));
    stopButton.setWidth("90px");
    stopButton.setIcon(Icons.STOPMINI.resource());
    stopButton.addStyleName("right");
    stopButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            stopButtonClick(event);
        }
    });
    addComponent(stopButton);

    // Start
    startButton = new Button(ViewProperties.getCaption("button.startServer"));
    startButton.setDescription(ViewProperties.getCaption("description.startServer"));
    startButton.setWidth("90px");
    startButton.setIcon(Icons.PLAYMINI.resource());
    startButton.addStyleName("right");
    startButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            startButtonClick(event);
        }
    });
    addComponent(startButton);

    // ??????
    boolean useZabbix = BooleanUtils.toBoolean(Config.getProperty("zabbix.useZabbix"));
    boolean changeMonitoring = BooleanUtils.toBoolean(Config.getProperty("zabbix.changeMonitoring"));
    if (useZabbix && changeMonitoring) {
        // Stop Monitoring 
        stopMonitoringButton = new Button(ViewProperties.getCaption("button.stopMonitoring"));
        stopMonitoringButton.setDescription(ViewProperties.getCaption("description.stopMonitoring"));
        stopMonitoringButton.setWidth("150px");
        stopMonitoringButton.setIcon(Icons.STOP_MONITORING.resource());
        stopMonitoringButton.addStyleName("right");
        stopMonitoringButton.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                stopMonitoringButtonClick(event);
            }
        });
        addComponent(stopMonitoringButton);

        // Start Monitoring 
        startMonitoringButton = new Button(ViewProperties.getCaption("button.startMonitoring"));
        startMonitoringButton.setDescription(ViewProperties.getCaption("description.startMonitoring"));
        startMonitoringButton.setWidth("150px");
        startMonitoringButton.setIcon(Icons.START_MONITORING.resource());
        startMonitoringButton.addStyleName("right");
        startMonitoringButton.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                startMonitoringButtonClick(event);
            }
        });
        addComponent(startMonitoringButton);
    }

    initialize();
}

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

License:Open Source License

public ServerDescBasic() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);//from w ww . jav a  2s  .co  m

    VerticalLayout panel = (VerticalLayout) getContent();
    panel.setWidth("100%");
    panel.setHeight("100%");
    panel.setMargin(true);
    panel.setSpacing(false);
    panel.addStyleName("server-desc-basic");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("server-desc-basic");
    //        setContent(hlPanels);

    left.setWidth("100%");
    right.setHeight("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    hlPanels.addComponent(left);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(right);
    hlPanels.setExpandRatio(left, 40);
    hlPanels.setExpandRatio(right, 60);

    panel.addComponent(hlPanels);
    panel.setExpandRatio(hlPanels, 1.0f);

}

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

License:Open Source License

@Override
public void attach() {
    setWidth("100%");
    setMargin(true);//w w w. j a v  a 2 s  .c  o m
    addStyleName("service-buttons");

    // Add
    addButton = new Button(ViewProperties.getCaption("button.addService"));
    addButton.setDescription(ViewProperties.getCaption("description.addService"));
    addButton.setIcon(Icons.ADD.resource());
    addButton.addStyleName("left");
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            addButtonClick(event);
        }
    });
    addComponent(addButton);

    // 
    Label spacer = new Label(" ", Label.CONTENT_XHTML);
    spacer.setWidth("30px");
    spacer.addStyleName("left");
    addComponent(spacer);

    // Edit
    editButton = new Button(ViewProperties.getCaption("button.editService"));
    editButton.setDescription(ViewProperties.getCaption("description.editService"));
    editButton.setWidth("90px");
    editButton.setIcon(Icons.EDITMINI.resource());
    editButton.addStyleName("left");
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            editButtonClick(event);
        }
    });
    addComponent(editButton);

    // Delete
    deleteButton = new Button(ViewProperties.getCaption("button.deleteService"));
    deleteButton.setDescription(ViewProperties.getCaption("description.deleteService"));
    deleteButton.setWidth("90px");
    deleteButton.setIcon(Icons.DELETEMINI.resource());
    deleteButton.addStyleName("left");
    deleteButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            deleteButtonClick(event);
        }
    });
    addComponent(deleteButton);

    initialize();
}

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

License:Open Source License

public ServiceDescBasic() {

    addStyleName(Reindeer.PANEL_LIGHT);//  w ww  .  j  av  a  2s . c  om

    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-basic");
    setContent(hlPanels);

    left.setWidth("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("100%");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    VerticalLayout layRight = new VerticalLayout();
    layRight.setMargin(false);
    layRight.setSpacing(false);
    layRight.setWidth("100%");
    layRight.setHeight("100%");
    layRight.addComponent(right);
    layRight.addComponent(serverOpe);
    layRight.setExpandRatio(right, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(layRight);
    hlPanels.setExpandRatio(layLeft, 40);
    hlPanels.setExpandRatio(layRight, 60);
}

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

License:Open Source License

@Override
public void attach() {
    addStyleName("TopBar");
    setWidth("100%");
    setHeight("30px");
    setMargin(false, true, false, false);

    // PrimeCloud
    Label plbl = new Label(IconUtils.createImageTag(getApplication(), Icons.PCCLOGO), Label.CONTENT_XHTML);
    plbl.addStyleName("logo");
    addComponent(plbl);//from  ww  w . ja  v a 2 s.co  m

    // ??
    String versionProp = Config.getVersionProperty("version");
    if (StringUtils.isNotEmpty(versionProp)) {
        StringBuilder version = new StringBuilder();
        version.append("ver").append(versionProp);
        Label versionNo = new Label("<p>" + version.toString() + "</p>", Label.CONTENT_XHTML);
        versionNo.addStyleName("versionNo");
        addComponent(versionNo);
    } else {
        Label versionNo = new Label("<p></p>", Label.CONTENT_XHTML);
        versionNo.addStyleName("versionNoNone");
        addComponent(versionNo);
    }

    // myCloud?
    Button myCloudButton = new Button(ViewProperties.getCaption("button.myCloudManage"));
    myCloudButton.setDescription(ViewProperties.getCaption("description.myCloudManage"));
    myCloudButton.addStyleName("borderless");
    myCloudButton.addStyleName("mycloud");
    myCloudButton.setIcon(Icons.CLOUDBIG.resource());
    myCloudButton.setVisible(true);
    myCloudButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            showCloudEditWindow();
        }
    });
    addComponent(myCloudButton);

    // (Zabbix)
    String useZabbix = Config.getProperty("zabbix.useZabbix");
    if (useZabbix == null || BooleanUtils.toBoolean(useZabbix)) {
        String url = Config.getProperty("zabbix.display");
        Link zabbix = new Link(ViewProperties.getCaption("link.zabbix"), new ExternalResource(url));
        zabbix.setDescription(ViewProperties.getCaption("description.link.zabbix"));
        zabbix.setIcon(Icons.MNGSYSTEM.resource());
        zabbix.setTargetName("_blank");
        zabbix.addStyleName("zabbix");
        addComponent(zabbix);
    }

    // 
    Button eventLogButton = new Button(ViewProperties.getCaption("link.eventlog"));
    eventLogButton.setDescription(ViewProperties.getCaption("description.link.eventlog"));
    eventLogButton.addStyleName("borderless");
    eventLogButton.addStyleName("eventlog");
    eventLogButton.setIcon(Icons.CUSTOM.resource());
    eventLogButton.setVisible(true);
    eventLogButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinLogView window = new WinLogView();
            getApplication().addWindow(window);
            getApplication().getMainWindow().open(new ExternalResource(window.getURL()), "_blank");
        }
    });
    addComponent(eventLogButton);

    // 
    Boolean usePayment = BooleanUtils.toBooleanObject(Config.getProperty("payment.usePayment"));
    if (BooleanUtils.isTrue(usePayment)) {
        String url2 = Config.getProperty("payment.display");
        Link payment = new Link(ViewProperties.getCaption("link.payment"), new ExternalResource(url2));
        payment.setDescription(ViewProperties.getCaption("description.link.payment"));
        payment.setIcon(Icons.PAYSYSTEM.resource());
        payment.setTargetName("_payment");
        payment.addStyleName("payment");
        addComponent(payment);
    }

    // 
    Button logoutButton = new Button(ViewProperties.getCaption("button.logout"));
    logoutButton.setDescription(ViewProperties.getCaption("description.logout"));
    logoutButton.addStyleName("borderless");
    logoutButton.addStyleName("logout");
    logoutButton.setIcon(Icons.LOGOUT.resource());
    logoutButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.dialogConfirm"),
                    ViewMessages.getMessage("IUI-000001"), Buttons.OKCancel);
            Callback callback = new Callback() {
                @Override
                public void onDialogResult(Result result) {
                    if (result == Result.OK) {
                        // ?
                        LoggingUtils.removeContext();
                        ContextUtils.invalidateSession();
                        accountButton.setVisible(false);

                        // ????
                        getApplication().close();
                    }
                }
            };
            dialog.setCallback(callback);
            getApplication().getMainWindow().addWindow(dialog);
        }
    });
    addComponent(logoutButton);

    // ?
    accountButton = new Button(ViewProperties.getCaption("button.account"));
    accountButton.setDescription(ViewProperties.getCaption("description.account"));
    accountButton.addStyleName("borderless");
    accountButton.addStyleName("account");
    accountButton.setIcon(Icons.USER.resource());
    accountButton.setVisible(false);
    addComponent(accountButton);
}