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();
}
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);
}
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;
}
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);
}
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;
}
Aggregations