use of com.codename1.ui.Component in project CodenameOne by codenameone.
the class BlackBerryImplementation method editString.
public void editString(final Component cmp, final int maxSize, final int constraint, final String text, int keyCode) {
TextArea txtCmp = (TextArea) cmp;
String edit = (String) txtCmp.getClientProperty("RIM.nativePopup");
if (edit != null) {
EditPopup editpop = new EditPopup(txtCmp, maxSize);
editpop.startEdit();
} else {
nativeEdit(txtCmp, txtCmp.getMaxSize(), txtCmp.getConstraint(), txtCmp.getText(), keyCode);
}
}
use of com.codename1.ui.Component in project CodenameOne by codenameone.
the class AndroidKeyboard method showKeyboard.
public void showKeyboard(boolean show) {
// manager.restartInput(myView);
// if (keyboardShowing != show) {
// manager.toggleSoftInputFromWindow(myView.getWindowToken(), 0, 0);
// this.keyboardShowing = show;
// }
System.out.println("showKeyboard " + show);
Form current = Display.getInstance().getCurrent();
if (current != null) {
Component cmp = current.getFocused();
if (cmp != null && cmp instanceof TextArea) {
TextArea txt = (TextArea) cmp;
if (show) {
Display.getInstance().editString(txt, txt.getMaxSize(), txt.getConstraint(), txt.getText(), 0);
}
}
} else {
InPlaceEditView.endEdit();
}
// if(!show){
// impl.saveTextEditingState();
// }
}
use of com.codename1.ui.Component in project CodenameOne by codenameone.
the class BlackBerryCanvas method paint.
public void paint(Graphics g) {
int f = getFieldCount();
if (f > 0) {
g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);
Form currentForm = Display.getInstance().getCurrent();
for (int iter = 0; iter < f; iter++) {
Field fld = getField(iter);
int pops = 0;
if (currentForm != null) {
PeerComponent p = findPeer(currentForm.getContentPane(), fld);
if (p != null) {
pops = clipOnLWUITBounds(p, g);
} else {
Component cmp = currentForm.getFocused();
// we are now editing an edit field
if (cmp != null && cmp instanceof TextArea && cmp.hasFocus() && fld instanceof EditField) {
pops = clipOnLWUITBounds(cmp, g);
int x = fld.getLeft();
int y = fld.getTop();
g.clear(x, y, Math.max(cmp.getWidth(), fld.getWidth()), Math.max(cmp.getHeight(), fld.getHeight()));
}
}
}
paintChild(g, fld);
while (pops > 0) {
g.popContext();
pops--;
}
}
} else {
g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);
}
g.setColor(0);
g.drawText(debug, 0, 0);
painted = true;
}
use of com.codename1.ui.Component in project CodenameOne by codenameone.
the class BooleanContainer method editNextTextArea.
/**
* Opens onscreenkeyboard for the next textfield. The method works in EDT if
* needed.
*/
public static void editNextTextArea() {
Runnable task = new Runnable() {
public void run() {
Component next = getNextEditComponent();
if (next != null) {
if (next instanceof TextArea) {
TextArea text = (TextArea) next;
text.requestFocus();
Display.getInstance().editString(next, text.getMaxSize(), text.getConstraint(), text.getText(), 0);
}
} else {
IOSImplementation.foldKeyboard();
}
}
};
Display.getInstance().callSerially(task);
}
use of com.codename1.ui.Component in project CodenameOne by codenameone.
the class Ads method launchAd.
private void launchAd() {
Component c = getComponentAt(0);
if (c instanceof HTMLComponent) {
HTMLComponent h = (HTMLComponent) c;
h.setSupressExceptions(true);
HTMLElement dom = h.getDOM();
Vector links = dom.getDescendantsByTagName("a");
if (links.size() > 0) {
HTMLElement e = (HTMLElement) links.elementAt(0);
String link = e.getAttribute("href");
if (link != null) {
Display.getInstance().execute(link);
}
}
}
}
Aggregations