BaseFormPanel createbcode_Spouse_Form() { form = new BaseFormPanel(get_bcode_Spouse_Store()); TableLayout tl = new TableLayout(6); TableData td = new TableData(); td.setRowspan(1); td.setHorizontalAlign(HorizontalAlignment.LEFT); td.setVerticalAlign(VerticalAlignment.MIDDLE); td.setPadding(2); form.setLayout(tl); form.setHeaderVisible(false); form.setBodyBorder(false); form.setPadding(1); form.add(new Label("配偶中文名称:"), td); TextField<String> C_num3 = new TextField<String>(); C_num3.setName("Spouse_cnname"); form.add(C_num3, td); form.add(new Label("配偶英文名称:"), td); TextField<String> C_num4 = new TextField<String>(); C_num4.setName("Spouse_enname"); form.add(C_num4, td); form.add(new Label("身份证号:"), td); TextField<String> C_num5 = new TextField<String>(); C_num5.setName("idcard"); form.add(C_num5, td); form.add(new Label("国籍:"), td); BaseComboBoxX C_num6 = new BaseComboBoxX("name", "dictionary", "where type='hr_Country'"); C_num6.setName("Nationality"); form.add(C_num6, td); form.add(new Label("护照编码:"), td); TextField<String> C_num7 = new TextField<String>(); C_num7.setName("PassportNo"); form.add(C_num7, td); form.add(new Label("护照签发国家:"), td); BaseComboBoxX C_num8 = new BaseComboBoxX("name", "dictionary", "where type='hr_Country'"); C_num8.setName("PassportIssueCountry"); form.add(C_num8, td); form.add(new Label("护照签发日期:"), td); DateField C_data9 = new DateField(); C_data9.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-M-d")); C_data9.setName("PassportIssueDate"); form.add(C_data9, td); form.add(new Label("职业:"), td); TextField<String> C_num10 = new TextField<String>(); C_num10.setName("Occupation"); form.add(C_num10, td); form.add(new Label("公司:"), td); TextField<String> C_num11 = new TextField<String>(); C_num11.setName("Company"); form.add(C_num11, td); form.add(new Label("工作职位:"), td); TextField<String> C_num14 = new TextField<String>(); C_num14.setName("JobPosition"); form.add(C_num14, td); form.inited(126); return form; };
/** * DOC bessaies Comment method "buildField". * * @param fieldPart * @param messagePart * @param configBean */ private Field<?> buildPasswordField( final LayoutContainer fieldPart, final LayoutContainer messagePart, Config config) { String key = config.labelKey; TextField<String> field = new TextField<String>(); field.setName(config.name()); field.setReadOnly( !(config.editable && userBean.getRole().getRights().contains(RightsConstants.CONFIG_MANAGMENT))); field.setPassword(true); buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart); bindings.add(new FieldBinding<String>(field, config.name())); return field; }
private void createFields() { GroupRef groupRef = (GroupRef) groupRefBeanModel.getBean(); nameField = new TextField<String>(); nameField.setName("name"); nameField.setFieldLabel("Name"); nameField.setAllowBlank(false); if (groupRef.getGroup().getName() != null) { nameField.setValue(groupRef.getGroup().getName()); } AdapterField screenField = new AdapterField(createScreenPairList(groupRef)); screenField.setFieldLabel("Screen"); form.add(nameField); form.add(screenField); }
private Field<?> buildTextField( final LayoutContainer fieldPart, final LayoutContainer messagePart, Config config) { String key = config.labelKey; if (config.editable && userBean.getRole().getRights().contains(RightsConstants.CONFIG_MANAGMENT)) { TextField<String> field = new TextField<String>(); field.setName(config.name()); buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart); bindings.add(new FieldBinding<String>(field, config.name(), null)); return field; } else { LabelField field = new LabelField(); field.setName(config.name()); buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart); bindings.add(new FieldBinding<Object>(field, config.name(), null)); return field; } }
private FormPanel createForm() { final FormPanel panel = new FormPanel(); panel.setLabelWidth(100); panel.setHeaderVisible(false); TextField<String> code = new TextField<String>(); code.setName("containerNo"); code.setFieldLabel("集装箱号"); code.setAllowBlank(false); panel.add(code); final ComboBox<BeanModel> size = new ComboBox<BeanModel>(); size.setTabIndex(9); size.setName("size"); size.setForceSelection(true); size.setEmptyText("请选择..."); size.setDisplayField("size"); size.setFieldLabel("尺寸"); size.setStore(containerSizeStore); size.setTypeAhead(true); size.setTriggerAction(TriggerAction.ALL); size.setAllowBlank(false); panel.add(size); size.addListener( Events.Blur, new Listener<FieldEvent>() { @Override public void handleEvent(FieldEvent be) { formBindings.getModel().set("valentNum", size.getValue().get("valentNum")); } }); ComboBox<BeanModel> type = new ComboBox<BeanModel>(); type.setTabIndex(9); type.setName("type"); type.setForceSelection(true); type.setEmptyText("请选择..."); type.setDisplayField("code"); type.setFieldLabel("类型"); type.setStore(ironChestStore); type.setTypeAhead(true); type.setTriggerAction(TriggerAction.ALL); panel.add(type); ComboBox<BeanModel> bracket = new ComboBox<BeanModel>(); bracket.setTabIndex(9); bracket.setName("bracket"); bracket.setForceSelection(true); bracket.setEmptyText("请选择..."); bracket.setDisplayField("code"); bracket.setFieldLabel("车架编号"); bracket.setStore(bracketStore); bracket.setTypeAhead(true); bracket.setTriggerAction(TriggerAction.ALL); panel.add(bracket); formBindings = new FormBinding(panel, true); formBindings .getBinding(size) .setConverter( new Converter() { @Override public Object convertFieldValue(Object value) { if (value == null) { return null; } return ((BeanModel) value).get("code").toString(); } @Override public Object convertModelValue(Object value) { if (value != null) { return containerSizeStore.findModel("code", (String) value); } else { return null; } } }); formBindings .getBinding(type) .setConverter( new Converter() { @Override public Object convertFieldValue(Object value) { if (value == null) { return null; } return ((BeanModel) value).get("code").toString(); } @Override public Object convertModelValue(Object value) { if (value != null) { return ironChestStore.findModel("code", (String) value); } else { return null; } } }); formBindings .getBinding(bracket) .setConverter( new Converter() { @Override public Object convertFieldValue(Object value) { if (value == null) { return null; } return ((BeanModel) value).get("code").toString(); } @Override public Object convertModelValue(Object value) { if (value != null) { return bracketStore.findModel("code", (String) value); } else { return null; } } }); formBindings.setStore((Store<BeanModel>) grid.getStore()); panel.setReadOnly(true); panel.setButtonAlign(HorizontalAlignment.CENTER); saveButton = new Button("保存"); saveButton.setVisible(false); saveButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { if (!panel.isValid()) return; save(); } }); panel.addButton(saveButton); cancelButton = new Button("取消"); cancelButton.setVisible(false); cancelButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { resetState(); } }); panel.addButton(cancelButton); updateButton = new Button("更新"); updateButton.disable(); updateButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { if (!panel.isValid()) return; update(); } }); panel.addButton(updateButton); resetButton = new Button("取消"); resetButton.disable(); resetButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { store.rejectChanges(); resetState(); } }); panel.addButton(resetButton); panel.setBorders(false); panel.setBodyBorder(false); return panel; }
/** * Remember user/pass implementation <a href= * "http://stackoverflow.com/questions/1245174/is-it-possible-to-implement-cross-browser-username-password-autocomplete-in-gxt" * >based in this</a> and <a href= * "http://www.sencha.com/forum/showthread.php?72027-Auto-complete-login-form" >this</a>. */ public SignInForm(final I18nTranslationService i18n) { final Listener<FieldEvent> enterListener = new Listener<FieldEvent>() { @Override public void handleEvent(final FieldEvent fe) { if (fe.getEvent().getKeyCode() == 13) { onAcceptCallback.onSuccess(); } } }; super.addStyleName("kune-Margin-Large-trbl"); loginNickOrEmailField = new TextField<String>() { @Override protected void onRender(final Element target, final int index) { if (el() == null) { setElement(Document.get().getElementById("usernamerender")); } super.onRender(target, index); } @Override protected void setAriaState(final String stateName, final String stateValue) {} }; loginNickOrEmailField.setFieldLabel(i18n.t("Username")); loginNickOrEmailField.setName(USER_FIELD_ID); loginNickOrEmailField.setWidth(DEF_SMALL_FIELD_WIDTH); loginNickOrEmailField.setAllowBlank(false); loginNickOrEmailField.setValidationDelay(3000); loginNickOrEmailField.setId(USER_FIELD_ID); loginNickOrEmailField.setTabIndex(100); loginNickOrEmailField.addStyleName("k-lower"); loginNickOrEmailField.render(RootPanel.get(LOGIN_ID).getElement()); ComponentHelper.doAttach(loginNickOrEmailField); super.add(loginNickOrEmailField); loginNickOrEmailField.addListener(Events.OnKeyPress, enterListener); loginPassField = new TextField<String>() { @Override protected void onRender(final Element target, final int index) { if (el() == null) { final String elementId = "passwordrender"; setElement(Document.get().getElementById(elementId)); } super.onRender(target, index); } @Override protected void setAriaState(final String stateName, final String stateValue) {} }; loginPassField.setFieldLabel(i18n.t("Password")); loginPassField.setName(PASSWORD_FIELD_ID); loginPassField.setWidth(DEF_MEDIUM_FIELD_WIDTH); loginPassField.setPassword(true); loginPassField.setAllowBlank(false); loginPassField.setValidationDelay(3000); loginPassField.setId(PASSWORD_FIELD_ID); loginPassField.setTabIndex(101); loginPassField.render(RootPanel.get(LOGIN_ID).getElement()); ComponentHelper.doAttach(loginPassField); loginPassField.addListener(Events.OnKeyPress, enterListener); super.add(loginPassField); }
/** * 联系人 * * @return */ public ContentPanel createLinkManPanel() { CheckBoxSelectionModel cbs = new CheckBoxSelectionModel(); List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); columns.add(cbs.getColumn()); ColumnConfig lname = new ColumnConfig("lname", "姓名", 80); TextField<String> text = new TextField<String>(); lname.setEditor(new CellEditor(text)); columns.add(lname); ColumnConfig dept = new ColumnConfig("dept", "部门", 80); TextField<String> depttext = new TextField<String>(); dept.setEditor(new CellEditor(depttext)); columns.add(dept); ColumnConfig headship = new ColumnConfig("headship", "职务", 80); TextField<String> headshiptext = new TextField<String>(); headship.setEditor(new CellEditor(headshiptext)); columns.add(headship); ColumnConfig passportcode = new ColumnConfig("passportcode", "护照号", 80); TextField<String> passportcodetext = new TextField<String>(); passportcode.setEditor(new CellEditor(passportcodetext)); columns.add(passportcode); ColumnConfig postcode1 = new ColumnConfig("postcode", "邮编", 80); TextField<String> postcodetext = new TextField<String>(); postcode1.setEditor(new CellEditor(postcodetext)); columns.add(postcode1); ColumnModel cm = new ColumnModel(columns); ModelType type = new ModelType(); type.setRoot("records"); type.setRecordName("record"); type.setTotalName("totle"); type.addField("ccode", "ccode"); type.addField("lname"); type.addField("headship"); type.addField("dept"); type.addField("idx"); type.addField("addr"); type.addField("headship"); type.addField("passportcode"); type.addField("postcode"); type.addField("telephone"); type.addField("mobil"); type.addField("privatemobil"); type.addField("fax"); type.addField("addrtype"); StoreInfo info = new StoreInfo(); info.setTablename("ccodelinkman_info"); info.setSql("select * from ccodelinkman_info"); info.setParent(store); info.setAutoinccolumn("idx"); info.setLinkparentcolumns(new String[] {"ccode"}); info.setKeyname(new String[] {"ccode", "idx"}); BaseStore<JDBCModelData> branchorgadd = new BaseStore<JDBCModelData>(type, info); branchorgadd.setName("ccodelinkman_info"); BaseGrid branchorgaddgrid = new BaseGrid(branchorgadd, cm); cbs.setSelectionMode(SelectionMode.SINGLE); branchorgaddgrid.setSelectionModel(cbs); // officegrid.setAutoExpandColumn("ccode"); // panel.setLayout(new BorderLayout()); // ---------------------------- final BaseFormPanel formpanel = new BaseFormPanel(branchorgadd); TextField<String> branchtelephone = new TextField<String>(); branchtelephone.setName("telephone"); branchtelephone.setFieldLabel("办公电话"); formpanel.add(branchtelephone); final TextField<String> mobil = new TextField<String>(); mobil.setName("mobil"); mobil.setFieldLabel("移动电话"); formpanel.add(mobil); final TextField<String> privatemobil = new TextField<String>(); privatemobil.setName("privatemobil"); privatemobil.setFieldLabel("私人电话"); formpanel.add(privatemobil); privatemobil.addKeyListener( new KeyListener() { public void componentKeyUp(ComponentEvent event) { mobil.setValue(privatemobil.getValue()); } }); TextField<String> fax = new TextField<String>(); fax.setName("fax"); fax.setFieldLabel("传真"); formpanel.add(fax); TextField<String> addrtype = new TextField<String>(); addrtype.setName("addrtype"); addrtype.setFieldLabel("地址类型"); formpanel.add(addrtype); final TextField<String> postcode = new TextField<String>(); postcode.setName("postcode"); postcode.setFieldLabel("邮编"); formpanel.add(postcode); TextField<String> addr = new TextField<String>(); addr.setName("addr"); addr.setFieldLabel("通讯地址"); formpanel.add(addr); formpanel.setScrollMode(Scroll.AUTO); formpanel.inited(); // 设置联系人界面上半部分的布局 LayoutContainer top = new LayoutContainer(); TableLayout tl = new TableLayout(2); top.setLayout(tl); TableData td = new TableData(); td.setColspan(1); td.setRowspan(1); td.setVerticalAlign(VerticalAlignment.TOP); // TableData td2 = new TableData(); // td2.setColspan(1); // td2.setRowspan(1); // branchorgaddgrid.setSize(300, 200); // branchorgaddgrid.setAutoWidth(true); branchorgaddgrid.setWidth(420); branchorgaddgrid.setAutoHeight(true); // formpanel.setSize(300, 380); formpanel.setHeaderVisible(false); top.add(branchorgaddgrid, td); top.add(formpanel, td); // ----------------家庭成员ccodecustomersolicitude List<ColumnConfig> customercolumns = new ArrayList<ColumnConfig>(); CheckBoxSelectionModel cbs2 = new CheckBoxSelectionModel(); customercolumns.add(cbs2.getColumn()); ColumnConfig leaguertype = new ColumnConfig("leaguertype", "家庭成员", 80); TextField<String> leaguertext = new TextField<String>(); leaguertype.setEditor(new CellEditor(leaguertext)); customercolumns.add(leaguertype); ColumnConfig leaguername = new ColumnConfig("leaguername", "姓名", 80); TextField<String> leaguernametext = new TextField<String>(); leaguername.setEditor(new CellEditor(leaguernametext)); customercolumns.add(leaguername); ColumnModel customercm = new ColumnModel(customercolumns); ModelType customertype = new ModelType(); customertype.setRoot("records"); customertype.setRecordName("record"); customertype.addField("ccode", "ccode"); customertype.addField("leaguertype"); customertype.addField("leaguername"); customertype.addField("idx"); customertype.addField("birthday"); customertype.addField("commemorateday"); customertype.addField("religion"); customertype.addField("bekeenon"); customertype.addField("tourexperience"); customertype.addField("workexperience"); customertype.addField("occupation"); customertype.addField("workheadship"); customertype.addField("remark"); StoreInfo customerinfo = new StoreInfo(); customerinfo.setTablename("ccodecustomersolicitude"); customerinfo.setSql("select * from ccodecustomersolicitude"); customerinfo.setParent(store); customerinfo.setAutoinccolumn("idx"); customerinfo.setLinkparentcolumns(new String[] {"ccode"}); customerinfo.setKeyname(new String[] {"ccode", "idx"}); BaseStore<JDBCModelData> customertypestore = new BaseStore<JDBCModelData>(customertype, customerinfo); customertypestore.setName("ccodecustomersolicitude"); BaseGrid customertypegrid = new BaseGrid(customertypestore, customercm); cbs2.setSelectionMode(SelectionMode.SINGLE); customertypegrid.setSelectionModel(cbs2); // --------------------- // -- BaseFormPanel formcustomerpanel = new BaseFormPanel(customertypestore); formcustomerpanel.setHeaderVisible(false); TextField<String> birthdayc = new TextField<String>(); birthdayc.setName("birthday"); birthdayc.setFieldLabel("生日"); formcustomerpanel.add(birthdayc); TextField<String> commemorateday = new TextField<String>(); commemorateday.setName("commemorateday"); commemorateday.setFieldLabel("纪念日"); formcustomerpanel.add(commemorateday); TextField religion = new TextField(); religion.setName("religion"); religion.setFieldLabel("信仰"); formcustomerpanel.add(religion); TextField bekeenon = new TextField(); bekeenon.setName("bekeenon"); bekeenon.setFieldLabel("主要爱好"); formcustomerpanel.add(bekeenon); TextField tourexperience = new TextField(); tourexperience.setName("tourexperience"); tourexperience.setFieldLabel("旅游经历"); formcustomerpanel.add(tourexperience); TextField workexperience = new TextField(); workexperience.setName("workexperience"); workexperience.setFieldLabel("工作经历"); formcustomerpanel.add(workexperience); TextField occupation = new TextField(); occupation.setName("occupation"); occupation.setFieldLabel("职业"); formcustomerpanel.add(occupation); TextField workheadship = new TextField(); workheadship.setName("workheadship"); workheadship.setFieldLabel("工作职位"); formcustomerpanel.add(workheadship); TextField remark = new TextField(); remark.setName("remark"); remark.setFieldLabel("备注"); formcustomerpanel.add(remark); formcustomerpanel.setScrollMode(Scroll.AUTO); formcustomerpanel.inited(); // FormBinding formcustomerBindings = new FormBinding(formcustomerpanel, true); // formcustomerBindings.setStore(customertypestore); // --end ContentPanel panel = new ContentPanel(); panel.setLayout(new TableLayout(2)); panel.setHeaderVisible(false); TableData td1 = new TableData(); td1.setColspan(2); // panel.add(formpanel,td2); customertypegrid.setAutoHeight(true); // customertypegrid.setAutoWidth(true); customertypegrid.setWidth(420); // formcustomerpanel.setSize(300, 300); TableData td2 = new TableData(); td2.setColspan(1); td2.setRowspan(1); LayoutContainer bottom = new LayoutContainer(); TableLayout bottomtl = new TableLayout(2); bottom.setLayout(bottomtl); TableData bottomtd = new TableData(); bottomtd.setVerticalAlign(VerticalAlignment.TOP); bottomtd.setColspan(1); bottomtd.setRowspan(1); bottom.add(customertypegrid, bottomtd); bottom.add(formcustomerpanel, bottomtd); FieldSet fieldset = new FieldSet(); fieldset.setHeading("联系人"); FieldSet fieldset2 = new FieldSet(); fieldset2.setHeading("联系人家庭成员信息"); fieldset.add(top); fieldset2.add(bottom); panel.add(fieldset, td1); panel.add(fieldset2, td1); panel.setScrollMode(Scroll.AUTO); panel.setAutoHeight(true); panel.setAutoWidth(true); return panel; }
/** * 客户资料 * * @return */ private LayoutContainer CreateCCodeDetailPanel() { LayoutContainer main = new LayoutContainer(); TableLayout tl = new TableLayout(2); main.setLayout(new TableLayout(2)); BaseFormPanel leftpanel = new BaseFormPanel(store); leftpanel.setLayout(new FormLayout()); FormData fd = new FormData(200, 30); leftpanel.setHeaderVisible(false); leftpanel.setBodyBorder(false); BaseFormPanel rightpanel = new BaseFormPanel(store); rightpanel.setBodyBorder(false); rightpanel.setHeaderVisible(false); TextField<String> ccode = new TextField<String>(); ccode.setName("ccode"); ccode.setAllowBlank(false); ccode.setFieldLabel("编码"); TextField<String> name = new TextField<String>(); name.setName("cname"); name.setAllowBlank(false); name.setFieldLabel("名称"); TextField<String> shortcode = new TextField<String>(); shortcode.setName("shortcode"); shortcode.setFieldLabel("简码"); TextField<String> ccodesource = new TextField<String>(); ccodesource.setName("ccodesource"); ccodesource.setFieldLabel("客户来源"); TextField<String> ncode = new TextField<String>(); ncode.setName("ncode"); ncode.setFieldLabel("国别"); TextField<String> httpurl = new TextField<String>(); httpurl.setName("httpurl"); httpurl.setFieldLabel("网址"); DateField setupdate = new DateField(); setupdate.setName("setupdate"); setupdate.setFieldLabel("成立时间"); TextField<String> registercapital = new TextField<String>(); registercapital.setName("registercapital"); registercapital.setFieldLabel("注册资金"); TextField<String> employeenum = new TextField<String>(); employeenum.setName("employeenum"); employeenum.setFieldLabel("雇用人数"); TextField<String> branchorgnum = new TextField<String>(); branchorgnum.setName("branchorgnum"); branchorgnum.setFieldLabel("分支机构数"); TextField<String> artperson = new TextField<String>(); artperson.setName("artperson"); artperson.setFieldLabel("法人代表"); TextField<String> taxno = new TextField<String>(); taxno.setName("taxno"); taxno.setFieldLabel("税务登记号"); TextField<String> partner = new TextField<String>(); partner.setName("partner"); partner.setFieldLabel("合伙人"); /* * TextField<String> artno = new TextField<String>(); * artno.setName("artno"); artno.setFieldLabel("企业代码"); */ TextField<String> comholsdatedesc = new TextField<String>(); comholsdatedesc.setName("comholsdatedesc"); comholsdatedesc.setFieldLabel("公司特殊假日"); BaseGrid gudong = CreateCCodeGudongPanel(); gudong.setAutoHeight(true); gudong.setAutoWidth(true); leftpanel.add(ccode, fd); rightpanel.add(name, fd); leftpanel.add(shortcode, fd); rightpanel.add(ccodesource, fd); leftpanel.add(httpurl, fd); rightpanel.add(setupdate, fd); leftpanel.add(registercapital, fd); rightpanel.add(employeenum, fd); leftpanel.add(branchorgnum, fd); rightpanel.add(artperson, fd); leftpanel.add(taxno, fd); rightpanel.add(partner, fd); leftpanel.add(comholsdatedesc, fd); TableData td = new TableData(); td.setColspan(1); td.setRowspan(1); // 对齐方式 td.setHorizontalAlign(HorizontalAlignment.LEFT); td.setVerticalAlign(VerticalAlignment.TOP); // rightpanel.add(gudong,td2); leftpanel.inited(); rightpanel.inited(); FieldSet fieldSet = new FieldSet(); fieldSet.setHeading("股东占股比例"); fieldSet.add(gudong); main.add(leftpanel, td); main.add(rightpanel, td); main.add(fieldSet, td); return main; }
@Override protected void onRender(Element parent, int index) { super.onRender(parent, index); final Stock stock = TestData.getStocks().get(0); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(10); StringBuffer sb = new StringBuffer(); sb.append("<div class=text style='line-height: 1.5em'>"); sb.append("<b>Name:</b> {name}<br>"); sb.append("<b>Symbol:</b> {symbol}<br>"); sb.append("<b>Last:</b> {last}<br>"); sb.append("<b>Change:</b> {[new Number(values.change).toFixed(2)]}<br>"); sb.append("<b>Updated:</b> {date:date(\"MM/dd/y\")}<br>"); sb.append("</div>"); final XTemplate template = XTemplate.create(sb.toString()); final HTML html = new HTML(); html.setWidth("160px"); template.overwrite(html.getElement(), Util.getJsObject(stock)); hp.add(html); // update template when model changes stock.addChangeListener( new ChangeListener() { public void modelChanged(ChangeEvent event) { template.overwrite(html.getElement(), Util.getJsObject(stock)); } }); FormPanel panel = new FormPanel(); panel.setHeaderVisible(false); panel.setWidth(350); TextField<String> name = new TextField<String>(); name.setName("nameField"); name.setFieldLabel("Name"); panel.add(name); TextField<String> symbol = new TextField<String>(); symbol.setName("symbol"); symbol.setFieldLabel("Symbol"); panel.add(symbol); NumberField open = new NumberField(); open.setName("last"); open.setFieldLabel("Last"); panel.add(open); NumberField change = new NumberField(); change.setName("change"); change.setFieldLabel("Change"); change.setFormat(NumberFormat.getDecimalFormat()); panel.add(change); DateField last = new DateField(); last.setName("date"); last.setFieldLabel("Updated"); panel.add(last); SimpleComboBox<String> scb = new SimpleComboBox<String>(); for (Stock s : TestData.getStocks()) { scb.add(s.getName()); } scb.setFieldLabel("Name"); scb.setForceSelection(true); scb.setTypeAhead(true); scb.setName("company"); scb.setTriggerAction(TriggerAction.ALL); panel.add(scb); hp.add(panel); FormBinding binding = new FormBinding(panel); // manually add bindings binding.addFieldBinding(new FieldBinding(name, "name")); binding.addFieldBinding(new FieldBinding(symbol, "symbol")); binding.addFieldBinding(new SimpleComboBoxFieldBinding(scb, "name")); // auto bind remaining fields, field name must match model property name binding.autoBind(); binding.bind(stock); add(hp); }
/** * 主窗口 */ void initmainpanel() { w = new BaseFormPanel(getStore()); w.setHeaderVisible(false); Label cardno_l = new Label("卡号:"); cardno_l.setWidth("50"); Label cname_l = new Label("名字:"); cname_l.setWidth("50"); Label sex_l = new Label("性别:"); sex_l.setWidth("50"); Label edu_l = new Label("学历:"); Label bird_l = new Label("出生日期:"); Label mobil_l = new Label("手机号:"); Label idno_l = new Label("身份证号:"); Label mark_l = new Label("备注:"); cardno_t = new TextField<String>(); cardno_t.setAllowBlank(false); cardno_t.addListener(Events.Change, this); cname_t = new TextField<String>(); cname_t.setAllowBlank(false); // passwordc_t.setAllowBlank(false); // password_t.setAllowBlank(false); // // TextField<String> sex_t = new TextField<String>(); // BaseGridEditor sex_t= CodeNameMapFactory.aa(); BaseComboBoxForm<BaseModelData> sex_t = CodeNameMapFactory.createSexInput_F(); TextField<String> edu_t = new TextField<String>(); // CodeNameMapFactory codenamemap = new CodeNameMapFactory(); // BaseGridEditor<String> edu_t =codenamemap.createSexInput_G(); // createBocdeInput_F DateField bird_t = new DateField(); bird_t.setAutoWidth(true); bird_t.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-M-d H:mm:ss")); TextField<String> mobil_t = new TextField<String>(); mobil_t.setAllowBlank(false); TextField<String> idno_t = new TextField<String>(); TextArea mark_t = new TextArea(); mark_t.setSize(420, 40); // TextField<String> password_t = new TextField<String>(); password_t.setPassword(true); passwordc_t.setPassword(true); // password_t.setToolTip("将光标放到此处,并由会员录入自己的密码"); ccode_t = new TextField<String>(); // ccode_t.setEnabled(false); ccode_t.setVisible(false); icode_t = new TextField<String>(); icode_t.setVisible(false); cardno_t.setName("s_cardno"); cname_t.setName("cname"); password_t.setName("password"); sex_t.setName("s_sex"); edu_t.setName("s_edu"); bird_t.setName("s_birid"); mobil_t.setName("s_mobil"); idno_t.setName("s_idno"); mark_t.setName("s_mark"); ccode_t.setName("ccode"); icode_t.setName("icode"); // password_t.setName("password"); TableLayout tl = new TableLayout(4); tl.setWidth("600"); w.setLayout(tl); TableData td = new TableData(); td.setColspan(1); // td.setWidth("2000"); td.setMargin(100); td.setPadding(5); td.setRowspan(1); TableData td2 = new TableData(); td2.setColspan(3); // td.setWidth("2000"); td2.setMargin(100); td2.setPadding(5); td2.setRowspan(1); w.add(cardno_l, td); w.add(cardno_t, td); w.add(cname_l, td); w.add(cname_t, td); w.add(mobil_l, td); w.add(mobil_t, td); w.add(sex_l, td); w.add(sex_t, td); w.add(new Label("密码:"), td); w.add(password_t, td); w.add(new Label("重新录入密码:"), td); w.add(passwordc_t, td); w.add(edu_l, td); w.add(edu_t, td); w.add(bird_l, td); w.add(bird_t, td); w.add(idno_l, td); w.add(idno_t, td); w.add(new Label(""), td); w.add(new Label(""), td); w.add(mark_l, td); w.add(mark_t, td2); w.add(new Label("销售人员:"), td); BaseComboBoxForm<BaseModelData> cbf = createBcode_filter(); cbf.setName("rbcode"); cbf.setAllowBlank(false); w.add(cbf, td2); w.add(ccode_t, td); w.add(icode_t, td); w.setBottomComponent(addfinace); addfinace.addListener(Events.Select, this); addfinace.setEnabled(false); w.inited(); // w.setAutoHeight(true); // w.setAutoWidth(true); // w.setSize(661, 300); cardno_t.addListener(Events.Change, this); cname_t.addListener(Events.Change, this); // mobil_t.addListener(Events.Change, this); cardno_t.setValidateOnBlur(true); cname_t.setValidateOnBlur(true); }
protected void onRender(Element parent, int index) { super.onRender(parent, index); setLayout(new FitLayout()); setId("network-dhcp-nat"); FormData formData = new FormData(); formData.setWidth(250); m_formPanel = new FormPanel(); m_formPanel.setFrame(false); m_formPanel.setBodyBorder(false); m_formPanel.setHeaderVisible(false); m_formPanel.setLayout(new FlowLayout()); m_formPanel.setStyleAttribute("min-width", "775px"); m_formPanel.setStyleAttribute("padding-left", "30px"); FieldSet fieldSet = new FieldSet(); FormLayout layoutAccount = new FormLayout(); layoutAccount.setLabelWidth(Constants.LABEL_WIDTH_FORM); fieldSet.setLayout(layoutAccount); fieldSet.setBorders(false); // // Tool Tip Box // toolTipField.setText(defaultToolTip); fieldSet.add(toolTipField); // // Router Mode // m_modeCombo = new SimpleComboBox<String>(); m_modeCombo.setName("comboMode"); m_modeCombo.setFieldLabel(MSGS.netRouterMode()); m_modeCombo.setEditable(false); m_modeCombo.setTypeAhead(true); m_modeCombo.setTriggerAction(TriggerAction.ALL); for (GwtNetRouterMode mode : GwtNetRouterMode.values()) { m_modeCombo.add(MessageUtils.get(mode.name())); } m_modeCombo.setSimpleValue(MessageUtils.get(GwtNetRouterMode.netRouterDchpNat.name())); m_modeCombo.setValidator( new Validator() { public String validate(Field<?> field, String value) { if (m_tcpIpConfigTab.isDhcp() && !value.equals(MessageUtils.get(GwtNetRouterMode.netRouterOff.toString()))) { return MSGS.netRouterConfiguredForDhcpError(); } return null; } }); m_modeCombo.addSelectionChangedListener( new SelectionChangedListener<SimpleComboValue<String>>() { @Override public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) { refreshForm(); } }); m_modeCombo.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipMode())); m_modeCombo.addStyleName("kura-combobox"); m_modeCombo.addPlugin(m_dirtyPlugin); fieldSet.add(m_modeCombo, formData); // // DHCP Beginning Address // m_dhcpBeginAddressField = new TextField<String>(); m_dhcpBeginAddressField.setAllowBlank(true); m_dhcpBeginAddressField.setName("dhcpBeginAddress"); m_dhcpBeginAddressField.setFieldLabel(MSGS.netRouterDhcpBeginningAddress()); m_dhcpBeginAddressField.setRegex(IPV4_REGEX); m_dhcpBeginAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress()); m_dhcpBeginAddressField.addPlugin(m_dirtyPlugin); m_dhcpBeginAddressField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR); m_dhcpBeginAddressField.addStyleName("kura-textfield"); m_dhcpBeginAddressField.addListener( Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpBeginAddr())); fieldSet.add(m_dhcpBeginAddressField, formData); // // DHCP Ending Address // m_dhcpEndAddressField = new TextField<String>(); m_dhcpEndAddressField.setAllowBlank(true); m_dhcpEndAddressField.setName("dhcpEndAddress"); m_dhcpEndAddressField.setFieldLabel(MSGS.netRouterDhcpEndingAddress()); m_dhcpEndAddressField.setRegex(IPV4_REGEX); m_dhcpEndAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress()); m_dhcpEndAddressField.addListener( Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpEndAddr())); m_dhcpEndAddressField.addStyleName("kura-textfield"); ; m_dhcpEndAddressField.addPlugin(m_dirtyPlugin); fieldSet.add(m_dhcpEndAddressField, formData); // // DHCP Subnet Mask // m_dhcpSubnetMaskField = new TextField<String>(); m_dhcpSubnetMaskField.setAllowBlank(true); m_dhcpSubnetMaskField.setName("dhcpSubnetMask"); m_dhcpSubnetMaskField.setFieldLabel(MSGS.netRouterDhcpSubnetMask()); m_dhcpSubnetMaskField.setRegex(IPV4_REGEX); m_dhcpSubnetMaskField.addListener( Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpSubnet())); m_dhcpSubnetMaskField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress()); m_dhcpSubnetMaskField.addStyleName("kura-textfield"); m_dhcpSubnetMaskField.addPlugin(m_dirtyPlugin); fieldSet.add(m_dhcpSubnetMaskField, formData); // // DHCP Default Lease // m_dhcpLeaseDefaultField = new NumberField(); m_dhcpLeaseDefaultField.setPropertyEditorType(Integer.class); m_dhcpLeaseDefaultField.setAllowDecimals(false); m_dhcpLeaseDefaultField.setAllowNegative(false); m_dhcpLeaseDefaultField.setMaxValue(Integer.MAX_VALUE); m_dhcpLeaseDefaultField.setAllowBlank(true); m_dhcpLeaseDefaultField.setName("dhcpDefaultLease"); m_dhcpLeaseDefaultField.setFieldLabel(MSGS.netRouterDhcpDefaultLease()); m_dhcpLeaseDefaultField.addListener( Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpDefaultLeaseTime())); m_dhcpLeaseDefaultField.addPlugin(m_dirtyPlugin); fieldSet.add(m_dhcpLeaseDefaultField, formData); // // DHCP Max Lease // m_dhcpLeaseMaxField = new NumberField(); m_dhcpLeaseMaxField.setPropertyEditorType(Integer.class); m_dhcpLeaseMaxField.setAllowDecimals(false); m_dhcpLeaseMaxField.setAllowNegative(false); m_dhcpLeaseMaxField.setMaxValue(Integer.MAX_VALUE); m_dhcpLeaseMaxField.setAllowBlank(true); m_dhcpLeaseMaxField.setName("dhcpMaxLease"); m_dhcpLeaseMaxField.setFieldLabel(MSGS.netRouterDhcpMaxLease()); m_dhcpLeaseMaxField.addListener( Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpMaxLeaseTime())); m_dhcpLeaseMaxField.addPlugin(m_dirtyPlugin); fieldSet.add(m_dhcpLeaseMaxField, formData); // // Pass DNS // m_passDnsRadioTrue = new Radio(); m_passDnsRadioTrue.setBoxLabel(MSGS.trueLabel()); m_passDnsRadioTrue.setItemId("true"); m_passDnsRadioFalse = new Radio(); m_passDnsRadioFalse.setBoxLabel(MSGS.falseLabel()); m_passDnsRadioFalse.setItemId("false"); m_passDnsRadioGroup = new RadioGroup(); m_passDnsRadioGroup.setName("dhcpPassDns"); m_passDnsRadioGroup.setFieldLabel(MSGS.netRouterPassDns()); m_passDnsRadioGroup.add(m_passDnsRadioTrue); m_passDnsRadioGroup.add(m_passDnsRadioFalse); m_passDnsRadioGroup.addPlugin(m_dirtyPlugin); m_passDnsRadioGroup.addListener( Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipPassDns())); fieldSet.add(m_passDnsRadioGroup, formData); m_formPanel.add(fieldSet); add(m_formPanel); setScrollMode(Scroll.AUTO); m_initialized = true; }