Example usage for com.vaadin.ui Label setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private void addLinkUserContainer() {

    VerticalLayout cDeletePrompt = new VerticalLayout();
    cPlaceholder.addComponent(cDeletePrompt);
    cPlaceholder.setComponentAlignment(cDeletePrompt, Alignment.MIDDLE_CENTER);
    // cDeletePrompt.setWidth("100%");
    cDeletePrompt.setStyleName("c_link");
    cDeletePrompt.setSpacing(true);/*www .j  a va2  s. c o  m*/
    String username = curUser;

    Label lbActivationPrompt = new Label(
            "<span style='text-align: center;'>Please enter Child Username to link to " + username
                    + "'s Account</span>");
    lbActivationPrompt.setContentMode(ContentMode.HTML);
    lbActivationPrompt.setWidth("300px");
    lbActivationPrompt.setStyleName("lb_link_user");

    cDeletePrompt.addComponent(lbActivationPrompt);
    cDeletePrompt.setComponentAlignment(lbActivationPrompt, Alignment.TOP_LEFT);

    VerticalLayout frmDeleteReason = new VerticalLayout();
    frmDeleteReason.setSizeUndefined();
    frmDeleteReason.setSpacing(true);
    frmDeleteReason.setMargin(true);
    cDeletePrompt.addComponent(frmDeleteReason);
    cDeletePrompt.setComponentAlignment(frmDeleteReason, Alignment.TOP_CENTER);

    tFU = new TextField("Child Username");
    tFU.setRequired(true);

    final ComboBox comboUProf = new ComboBox("Select Profile");
    comboUProf.setNullSelectionAllowed(false);
    comboUProf.setRequired(true);
    comboUProf.addItem(8);
    comboUProf.setItemCaption(8, "DEPOSIT_ONLY");

    comboUProf.addItem(9);
    comboUProf.setItemCaption(9, "DEPOSIT_AND_WITHDRAWAL");

    comboUProf.select(8);

    final TextField tFP = new TextField("Parent Account ID");
    tFP.setValue(username);
    tFP.setEnabled(false);

    final TextField tFInitUser = new TextField("Initiating User");
    tFInitUser.setValue(UI.getCurrent().getSession().getAttribute("user").toString());
    tFInitUser.focus();
    tFInitUser.setEnabled(false);

    frmDeleteReason.addComponent(tFU);
    frmDeleteReason.addComponent(comboUProf);
    frmDeleteReason.addComponent(tFP);
    frmDeleteReason.addComponent(tFInitUser);

    HorizontalLayout cPopupBtns = new HorizontalLayout();
    cPopupBtns.setSizeUndefined();
    cPopupBtns.setSpacing(true);

    final Button btnCancel = new Button();
    btnCancel.setIcon(FontAwesome.UNDO);
    btnCancel.setStyleName("btn_link");
    btnCancel.setDescription("Cancel");

    final Button btnSet = new Button("Link");
    btnSet.setDescription("Link specified account.");
    btnSet.setIcon(FontAwesome.LINK);
    cPopupBtns.addComponent(btnSet);
    cPopupBtns.addComponent(btnCancel);
    frmDeleteReason.addComponent(cPopupBtns);

    cDeletePrompt.setComponentAlignment(frmDeleteReason, Alignment.MIDDLE_CENTER);
    btnSet.setClickShortcut(KeyCode.ENTER, null);

    btnSet.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -6318666715385643538L;

        @Override
        public void buttonClick(ClickEvent event) {

            tFU.validate();
            btnSet.setEnabled(false);
            btnCancel.setEnabled(false);

            Button btn = event.getButton();

            if (ums == null)
                ums = new UserManagementService();
            btn.setEnabled(false);

            String strResponse = null;
            try {

                strResponse = UserManagementService.linkUser(tFP.getValue(),
                        new Integer(comboUProf.getValue().toString()), tFInitUser.getValue(), tFU.getValue());

                if (strResponse.equals("The operation was successful and completed")) {

                    updateLinksTable(tFU.getValue());
                    cPlaceholder.setVisible(false);
                    tFU.setValue("");
                    btnLink.setVisible(true);

                    NotifCustom.show("Link", strResponse);

                } else {
                    NotifCustom.show("Link", strResponse);
                }

            } catch (RemoteException e) {

                e.printStackTrace();

            }

            btnSet.setEnabled(true);
            btnCancel.setEnabled(true);

        }
    });

    btnCancel.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 7161821652386306043L;

        @Override
        public void buttonClick(ClickEvent event) {
            btnLink.setVisible(true);
            cPlaceholder.setVisible(false);

        }

    });

}

