private void createForm( final Display display, String room, String server, String nick, final String password) { this.display = display; parentView = display.getCurrent(); Form formJoin = new Form(SR.MS_JOIN_CONFERENCE); roomField = new TextField(SR.MS_ROOM, room, 64, ConstMIDP.TEXTFIELD_URL); TextFieldCombo.setLowerCaseLatin(roomField); formJoin.append(roomField); hostField = new TextField(SR.MS_AT_HOST, server, 64, ConstMIDP.TEXTFIELD_URL); TextFieldCombo.setLowerCaseLatin(hostField); formJoin.append(hostField); if (nick == null) nick = sd.account.getNickName(); nickField = new TextFieldCombo(SR.MS_NICKNAME, nick, 32, TextField.ANY, "roomnick", display); formJoin.append(nickField); passField = new TextField(SR.MS_PASSWORD, password, 32, TextField.ANY | ConstMIDP.TEXTFIELD_SENSITIVE); formJoin.append(passField); msgLimitField = new NumberField(SR.MS_MSG_LIMIT, 20, 0, 20); formJoin.append(msgLimitField); formJoin.addCommand(cmdJoin); // formJoin.addCommand(cmdBookmarks); formJoin.addCommand(cmdAdd); formJoin.addCommand(cmdCancel); formJoin.setCommandListener(this); display.setCurrent(formJoin); }
public void startApp() { display = Display.getDisplay(this); Form form = new Form("Date Field"); form.append(datein); form.append(dateout); display.setCurrent(form); }
public String getTheme() { String theme = null; if (this.theme != null) { theme = findString(this.theme); } if (theme == null || theme.equals("")) { Form form = (Form) findAncestor(Form.class); if (form != null) { theme = form.getTheme(); } } // If theme set is not explicitly given, // try to find attribute which states the theme set to use if ((theme == null) || (theme.equals(""))) { theme = stack.findString("#attr.theme"); } // Default theme set if ((theme == null) || (theme.equals(""))) { theme = defaultUITheme; } return theme; }
public static <T> void handle(Form<T> form, T formModel) { for (String key : form.getViews().keySet()) { View view = form.getViews().get(key); for (Field f : formModel.getClass().getDeclaredFields()) { if (!f.isAnnotationPresent(FormView.class)) continue; f.setAccessible(true); if (f.getType().equals(String.class)) { try { f.set(formModel, TypeUtils.getTypedValue(new String(), f.getType())); } catch (Exception e) { } } if (!key.equals(f.getName())) continue; if (view instanceof EditText) bindEditTextValue(view, formModel, f); else if (view instanceof Spinner) bindSpinnerValue(view, formModel, f); else if (view instanceof CheckBox || view instanceof RadioButton || view instanceof ToggleButton) bindCompoundButtonValue(view, formModel, f); else if (view instanceof DatePicker) bindDatePickerValue(view, formModel, f); else if (view instanceof TimePicker) bindTimePickerValue(view, formModel, f); } } }
public Form getAboutUs() { final Form f = new Form("Event counting"); if (frmAboutUs == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); final Button pushButton = new Button("Tap me!"); final Label countLabel = new Label(" "); pushButton.addActionListener( new ActionListener() { private int c = 0; public void actionPerformed(ActionEvent ae) { c++; countLabel.setText(Integer.toString(c)); f.layoutContainer(); pushButton.setText("Tapped " + Integer.toString(c) + " times"); // System.out.println(Integer.toString(c)); } }); f.addComponent(pushButton); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return f; }
/** * Update URL and gauge of the progress form. * * @param url new URL, null to remove, "" to not change * @param size 0 if unknown, else size of object to download in K bytes * @param gaugeLabel label for progress gauge */ private void updateProgressForm(String url, int size, String gaugeLabel) { Gauge oldProgressGauge; Gauge progressGauge; StringItem urlItem; // We need to prevent "flashing" on fast development platforms. while (System.currentTimeMillis() - lastDisplayChange < GraphicalInstaller.ALERT_TIMEOUT) ; if (size <= 0) { progressGauge = new Gauge(gaugeLabel, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING); } else { progressGauge = new Gauge(gaugeLabel, false, size, 0); } oldProgressGauge = (Gauge) progressForm.get(progressGaugeIndex); progressForm.set(progressGaugeIndex, progressGauge); // this ends the background thread of gauge. oldProgressGauge.setValue(Gauge.CONTINUOUS_IDLE); if (url == null) { urlItem = new StringItem("", ""); progressForm.set(progressUrlIndex, urlItem); } else if (url.length() != 0) { urlItem = new StringItem(Resource.getString(ResourceConstants.AMS_WEBSITE) + ": ", url); progressForm.set(progressUrlIndex, urlItem); } lastDisplayChange = System.currentTimeMillis(); }
public Form getSupportMe() { if (frmSupportMe == null) { // --------------------------------------------- // Form f = ... frmSupportMe = new Form("Support Me"); frmSupportMe.setLayout(new BorderLayout()); Image bimage = null; try { bimage = Image.createImage("/images/metaLabSmall.png"); } catch (IOException ex) { ex.printStackTrace(); } Label bottomText = new Label(bimage); bottomText.setAlignment(Component.CENTER); bottomText.setText("Our Logo"); bottomText.setTextPosition(Component.BOTTOM); Container buttonBar = new Container(new BoxLayout(BoxLayout.X_AXIS)); buttonBar.addComponent(new Button("Add")); buttonBar.addComponent(new Button("Remove")); buttonBar.addComponent(new Button("Edit")); buttonBar.addComponent(new Button("Send")); buttonBar.addComponent(new Button("Exit")); frmSupportMe.addComponent(BorderLayout.CENTER, bottomText); frmSupportMe.addComponent(BorderLayout.SOUTH, buttonBar); frmSupportMe.addCommand(mBackCommand); frmSupportMe.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return frmSupportMe; }
public TrafficCams(Controller controller) { super("Traffic Status", Choice.EXCLUSIVE); this.controller = controller; traf = this; TrafOption = new Command("OK", Command.SCREEN, 1); bckMenu = new Command("back", Command.BACK, 2); VehicleOk = new Command("OK", Command.SCREEN, 1); Vehicleback = new Command("Back", Command.BACK, 2); this.addCommand(TrafOption); this.addCommand(bckMenu); setCommandListener(this); if (fmViewPng == null) { fmViewPng = new Form(""); cmBack = new Command("Back", Command.BACK, 1); RefreshImage = new Command("refresh", Command.OK, 2); fmViewPng.addCommand(cmBack); fmViewPng.addCommand(RefreshImage); fmViewPng.setCommandListener(this); } }
/** * Display the connecting form to the user, let call set actions. * * @param action action to put in the form's title * @param name name to in the form's title * @param url URL of a JAD * @param size 0 if unknown, else size of object to download in K bytes * @param gaugeLabel label for progress gauge * @return displayed form */ private Form displayProgressForm( String action, String name, String url, int size, String gaugeLabel) { Gauge progressGauge; StringItem urlItem; progressForm = new Form(null); progressForm.setTitle(action + " " + name); if (size <= 0) { progressGauge = new Gauge(gaugeLabel, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING); } else { progressGauge = new Gauge(gaugeLabel, false, size, 0); } progressGaugeIndex = progressForm.append(progressGauge); if (url == null) { urlItem = new StringItem("", ""); } else { urlItem = new StringItem(Resource.getString(ResourceConstants.AMS_WEBSITE) + ": ", url); } progressUrlIndex = progressForm.append(urlItem); display.setCurrent(progressForm); lastDisplayChange = System.currentTimeMillis(); return progressForm; }
public void showAllRecordForm() { fmAllRecords = new Form("All records"); try { RecordEnumeration recEnum = rs.enumerateRecords(null, null, false); while (recEnum.hasNextElement()) { try { // System.out.println(new String(recEnum.nextRecord())); String name = "Nenacetl jsem"; int number = 0; try { byte[] record = recEnum.nextRecord(); ByteArrayInputStream buffer = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(buffer); name = dis.readUTF(); number = dis.readInt(); dis.close(); } catch (Exception e) { } fmAllRecords.append(name + " " + String.valueOf(number) + "\n"); } catch (Exception e) { System.out.println(e.getMessage()); } // } } catch (Exception ex) { System.out.println(ex.getMessage()); } fmAllRecords.addCommand(cmdMenu); fmAllRecords.setCommandListener(this); dsp.setCurrent(fmAllRecords); }
private void createMailInput(Form<T> form) { TextField<String> emailField = new TextField<String>("user.email"); emailField.add(EmailAddressValidator.getInstance()); emailField.add(new ValidatingFormComponentAjaxBehavior()); form.add(emailField); form.add(new AjaxFormComponentFeedbackIndicator("emailValidationError", emailField)); }
public Form getF_welcome() { if (f_welcome == null) { f_welcome = new Form("NGCalc 2.4.3 \u00A9 Revzin", new Item[] {getImageItem()}); f_welcome.addCommand(getC_canvas()); f_welcome.setCommandListener(this); } return f_welcome; }
/** * Processes all of the <code>Form</code>s. * * @deprecated This method is called by the framework. It will be made protected in a future * release. TODO */ public synchronized void process(Map globalConstants) { for (Iterator i = forms.values().iterator(); i.hasNext(); ) { Form f = (Form) i.next(); f.process(globalConstants, constants); } processed = true; }
@Override public UnmodifiableIterator<String> iterator() { if (size() == 1) { return new SingleModIterator(stem.iterator()); } else { return new MultiModIterator(stem.iterator()); } }
public void buttonClick(ClickEvent event) { Field name = form.getField("name"); Field prenom = form.getField("prenom"); Field age = form.getField("age"); name.setValue(""); prenom.setValue(""); age.setValue(""); }
@SuppressWarnings("unused") public Form lookup(String name) { // For use by scripts. for (Iterator<Form> it = iterator(); it.hasNext(); ) { Form f = it.next(); if (f.getName().equals(name)) return f; } return null; };
private void checkFirstAndSecond(final Form form) throws ParseException { SExpression initVal = form.getChild(1); // als init-Wert ist Symbol (oder Subtyp) oder eine Form erlaubt. // Nur s-expression reicht nicht aus if (!initVal.isNil() && !(initVal instanceof Symbol) && initVal.getTyp() != TSExpression.FORM) { error("form or symbol expected", form.getChild(1)); } }
private void createUsernameInput(Form<T> form) { RequiredTextField<String> usernameField = new RequiredTextField<String>("user.username"); form.add(usernameField); usernameField.add(new StringValidator(0, 32)); usernameField.add(new DuplicateUsernameValidator()); usernameField.setLabel(new ResourceModel("admin.user.username")); usernameField.add(new ValidatingFormComponentAjaxBehavior()); form.add(new AjaxFormComponentFeedbackIndicator("userValidationError", usernameField)); }
public InputText(String str) { Form form = new Form("請輸入" + str); if (page == 0) txt = new TextField(str, "", 10, TextField.ANY); else if (page == 2) txt = new TextField(str, "", 5, TextField.ANY); okCommand = new Command("確定", Command.OK, 1); form.append(txt); form.addCommand(okCommand); form.setCommandListener(this); display.setCurrent(form); }
/** @return List of crawlelements. */ protected ImmutableList<CrawlElement> getCrawlElements() { Builder<CrawlElement> builder = ImmutableList.builder(); for (Form form : this.forms) { CrawlElement crawlTag = form.getCrawlElement(); if (crawlTag != null) { builder.add(crawlTag); } } return builder.build(); }
private void createNameInput(Form<T> form) { TextField<String> firstNameField = new TextField<String>("user.firstName"); form.add(firstNameField); TextField<String> lastNameField = new RequiredTextField<String>("user.lastName"); form.add(lastNameField); lastNameField.setLabel(new ResourceModel("admin.user.lastName")); lastNameField.add(new ValidatingFormComponentAjaxBehavior()); form.add(new AjaxFormComponentFeedbackIndicator("lastNameValidationError", lastNameField)); }
/** * This method returns instance for PrevNotClosedForm component and should be called instead of * accessing PrevNotClosedForm field directly.//GEN-BEGIN:MVDGetBegin46 * * @return Instance for PrevNotClosedForm component */ public Form get_PrevNotClosedForm() { if (PrevNotClosedForm == null) { // GEN-END:MVDGetBegin46 // Insert pre-init code here PrevNotClosedForm = new Form(null, new Item[] {get_stringItem5()}); // GEN-BEGIN:MVDGetInit46 PrevNotClosedForm.addCommand(get_okCommand2()); PrevNotClosedForm.setCommandListener(this); // GEN-END:MVDGetInit46 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd46 return PrevNotClosedForm; } // GEN-END:MVDGetEnd46
private void createRoleInput(Form<T> form) { ListMultipleChoice<UserRole> userRoles = new ListMultipleChoice<UserRole>("user.userRoles", getUserRoles(), new UserRoleRenderer()); userRoles.setMaxRows(4); userRoles.setLabel(new ResourceModel("admin.user.roles")); userRoles.setRequired(true); userRoles.add(new ValidatingFormComponentAjaxBehavior()); form.add(userRoles); form.add(new AjaxFormComponentFeedbackIndicator("rolesValidationError", userRoles)); }
/** * This method returns instance for helpForm component and should be called instead of accessing * helpForm field directly.//GEN-BEGIN:MVDGetBegin25 * * @return Instance for helpForm component */ public Form get_helpForm() { if (helpForm == null) { // GEN-END:MVDGetBegin25 // Insert pre-init code here helpForm = new Form(null, new Item[] {get_stringItem4()}); // GEN-BEGIN:MVDGetInit25 helpForm.addCommand(get_okCommand2()); helpForm.setCommandListener(this); // GEN-END:MVDGetInit25 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd25 return helpForm; } // GEN-END:MVDGetEnd25
/** * This method returns instance for NoBTAPIForm component and should be called instead of * accessing NoBTAPIForm field directly.//GEN-BEGIN:MVDGetBegin43 * * @return Instance for NoBTAPIForm component */ public Form get_NoBTAPIForm() { if (NoBTAPIForm == null) { // GEN-END:MVDGetBegin43 // Insert pre-init code here NoBTAPIForm = new Form(null, new Item[] {get_stringItem8()}); // GEN-BEGIN:MVDGetInit43 NoBTAPIForm.addCommand(get_exitCommand()); NoBTAPIForm.setCommandListener(this); // GEN-END:MVDGetInit43 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd43 return NoBTAPIForm; } // GEN-END:MVDGetEnd43
/** * This method returns instance for StartFailedForm component and should be called instead of * accessing StartFailedForm field directly.//GEN-BEGIN:MVDGetBegin19 * * @return Instance for StartFailedForm component */ public Form get_StartFailedForm() { if (StartFailedForm == null) { // GEN-END:MVDGetBegin19 // Insert pre-init code here StartFailedForm = new Form(null, new Item[] {get_stringItem3()}); // GEN-BEGIN:MVDGetInit19 StartFailedForm.addCommand(get_okCommand2()); StartFailedForm.setCommandListener(this); // GEN-END:MVDGetInit19 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd19 return StartFailedForm; } // GEN-END:MVDGetEnd19
/** * This method returns instance for BTOffForm component and should be called instead of accessing * BTOffForm field directly.//GEN-BEGIN:MVDGetBegin16 * * @return Instance for BTOffForm component */ public Form get_BTOffForm() { if (BTOffForm == null) { // GEN-END:MVDGetBegin16 // Insert pre-init code here BTOffForm = new Form(null, new Item[] {get_stringItem2()}); // GEN-BEGIN:MVDGetInit16 BTOffForm.addCommand(get_okCommand2()); BTOffForm.setCommandListener(this); // GEN-END:MVDGetInit16 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd16 return BTOffForm; } // GEN-END:MVDGetEnd16
/** * This method returns instance for NoBTForm component and should be called instead of accessing * NoBTForm field directly.//GEN-BEGIN:MVDGetBegin11 * * @return Instance for NoBTForm component */ public Form get_NoBTForm() { if (NoBTForm == null) { // GEN-END:MVDGetBegin11 // Insert pre-init code here NoBTForm = new Form(null, new Item[] {get_stringItem1()}); // GEN-BEGIN:MVDGetInit11 NoBTForm.addCommand(get_okCommand2()); NoBTForm.setCommandListener(this); // GEN-END:MVDGetInit11 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd11 return NoBTForm; } // GEN-END:MVDGetEnd11
public Form getAboutYou() { Form f = new Form("...placeholder ..."); if (frmAboutYou == null) { f.addComponent(new Label("Choose Back to return to the home screen.")); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return f; }
protected void enableAncestorFormCustomOnsubmit() { Form form = (Form) findAncestor(Form.class); if (form != null) { form.addParameter("customOnsubmitEnabled", Boolean.TRUE); } else { if (LOG.isWarnEnabled()) { LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled"); } } }