Example usage for com.vaadin.ui Label setSizeUndefined

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

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:org.ripla.web.demo.skin.modest.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout out = new HorizontalLayout();
    out.setStyleName("demo-header"); //$NON-NLS-1$
    out.setWidth("100%"); //$NON-NLS-1$
    out.setHeight(65, Unit.PIXELS);// w w  w.  ja va 2  s  .  c o m

    final Label lTitle = LabelHelper.createLabel("Ripla Demo [with modest skin]", "demo-header-text");
    lTitle.setSizeUndefined();
    out.addComponent(lTitle);

    return out;
}

From source file:org.ripla.web.demo.skin.modest.Skin.java

License:Open Source License

@Override
public Label getToolbarSeparator() {
    final Label outSeparator = new Label("|", ContentMode.HTML); //$NON-NLS-1$
    outSeparator.setSizeUndefined();
    return outSeparator;
}

From source file:org.ripla.web.demo.skin.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout out = new HorizontalLayout();
    out.setStyleName("demo-header"); //$NON-NLS-1$
    out.setMargin(true);//from  w ww.j a  va 2 s.  c  o m
    out.setWidth("100%"); //$NON-NLS-1$
    out.setHeight(90, Unit.PIXELS);

    final Label lTitle = LabelHelper.createLabel("Ripla Demo Application", "demo-header-text");
    lTitle.setSizeUndefined();
    out.addComponent(lTitle);
    out.setComponentAlignment(lTitle, Alignment.MIDDLE_CENTER);

    return out;
}

From source file:org.ripla.web.demo.skin.stylish.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout out = new HorizontalLayout();
    out.setStyleName("demo-header"); //$NON-NLS-1$
    out.setWidth("100%"); //$NON-NLS-1$
    out.setHeight(50, Unit.PIXELS);/*  ww  w.  j  ava 2 s .co  m*/

    final Label lTitle = LabelHelper.createLabel("Ripla Demo [with stylish skin]", "demo-header-text");
    lTitle.setSizeUndefined();
    out.addComponent(lTitle);
    out.setComponentAlignment(lTitle, Alignment.MIDDLE_CENTER);

    return out;
}

From source file:org.ripla.web.util.LanguageSelect.java

License:Open Source License

/**
 * LanguageSelect constructor.//from  w ww .j  a va 2  s  .  co m
 * 
 * @param inPreferences
 *            {@link PreferencesHelper}
 * @param inConfigManager
 *            {@link ConfigManager}
 * @param inUser
 *            {@link User}
 */
public LanguageSelect(final PreferencesHelper inPreferences, final ConfigManager inConfigManager,
        final User inUser) {
    super();
    // initialize language form prefs (1) or config admin (2)
    // final String lActiveLanguage = inPreferences.getLocale(inUser,
    // new Locale(inConfigManager.getLanguage())).getLanguage();

    setStyleName("ripla-language-select"); //$NON-NLS-1$
    setSizeUndefined();

    layout = new HorizontalLayout();
    setCompositionRoot(layout);
    layout.setHeight(22, Unit.PIXELS);
    layout.setSpacing(true);

    final Label lLabel = new Label(Activator.getMessages().getMessage("toolbar.label.language"), //$NON-NLS-1$
            ContentMode.HTML);
    lLabel.setStyleName("ripla-toolbar-label"); //$NON-NLS-1$
    lLabel.setSizeUndefined();
    layout.addComponent(lLabel);
    layout.setComponentAlignment(lLabel, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(lLabel, 1);

    select = createSelect();
    select.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent inEvent) {
            final Locale lNew = ((LocaleAdapter) select.getValue()).getLocale();
            Locale lOld = null;
            try {
                VaadinSession.getCurrent().getLockInstance().lock();
                lOld = VaadinSession.getCurrent().getLocale();
            } finally {
                VaadinSession.getCurrent().getLockInstance().unlock();
            }
            if (lOld != null && !lOld.equals(lNew)) {
                try {
                    VaadinSession.getCurrent().getLockInstance().lock();
                    VaadinSession.getCurrent().setLocale(lNew);
                } finally {
                    VaadinSession.getCurrent().getLockInstance().unlock();
                }
                if (listener != null) {
                    listener.processAction(new IToolbarAction() {
                        @Override
                        public void run() {
                            LOG.trace("Setting language preference to {}.", lNew.getLanguage());
                            VaadinSession.getCurrent().getAttribute(IRiplaEventDispatcher.class).dispatch(
                                    org.ripla.interfaces.IRiplaEventDispatcher.Event.REFRESH,
                                    new HashMap<String, Object>());
                        }
                    });
                }
            }
        }
    });
    layout.addComponent(select);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.PerspectiveStackRenderer.java

License:Open Source License

private void initializedPerspectiveSwticherPanel(MPerspectiveStack perspectiveStack) {
    if (perspectiveSwitcherPanel != null)
        return;//from   w  ww. jav a  2s. c  o  m
    //initialize perspective switcher panel
    perspectiveStackForSwitcher = perspectiveStack;
    boolean iconsOnly = perspectiveStackForSwitcher.getTags().contains(Tags.ICONS_ONLY);

    perspectiveSwitcherPanel = new HorizontalLayout();
    perspectiveSwitcherPanel.setStyleName("perspectivepanel");
    perspectiveSwitcherPanel.setSizeUndefined();

    Button openPerspectiveButton = new Button("Open");
    openPerspectiveButton.addStyleName("vaaclipsebutton");
    openPerspectiveButton.addStyleName("icononly");
    openPerspectiveButton.setIcon(new ThemeResource("../vaaclipse_default_theme/img/open_perspective.png"));
    perspectiveSwitcherPanel.addComponent(openPerspectiveButton);

    openPerspectiveButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            openOpenPerspectiveWindow();

            //change focus
            Component parent = event.getButton().getParent();
            while (parent != null) {
                if (parent instanceof Component.Focusable) {
                    ((Component.Focusable) parent).focus();
                    break;
                } else {
                    parent = parent.getParent();
                }
            }
        }
    });

    //add separator between openPerspectiveButton and perspective's buttons
    Label separator = new Label();
    separator.setSizeUndefined();
    separator.addStyleName("horizontalseparator");
    separator.setHeight("100%");
    perspectiveSwitcherPanel.addComponent(separator);

    //add buttons to perspective switch panel   
    for (final MPerspective perspective : perspectiveStackForSwitcher.getChildren()) {
        Component button = createPerspectiveButton(perspective);
        if (button != null)
            perspectiveSwitcherPanel.addComponent(button);
    }
}