From source file:com.vaadin.uitest.Accordions.java

License:Apache License

Accordion getAccordion(String caption) {
    TestIcon testIcon = new TestIcon(0);
    Accordion ac = new Accordion();
    ac.setCaption(caption);//from  ww  w  .  j a  v  a2s.  co  m
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label(
                    "Fabio vel iudice vincam, sunt in culpa qui officia. Ut enim ad minim veniam, quis nostrud exercitation.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "First Caption", testIcon.get());
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label("Gallia est omnis divisa in partes tres, quarum.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "Second Caption", testIcon.get());
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label(
                    "Nihil hic munitissimus habendi senatus locus, nihil horum? Sed haec quis possit intrepidus aestimare tellus.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "Third Caption", testIcon.get());
    ac.addTab(new VerticalLayout() {
        {
            setMargin(true);
            Label label = new Label(
                    "Inmensae subtilitatis, obscuris et malesuada fames. Quisque ut dolor gravida, placerat libero vel, euismod.");
            label.setWidth("100%");
            addComponent(label);
        }
    }, "Custom Caption Style", testIcon.get()).setStyleName("color1");
    return ac;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.ErrorView.java

public ErrorView() {
    setSizeUndefined(); // <-- This is the important part

    this.setStyleName("error-page");
    setSizeFull();/*from  w  ww .j av  a2  s .  c  o m*/
    errorInfo = new VerticalLayout();
    this.addComponent(errorInfo);

    VerticalLayout errorTitle = new VerticalLayout();

    Label pagetitle = new Label("500");
    Label label = new Label("", Label.CONTENT_XHTML);

    label.setStyleName("error-page-line");
    label.setWidth("400px");
    pagetitle.setHeight("210px");
    Label errorType = new Label("Internal Server Error");
    pagetitle.setStyleName("error-page-title");
    errorTitle.addComponent(pagetitle);
    errorTitle.addComponent(label);
    errorTitle.setComponentAlignment(pagetitle, Alignment.BOTTOM_LEFT);
    errorTitle.setWidth("90%");
    errorInfo.setHeightUndefined();
    errorInfo.addComponent(errorTitle);
    errorInfo.setComponentAlignment(errorTitle, Alignment.BOTTOM_LEFT);

}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.ErrorView.java

public void displayErrorMessage(Exception ex, String title, String message) {

    VerticalLayout info = new VerticalLayout();
    errorInfo.addComponent(info);// w ww. ja  v  a 2  s .c om
    errorInfo.setComponentAlignment(info, Alignment.TOP_LEFT);
    info.setStyleName("error-page-information");

    if (title != null) {

    }

    if (message != null) {

    }

    if (ex != null) {
        Label label = new Label();
        label.setContentMode(Label.CONTENT_XHTML);
        label.setCaption(ex.getLocalizedMessage());
        info.addComponent(label);

        Label stacktraceLabel = new Label("Stacktrace");
        info.addComponent(stacktraceLabel);

        Label stacktrace = new Label();
        stacktrace.setWidth("50%");
        stacktrace.setStyleName("error-page-stacktrace");
        stacktrace.setCaptionAsHtml(true);
        StringWriter errors = new StringWriter();
        ex.printStackTrace(new PrintWriter(errors));
        stacktrace.setCaption(errors.toString());
        info.addComponent(stacktrace);
    }
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoadingView.java

public LoadingView() {
    setSizeFull();//from  w  w w  .  j a  v  a 2 s  .  c  om
    VerticalLayout center = new VerticalLayout();
    this.addComponent(center);
    this.setComponentAlignment(center, Alignment.MIDDLE_CENTER);

    center.setHeight("180px");
    HorizontalLayout info = new HorizontalLayout();

    Label title = new Label("PFServer Dashboard");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    // center.addComponent(title);
    // center.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    Label loading = new Label("Initalizing");
    loading.addStyleName(ValoTheme.LABEL_H1);
    loading.addStyleName(ValoTheme.LABEL_LIGHT);
    info.addComponent(loading);
    info.addComponent(title);
    info.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    center.addComponent(info);
    info.setComponentAlignment(loading, Alignment.MIDDLE_LEFT);
    loading.setWidth("160px");

    center.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
    // center.addComponent(loading);
    // center.setComponentAlignment(loading, Alignment.TOP_CENTER);
    ProgressBar indeterminate = new ProgressBar();
    indeterminate.setIndeterminate(true);
    center.addComponent(indeterminate);
    center.setComponentAlignment(indeterminate, Alignment.TOP_CENTER);

}

From source file:de.catma.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();/*  w  ww  .  j  a v  a2s  . c  o  m*/
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

From source file:de.catma.ui.analyzer.MarkupResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();/*from   www  . j a v  a 2  s.c  o m*/

    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    VerticalLayout leftComponent = new VerticalLayout();
    leftComponent.setSpacing(true);
    leftComponent.setSizeFull();

    resultTable = new TreeTable();
    resultTable.setSelectable(true);
    resultTable.setMultiSelect(true);
    HierarchicalContainer container = new HierarchicalContainer();
    container.setItemSorter(new PropertyDependentItemSorter(TreePropertyName.caption,
            new PropertyToTrimmedStringCIComparator()));

    resultTable.setContainerDataSource(container);

    resultTable.addContainerProperty(TreePropertyName.caption, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.caption, "Tag Definition");

    resultTable.addContainerProperty(TreePropertyName.sourcedocument, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.sourcedocument, "Source Document");

    resultTable.addContainerProperty(TreePropertyName.markupcollection, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.markupcollection, "Markup Collection");

    resultTable.addContainerProperty(TreePropertyName.phrase, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.phrase, "Phrase");

    resultTable.addContainerProperty(TreePropertyName.propertyname, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.propertyname, "Property");

    resultTable.addContainerProperty(TreePropertyName.propertyvalue, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.propertyvalue, "Property value");

    resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null);
    resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency");
    resultTable.addContainerProperty(TreePropertyName.visible, AbstractComponent.class, null);
    resultTable.setColumnHeader(TreePropertyName.visible, "Visible in Kwic");

    resultTable.setItemCaptionPropertyId(TreePropertyName.caption);
    resultTable.setPageLength(10); //TODO: config
    resultTable.setSizeFull();
    resultTable.setColumnCollapsingAllowed(true);
    resultTable.setColumnCollapsible(TreePropertyName.caption, false);
    resultTable.setColumnCollapsible(TreePropertyName.sourcedocument, true);
    resultTable.setColumnCollapsible(TreePropertyName.markupcollection, true);
    resultTable.setColumnCollapsible(TreePropertyName.phrase, true);
    resultTable.setColumnCollapsible(TreePropertyName.propertyname, true);
    resultTable.setColumnCollapsible(TreePropertyName.propertyvalue, true);
    resultTable.setColumnCollapsible(TreePropertyName.frequency, false);
    resultTable.setColumnCollapsible(TreePropertyName.visible, false);

    //TODO: a description generator that shows the version of a Tag
    //      resultTable.setItemDescriptionGenerator(generator);

    leftComponent.addComponent(resultTable);
    leftComponent.setExpandRatio(resultTable, 1.0f);

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

    btDist = new Button();
    btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication()));
    buttonPanel.addComponent(btDist);

    btResultExcelExport = new Button();
    btResultExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btResultExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    buttonPanel.addComponent(btResultExcelExport);

    cbFlatTable = new CheckBox("flat table", false);
    cbFlatTable.setImmediate(true);

    buttonPanel.addComponent(cbFlatTable);
    buttonPanel.setComponentAlignment(cbFlatTable, Alignment.MIDDLE_RIGHT);
    buttonPanel.setExpandRatio(cbFlatTable, 1f);

    btSelectAll = new Button("Select all for Kwic");

    buttonPanel.addComponent(btSelectAll);
    buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT);
    //      buttonPanel.setExpandRatio(btSelectAll, 1f);
    btDeselectAll = new Button("Deselect all for Kwic");
    buttonPanel.addComponent(btDeselectAll);
    buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT);

    leftComponent.addComponent(buttonPanel);

    splitPanel.addComponent(leftComponent);

    VerticalLayout rightComponent = new VerticalLayout();
    rightComponent.setSpacing(true);
    rightComponent.setSizeFull();

    this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider, true);
    rightComponent.addComponent(kwicPanel);
    rightComponent.setExpandRatio(kwicPanel, 1f);

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

    btKwicExcelExport = new Button();
    btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    kwicButtonPanel.addComponent(btKwicExcelExport);
    kwicButtonPanel.setComponentAlignment(btKwicExcelExport, Alignment.MIDDLE_LEFT);

    btUntagResults = new Button("Untag selected Kwics");
    kwicButtonPanel.addComponent(btUntagResults);
    kwicButtonPanel.setComponentAlignment(btUntagResults, Alignment.MIDDLE_RIGHT);
    kwicButtonPanel.setExpandRatio(btUntagResults, 1f);

    Label helpLabel = new Label();
    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication()));
    helpLabel.setWidth("20px");

    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>"
            + "You can tag the search results in the Kwic-view: "
            + "<p>First select one or more rows and then drag the desired "
            + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>"
            + "You can jump to the location in the full text by double "
            + "clicking on a row in the Kwic-view.");
    kwicButtonPanel.addComponent(helpLabel);

    kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    rightComponent.addComponent(kwicButtonPanel);
    rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT);

    splitPanel.addComponent(rightComponent);

    addComponent(splitPanel);
}

