Search in sources :

Example 61 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class Lifecycle method runApp.

/**
 * This method is invoked by start to show the first form of the application
 */
public void runApp() {
    Form hello = new Form("Hello", BoxLayout.y());
    hello.add(new Label("You should override runApp() with your code"));
    hello.show();
}
Also used : Form(com.codename1.ui.Form) CN.getCurrentForm(com.codename1.ui.CN.getCurrentForm) Label(com.codename1.ui.Label)

Example 62 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class TestUtils method assertLabel.

/**
 * Asserts that we have a label with the given text baring the given name
 * @param path the path of the label
 * @param text the text of the label
 */
public static void assertLabel(int[] path, String text) {
    if (verbose) {
        log("assertLabel(" + toString(path) + ", " + text + ")");
    }
    Label l = (Label) getComponentByPath(path);
    assertBool(l != null, "Null label" + text);
    assertBool(text == l.getText() || text.equals(l.getText()), ("" + l.getText()) + " != " + text);
}
Also used : Label(com.codename1.ui.Label)

Example 63 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class TestUtils method findLabelText.

/**
 * Finds a component with the given name, works even with UI's that weren't created with the GUI builder
 * @param text the text of the label/button
 * @return the component with the given label text within the tree
 */
private static Label findLabelText(Container root, String text) {
    if (verbose) {
        log("findLabelText(" + root + ", " + text + ")");
    }
    int count = root.getComponentCount();
    for (int iter = 0; iter < count; iter++) {
        Component c = root.getComponentAt(iter);
        if (c instanceof Label) {
            String n = ((Label) c).getText();
            if (n != null && n.equals(text)) {
                return (Label) c;
            }
            // will work for cases of upcase due to Android theme upcasing of buttons
            n = (String) c.getClientProperty("cn1$origText");
            if (n != null && n.equals(text)) {
                return (Label) c;
            }
            continue;
        }
        if (c instanceof Container) {
            Label l = findLabelText((Container) c, text);
            if (l != null) {
                return l;
            }
        }
    }
    return null;
}
Also used : Container(com.codename1.ui.Container) Label(com.codename1.ui.Label) Component(com.codename1.ui.Component)

Example 64 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class TestUtils method setText.

/**
 * Sets the text for the given component
 * @param name the name of the component
 * @param text the text to set
 */
public static void setText(String name, String text) {
    if (verbose) {
        log("setText(" + name + ", " + text + ")");
    }
    Component c = findByName(name);
    if (c instanceof Label) {
        ((Label) c).setText(text);
        return;
    }
    ((TextArea) c).setText(text);
    Display.getInstance().onEditingComplete(c, text);
}
Also used : TextArea(com.codename1.ui.TextArea) Label(com.codename1.ui.Label) Component(com.codename1.ui.Component)

Example 65 with Label

use of com.vaadin.v7.ui.Label in project opencms-core by alkacon.

the class CmsCacheViewApp method getJavaStatisticButton.

/**
 * Creates in info button for java cache statistics.<p>
 * @param memory memory object
 *
 * @return CmsInfoButton
 */
public static CmsInfoButton getJavaStatisticButton(CmsMemoryStatus memory) {
    Map<String, String> infoMap = new LinkedHashMap<String, String>();
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_MAX_0), CmsFileUtil.formatFilesize(memory.getMaxMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_TOTAL_0), CmsFileUtil.formatFilesize(memory.getTotalMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_USED_0), CmsFileUtil.formatFilesize(memory.getUsedMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_FREE_0), CmsFileUtil.formatFilesize(memory.getFreeMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
    CmsInfoButton info = new CmsInfoButton(infoMap);
    VerticalLayout prog = new VerticalLayout();
    Label label = new Label();
    label.setContentMode(ContentMode.HTML);
    label.setValue("<p>" + CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEXCACHE_LABEL_MEMORY_BLOCK_0) + "</p>");
    prog.addComponent(label);
    prog.addComponent(getProgressBar((((float) memory.getUsage() / 100))));
    info.addAdditionalElement(prog, 0);
    info.setWindowCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEX_0));
    info.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEX_0));
    return info;
}
Also used : Label(com.vaadin.v7.ui.Label) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) LinkedHashMap(java.util.LinkedHashMap) CmsInfoButton(org.opencms.ui.components.CmsInfoButton)

Aggregations

Label (com.codename1.ui.Label)129 Form (com.codename1.ui.Form)85 Label (com.vaadin.ui.Label)56 Container (com.codename1.ui.Container)45 Button (com.codename1.ui.Button)41 Label (com.vaadin.v7.ui.Label)40 TextField (com.vaadin.v7.ui.TextField)32 BorderLayout (com.codename1.ui.layouts.BorderLayout)31 Button (com.vaadin.ui.Button)31 ComboBox (com.vaadin.v7.ui.ComboBox)31 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)31 Captions (de.symeda.sormas.api.i18n.Captions)29 Strings (de.symeda.sormas.api.i18n.Strings)28 VerticalLayout (com.vaadin.ui.VerticalLayout)26 FacadeProvider (de.symeda.sormas.api.FacadeProvider)26 HorizontalLayout (com.vaadin.ui.HorizontalLayout)24 Window (com.vaadin.ui.Window)24 CssStyles (de.symeda.sormas.ui.utils.CssStyles)24 ValoTheme (com.vaadin.ui.themes.ValoTheme)21 List (java.util.List)21