From source file:org.semanticsoft.vaaclipse.presentation.utils.GuiUtils.java

License:Open Source License

public static Component createSeparator(MTrimElement trimElement) {
    if ((MElementContainer<?>) trimElement.getParent() instanceof MTrimBar) {
        Label separator = new Label();
        separator.setSizeUndefined();

        MTrimBar parentTrimBar = (MTrimBar) (MElementContainer<?>) trimElement.getParent();
        int orientation = parentTrimBar.getSide().getValue();

        if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE) {
            separator.addStyleName("horizontalseparator");
            separator.setHeight("100%");
        } else {//from w w  w.j av a2  s .c o  m
            separator.addStyleName("verticalseparator");
            separator.setWidth("100%");
        }
        return separator;
    } else
        return null;

}

From source file:org.vaadin.arborgraph.demo.DemoApplication.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*from   ww w.j a v  a  2  s .  c om*/
public void init() {
    VerticalLayout aboutLayout = new VerticalLayout();
    aboutLayout.setSizeFull();
    aboutLayout.addComponent(new Label(getBlah(), Label.CONTENT_XHTML));

    final ArborGraph graph = new ArborGraph();
    graph.setSizeFull();

    Button exampleGraphButton = new Button("Show Example", new ClickListener() {

        public void buttonClick(ClickEvent event) {
            graph.showGraph(getDemoBranch());
        }
    });

    Label orLabel = new Label("<i>or</i>", Label.CONTENT_XHTML);
    orLabel.setSizeUndefined();

    final TextField jsonTextfield = new TextField();
    jsonTextfield.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    jsonTextfield.setNullRepresentation("");

    Button jsonBranchButton = new Button("Display Json Branch", new ClickListener() {

        public void buttonClick(ClickEvent event) {
            graph.showGraph(jsonTextfield.getValue().toString());
        }
    });

    Label helpLabel = getHelpLabel(getBranchExplanation());

    HorizontalLayout graphButtonLayout = new HorizontalLayout();
    graphButtonLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    graphButtonLayout.setSpacing(true);
    graphButtonLayout.setMargin(false, false, true, false);
    graphButtonLayout.addComponent(exampleGraphButton);
    graphButtonLayout.addComponent(orLabel);
    graphButtonLayout.setComponentAlignment(orLabel, Alignment.MIDDLE_CENTER);
    graphButtonLayout.addComponent(jsonBranchButton);
    graphButtonLayout.addComponent(helpLabel);
    graphButtonLayout.setComponentAlignment(helpLabel, Alignment.MIDDLE_CENTER);
    graphButtonLayout.addComponent(jsonTextfield);
    graphButtonLayout.setExpandRatio(jsonTextfield, .9f);

    VerticalLayout graphLayout = new VerticalLayout();
    graphLayout.setSizeFull();
    graphLayout.setMargin(true, false, false, false);
    graphLayout.setSpacing(true);
    graphLayout.addComponent(graphButtonLayout);
    graphLayout.addComponent(graph);
    graphLayout.setExpandRatio(graph, .9f);

    TabSheet tabSheet = new TabSheet();
    tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL);
    tabSheet.setSizeFull();
    tabSheet.addTab(aboutLayout, "About");
    tabSheet.addTab(graphLayout, "Graph");

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.addComponent(tabSheet);
    mainLayout.setExpandRatio(tabSheet, .9f);

    Window mainWindow = new Window("Arbor-Vaadin");
    mainWindow.setSizeFull();
    mainWindow.setContent(mainLayout);

    setTheme("arbor");

    setMainWindow(mainWindow);
}

From source file:org.vaadin.spring.samples.mvp.ui.view.BannerView.java

License:Apache License

protected Layout buildUserArea(String username) {
    HorizontalLayout userArea = new HorizontalLayout();
    String id = env.getProperty("app.security.scheme", Scheme.BASIC.id());
    if (id.equals(Scheme.FORM.id())) {
        Button signOut = new Button("Sign Out");
        signOut.addClickListener(logoutListener);
        userArea.addComponent(signOut);/*from   w  w w. j  av  a2  s  . c o  m*/
    }
    Label loggedInUser = new Label();
    loggedInUser.setValue(username);
    loggedInUser.setSizeUndefined();
    userArea.addComponent(loggedInUser);
    return userArea;
}

From source file:org.vaadin.spring.samples.security.ui.login.views.LoginView.java

License:Apache License

private Component buildLabels() {
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");

    Label welcome = new Label("Welcome");
    welcome.setSizeUndefined();
    welcome.addStyleName(ValoTheme.LABEL_H4);
    welcome.addStyleName(ValoTheme.LABEL_COLORED);
    labels.addComponent(welcome);//from  ww w  .  j a  v a 2s  . c  o m

    Label title = new Label("Security-Sample");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_LIGHT);
    labels.addComponent(title);
    return labels;
}