From source file:de.catma.ui.repository.RepositoryView.java

License:Open Source License

private Component createDocumentsLabel() {
    HorizontalLayout labelLayout = new HorizontalLayout();
    labelLayout.setWidth("100%");
    labelLayout.setSpacing(true);//from   ww  w .j  av  a  2s . c  o m

    Label documentsLabel = new Label("Document Manager");
    documentsLabel.addStyleName("bold-label");

    labelLayout.addComponent(documentsLabel);
    labelLayout.setExpandRatio(documentsLabel, 1.0f);
    btAdmin = new Button("Admin");
    btAdmin.addStyleName("icon-button"); // for top-margin
    btAdmin.setVisible(repository.getUser().getRole().equals(Role.ADMIN));

    labelLayout.addComponent(btAdmin);
    labelLayout.setComponentAlignment(btAdmin, Alignment.MIDDLE_RIGHT);

    btReload = new Button("");
    btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication()));
    btReload.addStyleName("icon-button");
    labelLayout.addComponent(btReload);
    labelLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);

    Label helpLabel = new Label();
    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication()));
    helpLabel.setWidth("20px");
    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>First steps</h4>" + "<h5>Adding a Source Document</h5>"
            + "You can add a Source Document by clicking the \"Add Source Document\"-button. "
            + "A Source Document can be a web resource pointed to by the URL or you can upload a document from your computer. "
            + "<h5>Tagging a Source Document</h5>"
            + "When you add your first Source Document, CATMA generates a set of example items to get you going: "
            + "<ul><li>A User Markup Collection to hold your markup</li><li>A Tag Library with an example Tagset that contains an example Tag</li></ul> "
            + "To start tagging a Source Document, just select the example User Markup Collection from the tree and click the \"Open User Markup Collection\"-button. "
            + "Then follow the instructions given to you by the Tagger component."
            + "<h5>Analyze a Source Document</h5>"
            + "To analyze a Source Document, just select that document from the tree and click \"Analyze Source Document\" in the \"More Actions\"-menu."
            + "Then follow the instructions given to you by the Analyzer component.");

    labelLayout.addComponent(helpLabel);
    labelLayout.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    return labelLayout;
}

