use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class RSSReader method createRendererContainer.
private Container createRendererContainer() {
Container entries = new Container(new BoxLayout(BoxLayout.Y_AXIS));
entries.setUIID("RSSEntry");
Label title = new Label();
title.setName("title");
title.setUIID("RSSTitle");
entries.addComponent(title);
TextArea description = new TextArea(2, 30);
description.setGrowByContent(false);
description.setName("details");
description.setUIID("RSSDescription");
description.setScrollVisible(false);
entries.addComponent(description);
if (iconPlaceholder != null) {
Container wrap = new Container(new BorderLayout());
wrap.addComponent(BorderLayout.CENTER, entries);
Label icon = new Label();
icon.setIcon(iconPlaceholder);
icon.setUIID("RSSIcon");
icon.setName("icon");
wrap.addComponent(BorderLayout.WEST, icon);
entries = wrap;
}
return entries;
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class RSSReader method updateComponentValues.
void updateComponentValues(Container root, Hashtable h) {
int c = root.getComponentCount();
for (int iter = 0; iter < c; iter++) {
Component current = root.getComponentAt(iter);
// subclasses
if (current.getClass() == com.codename1.ui.Container.class || current.getClass() == com.codename1.ui.Tabs.class) {
updateComponentValues((Container) current, h);
continue;
}
String n = current.getName();
if (n != null) {
String val = (String) h.get(n);
if (val != null) {
if (current instanceof Button) {
final String url = (String) val;
((Button) current).addActionListener(new Listener(url));
continue;
}
if (current instanceof Label) {
((Label) current).setText(val);
continue;
}
if (current instanceof TextArea) {
((TextArea) current).setText(val);
continue;
}
if (current instanceof WebBrowser) {
((WebBrowser) current).setPage(val, null);
continue;
}
}
}
}
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class GlassTutorial method paint.
/**
* {@inheritDoc}
*/
public void paint(Graphics g, Rectangle rect) {
if (internal == null) {
internal = new Label(" ");
internal.setUIID("GlassTutorial");
}
internal.setSize(rect.getSize());
internal.paintComponent(g);
int componentCount = vec.size();
for (int iter = 0; iter < componentCount; iter++) {
Component current = (Component) vec.elementAt(iter);
String pos = (String) current.getClientProperty(POS);
Component dest = (Component) current.getClientProperty(DEST);
int xpos = dest.getAbsoluteX();
int ypos = dest.getAbsoluteY();
int w = dest.getWidth();
int h = dest.getHeight();
if (pos.equals(BorderLayout.CENTER)) {
current.setX(xpos);
current.setY(ypos);
current.setWidth(w);
current.setHeight(h);
current.paintComponent(g);
continue;
}
Dimension d = current.getPreferredSize();
current.setWidth(d.getWidth());
current.setHeight(d.getHeight());
if (pos.equals(BorderLayout.SOUTH)) {
current.setX(xpos + w / 2 - d.getWidth() / 2);
current.setY(ypos + h);
current.paintComponent(g);
continue;
}
if (pos.equals(BorderLayout.NORTH)) {
current.setX(xpos + w / 2 - d.getWidth() / 2);
current.setY(ypos - d.getHeight());
current.paintComponent(g);
continue;
}
if (pos.equals(BorderLayout.EAST)) {
current.setX(xpos + w);
current.setY(ypos + h / 2 - d.getHeight() / 2);
current.paintComponent(g);
continue;
}
if (pos.equals(BorderLayout.WEST)) {
current.setX(xpos - d.getWidth());
current.setY(ypos + h / 2 - d.getHeight() / 2);
current.paintComponent(g);
continue;
}
}
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class DateTimeSpinner3D method calcPreferredSize.
@Override
protected Dimension calcPreferredSize() {
Dimension size = super.calcPreferredSize();
Label l = new Label("Thu Dec 27 55 55 AM", "Spinner3DRow");
size.setWidth((int) (l.getPreferredW() * 1.5f + convertToPixels(10f)));
return size;
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class DateTimeSpinner3D method initSpinner.
void initSpinner() {
if (date == null) {
date = Spinner3D.createDate(startDate.getTime() + off, endDate.getTime() + off, currentDate.getTime());
date.setPreferredW((int) (new Label("Thu Dec 27", "Spinner3DRow").getPreferredW() * 1.5f));
Style dateStyle = Style.createProxyStyle(date.getRowStyle(), date.getSelectedRowStyle());
dateStyle.setAlignment(Component.RIGHT);
dateStyle.setPaddingRight(3f);
this.setCurrentDate(currentDate);
this.setStartDate(startDate);
this.setEndDate(endDate);
time = new TimeSpinner3D();
// getUnselectedStyle().setBgColor(date.getUnselectedStyle().getBgColor());
// getUnselectedStyle().setBgTransparency(255);
addComponents();
}
}
Aggregations