From source file:de.catma.ui.Slider.java

License:Open Source License

public Slider(String caption, int min, int max, final String unit) {
    this.setCaption(caption);
    setSizeUndefined();/*  w  ww. j  a v a  2  s  .  c o  m*/
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setSpacing(true);
    this.sliderComp = new SliderComp(min, max);
    minLabel = new Label(String.valueOf(min));
    maxLabel = new Label(String.valueOf(max));

    sliderLayout.addComponent(minLabel);
    sliderLayout.addComponent(sliderComp);
    sliderLayout.addComponent(maxLabel);

    addComponent(sliderLayout);
    setComponentAlignment(sliderLayout, Alignment.MIDDLE_CENTER);

    final Label current = new Label(sliderComp.getValue().toString());
    current.setWidth("100%");

    current.addStyleName("slider-centered-text");

    addComponent(current);
    setComponentAlignment(current, Alignment.MIDDLE_CENTER);

    sliderComp.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            current.setValue(event.getProperty().getValue() + (unit.isEmpty() ? "" : " ") + unit);
        }
    });

}

From source file:de.catma.ui.tagger.MarkupPanel.java

License:Open Source License

private void initComponents(PropertyChangeListener tagDefinitionSelectionListener,
        PropertyChangeListener tagDefinitionsRemovedListener) {

    tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*from   w  w  w .j a  va2 s .c o  m*/
    VerticalLayout tabContent = new VerticalLayout();
    tabContent.setSpacing(true);
    tabContent.setSizeFull();

    Label helpLabel = new Label();

    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", application));
    helpLabel.setWidth("20px");
    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Creating Tags</h4>"
            + "<ol><li>First you have to tell CATMA which Tagset you want to use. "
            + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section."
            + " If you already have an active Tagset you want to use, you can skip this step.</li>"
            + "<li>Now you can select the Tagset and click the \"Create Tag\"-Button.</li></ol>"
            + "<h4>Tag this Source Document</h4>"
            + "<ol><li>First you have to tell CATMA which Tagset you want to use. "
            + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section."
            + " If you already have an active Tagset you want to use, you can skip this step.</li>"
            + "<li>Now you can mark the text sequence you want to tag.</li><li>Click the colored button of the desired Tag to apply it to the marked sequence.</li></ol> "
            + "When you click on a tagged text, i. e. a text that is underlined with colored bars you should see "
            + "the available Tag Instances in the section on the lower right of this view.");
    tabContent.addComponent(helpLabel);
    tabContent.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    tagsetTree = new TagsetTree(repository.getTagManager(), null, false, colorButtonListener);
    tabContent.addComponent(tagsetTree);
    tabContent.setExpandRatio(tagsetTree, 1.0f);

    tabSheet.addTab(tabContent, "Active Tagsets");

    markupCollectionsPanel = new MarkupCollectionsPanel(repository);
    markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.tagDefinitionSelected,
            tagDefinitionSelectionListener);
    markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.tagDefinitionsRemoved,
            tagDefinitionsRemovedListener);

    markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.userMarkupCollectionSelected,
            new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    if (evt.getNewValue() != null) {
                        writableUserMarkupCollectionLabel.setValue(evt.getNewValue());
                    } else {
                        writableUserMarkupCollectionLabel.setValue("");
                    }
                    colorButtonListener.setEnabled(evt.getNewValue() != null);
                }
            });

    tabSheet.addTab(markupCollectionsPanel, "Active Markup Collections");

    addComponent(tabSheet);

    Component markupInfoPanel = createInfoPanel();
    addComponent(markupInfoPanel);
}