Exemplo n.º 1
0
  private FieldSet wrapField(
      final Field field, final MetaField metaField, final LayoutContainer container) {
    FieldSet fs = new FieldSet();
    fs.setLayout(new FitLayout());
    fs.setHeading(metaField.getLabel());
    fs.setCheckboxToggle(true);
    fs.addListener(
        Events.Expand,
        new Listener<BaseEvent>() {
          public void handleEvent(BaseEvent be) {
            enabledFields.put(metaField.getName(), field);
          }
        });
    fs.addListener(
        Events.Collapse,
        new Listener<BaseEvent>() {
          public void handleEvent(BaseEvent be) {
            enabledFields.remove(metaField.getName());
          }
        });
    fs.add(field);
    fs.setExpanded(false);

    return fs;
  }
  private void initialize() {
    FieldSet responseFieldSet = new FieldSet();
    responseFieldSet.setHeading("District Comparisons");
    responseFieldSet.setCheckboxToggle(false);

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(75);
    responseFieldSet.setLayout(layout);

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    //		configs.add(new ColumnConfig("district", "District", 100));
    configs.add(new ColumnConfig("subcounty", "Subcounty", 200));
    configs.add(new ColumnConfig("bh", "Boreholes", 200));
    configs.add(new ColumnConfig("sw", "Shallow Wells", 200));
    configs.add(new ColumnConfig("yt", "Public Taps", 100));
    configs.add(new ColumnConfig("ps", "Protected Springs", 100));
    configs.add(new ColumnConfig("total", "Total", 100));
    store = new ListStore<DistrictComparisonSummary>();
    cm = new ColumnModel(configs);
    setBodyBorder(true);
    setHeading("District Comparisons");
    setButtonAlign(HorizontalAlignment.CENTER);
    setLayout(new FitLayout());
    setSize(600, 300);
    grid = new Grid<DistrictComparisonSummary>(store, cm);
    grid.setStyleAttribute("borderTop", "none");
    grid.setAutoWidth(true);
    grid.setBorders(false);
    grid.setStripeRows(true);
    grid.setColumnLines(true);
    grid.setColumnReordering(true);
    grid.addListener(
        Events.RowDoubleClick,
        new Listener<GridEvent<BeanModel>>() {

          @Override
          public void handleEvent(GridEvent<BeanModel> be) {
            DistrictComparisonSummary summary = grid.getSelectionModel().getSelectedItem();
          }
        });
    grid.getAriaSupport().setLabelledBy(getHeader().getId() + "-label");
    responseFieldSet.add(grid);
    add(grid);
    setLayout(new FitLayout());
  }
Exemplo n.º 3
0
  private FieldSet setupIdentifierfieldSet(int widthPanel, int tabIndex) {
    FieldSet identifierfieldSet = new FieldSet();
    identifierfieldSet.setHeading("Identifiers");
    identifierfieldSet.setCollapsible(true);
    identifierfieldSet.setBorders(false);
    FormLayout identifierlayout = new FormLayout();
    identifierlayout.setLabelWidth(150);
    identifierlayout.setDefaultWidth(390); // It is the real function to set the textField width
    identifierfieldSet.setLayout(identifierlayout);

    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.setWidth(widthPanel);
    cp.add(setupIdentifierGrid(identifierStore, widthPanel - 33, tabIndex));

    identifierfieldSet.add(cp);

    return identifierfieldSet;
  }
Exemplo n.º 4
0
  private LayoutContainer getChart() {
    FieldSet fs = new FieldSet();
    fs.setHeading("Chart");
    fs.setLayout(new FitLayout());

    String url = !Examples.isExplorer() ? "../../" : "";
    url += "gxt/chart/open-flash-chart.swf";

    final Chart chart = new Chart(url);
    chart.setBorders(true);
    fs.add(chart, new FitData(0, 0, 20, 0));
    updateCmd =
        new Command() {
          public void execute() {
            chart.setChartModel(example.getChartModel(numSegments));
          }
        };

    adjustUpdateSpeed(updateSpeed);
    return fs;
  }
  @Override
  public void addComponent() {
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(10);
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading("Share Project to Users");
    fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    this.projectNameLabel = new Label();
    this.projectNameLabel.setStyleAttribute("font-size", "13");
    this.ownerLabel = new Label();
    this.ownerLabel.setStyleAttribute("font-size", "13");
    this.organizationLabel = new Label();
    this.organizationLabel.setStyleAttribute("font-size", "13");
    fieldSet.add(this.projectNameLabel, new MarginData(10));
    fieldSet.add(ownerLabel, new MarginData(10));
    fieldSet.add(organizationLabel, new MarginData(10));
    verticalPanel.add(fieldSet);
    //
    LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout());
    labelListContainer.setHeight(20);
    labelListContainer.setStyleAttribute("background-color", "white");
    labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    Label organizationUserLabel = new Label("Organization Users:");
    organizationUserLabel.setStyleAttribute("font-size", "13");
    organizationUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST));
    Label projectSharedUserLabel = new Label("Project Shared Users:");
    projectSharedUserLabel.setStyleAttribute("font-size", "13");
    projectSharedUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST));
    verticalPanel.add(labelListContainer);
    //
    final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>();
    lists.setMode(Mode.INSERT);
    lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75);
    lists.setStyleAttribute("margin-left", "11px");
    lists.setHideLabel(Boolean.TRUE);

    ListField<GPSimpleUser> from = lists.getFromList();
    from.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.fromStore = new ListStore<GPSimpleUser>();
    from.setStore(this.fromStore);
    ListField<GPSimpleUser> to = lists.getToList();
    to.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.toStore = new ListStore<GPSimpleUser>();
    to.setStore(this.toStore);
    Button cancelButton =
        new Button(
            "GoTo Search Project",
            BasicWidgetResources.ICONS.gear(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                ShareProjectPanel.this.reset();
                projectManagementWidget.showSearchProjectPanel();
              }
            });
    super.addButton(cancelButton);
    saveButton =
        new Button(
            "Save",
            BasicWidgetResources.ICONS.save(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                toStore.commitChanges();
                List<Long> accountIDsProject =
                    Lists.newArrayListWithCapacity(toStore.getModels().size());
                IGPAccountDetail accountDetail =
                    Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
                boolean test = false;
                for (GPSimpleUser user : toStore.getModels()) {
                  if (user.getId().equals(accountDetail.getId())) {
                    test = true;
                  }
                  accountIDsProject.add(user.getId());
                }
                final boolean isShared = test;
                ShareProjectPanel.this.reset();
                LayerRemote.Util.getInstance()
                    .shareProjectToUsers(
                        project.getId(),
                        accountIDsProject,
                        new AsyncCallback<Boolean>() {
                          @Override
                          public void onFailure(Throwable caught) {
                            System.out.println("Error on saving user to share project");
                          }

                          @Override
                          public void onSuccess(Boolean result) {
                            //                                System.out.println("Project is Shared:
                            // " + isShared);
                            if (project.isDefaultProject()) {
                              GPClientProject projInSession =
                                  Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name());
                              if (isShared) {
                                projInSession.setShared(Boolean.TRUE);
                              } else {
                                projInSession.setShared(Boolean.FALSE);
                              }
                            }
                            project.setShared(Boolean.TRUE);
                            loadData(project);
                          }
                        });
              }
            });
    super.addButton(saveButton);
    super.add(verticalPanel);
    super.add(lists, new FormData("98%"));
    LayoutContainer filterContainer = new LayoutContainer(new BorderLayout());
    this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users");
    filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST));
    this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List");
    filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST));
    filterContainer.setStyleAttribute("margin", "11px");
    super.add(filterContainer);
  }
Exemplo n.º 6
0
  /**
   * 联系人
   *
   * @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;
  }
Exemplo n.º 7
0
  /**
   * 客户资料
   *
   * @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;
  }
Exemplo n.º 8
0
  private FormPanel setupUserRightForm(String title, int tabIndex) {

    FormPanel formPanel = new FormPanel();
    formPanel.setTitle(title);
    formPanel.setHeaderVisible(false);
    formPanel.setBodyBorder(false);
    formPanel.setWidth(400);
    //	    formPanel.setLabelAlign(LabelAlign.RIGHT); // default is LEFT
    formPanel.setLabelWidth(150);

    // Address fields
    FieldSet addressfieldSet = new FieldSet();
    addressfieldSet.setHeading("Address");
    addressfieldSet.setCollapsible(true);
    addressfieldSet.setBorders(false);
    FormLayout addresslayout = new FormLayout();
    addresslayout.setLabelWidth(150);
    addressfieldSet.setLayout(addresslayout);

    address = new TextField<String>();
    address.setFieldLabel("Address");
    address.setTabIndex(tabIndex++);

    city = new TextField<String>();
    city.setFieldLabel("City");
    city.setAllowBlank(false);
    city.setTabIndex(tabIndex++);

    state = new ComboBox<State>();
    state.setFieldLabel("State");
    state.setEmptyText("Select a state...");
    state.setDisplayField("name");
    state.setWidth(150);
    state.setStore(states);
    state.setTypeAhead(true);
    state.setTriggerAction(TriggerAction.ALL);
    state.setTabIndex(tabIndex++);

    zip = new TextField<String>();
    zip.setFieldLabel("Zip Code");
    zip.setAllowBlank(false);
    zip.setTabIndex(tabIndex++);

    country = new ComboBox<Country>();
    country.setFieldLabel("Country");
    country.setEmptyText("Select a country...");
    country.setDisplayField("name");
    country.setTemplate(InputFormat.getFlagTemplate());
    country.setWidth(100);
    country.setStore(countries);
    country.setTypeAhead(true);
    country.setTriggerAction(TriggerAction.ALL);
    country.setTabIndex(tabIndex++);

    addressfieldSet.add(address);
    addressfieldSet.add(city);
    addressfieldSet.add(state);
    addressfieldSet.add(zip);
    addressfieldSet.add(country);

    FieldSet otherfieldSet = new FieldSet();
    otherfieldSet.setHeading("Other");
    otherfieldSet.setCollapsible(true);
    otherfieldSet.setBorders(false);
    FormLayout otherlayout = new FormLayout();
    otherlayout.setLabelWidth(150);
    otherfieldSet.setLayout(otherlayout);

    phoneNumber = new TextField<String>();
    phoneNumber.setFieldLabel("Phone Number");
    phoneNumber.setToolTip("xxx-xxxx");
    phoneNumber.setTabIndex(tabIndex++);

    email = new TextField<String>();
    email.setFieldLabel("Email");
    email.setAllowBlank(false);
    email.setRegex(InputFormat.EMAIL_FORMATS);
    email.getMessages().setRegexText("Invalid email format");
    //		    email.setAutoValidate(true);
    email.setToolTip("*****@*****.**");
    email.setTabIndex(tabIndex++);

    emailConfirm = new TextField<String>();
    emailConfirm.setFieldLabel("Confirm Email");
    emailConfirm.setRegex(InputFormat.EMAIL_FORMATS);
    emailConfirm.getMessages().setRegexText("Invalid email format");
    //		    email.setAutoValidate(true);
    emailConfirm.setToolTip("*****@*****.**");
    emailConfirm.setTabIndex(tabIndex++);

    webSite = new TextField<String>();
    webSite.setFieldLabel("Website");
    webSite.setTabIndex(tabIndex++);

    otherfieldSet.add(phoneNumber);
    otherfieldSet.add(email);
    otherfieldSet.add(emailConfirm);
    otherfieldSet.add(webSite);

    formPanel.add(addressfieldSet);
    formPanel.add(otherfieldSet);

    return formPanel;
  }
Exemplo n.º 9
0
  private FormPanel setupUserLeftForm(String title, int tabIndex) {

    FormPanel formPanel = new FormPanel();
    formPanel.setTitle(title);
    formPanel.setHeaderVisible(false);
    formPanel.setBodyBorder(false);
    formPanel.setWidth(400);
    //	    formPanel.setLabelAlign(LabelAlign.TOP); // default is LEFT
    formPanel.setLabelWidth(150);

    // Name fields
    FieldSet namefieldSet = new FieldSet();
    namefieldSet.setHeading("Username");
    namefieldSet.setCollapsible(true);
    namefieldSet.setBorders(false);
    FormLayout namelayout = new FormLayout();
    namelayout.setLabelWidth(150);
    //		    namelayout.setDefaultWidth(180); // It is the real function to set the textField width.
    // Default width is 200
    namefieldSet.setLayout(namelayout);

    userName = new TextField<String>();
    userName.setFieldLabel("Username");
    userName.setAllowBlank(false);
    //              userName.setReadOnly(true);
    userName.disable();
    userName.setTabIndex(tabIndex++);

    namefieldSet.add(userName);

    // Password fields
    FieldSet passwordfieldSet = new FieldSet();
    passwordfieldSet.setHeading("Password");
    passwordfieldSet.setCollapsible(true);
    passwordfieldSet.setBorders(false);
    FormLayout passwordlayout = new FormLayout();
    passwordlayout.setLabelWidth(150);
    passwordfieldSet.setLayout(passwordlayout);

    password = new TextField<String>();
    password.setFieldLabel("Current Password");
    password.setAllowBlank(false);
    password.setPassword(true);
    password.setTabIndex(tabIndex++);

    passwordNew = new TextField<String>();
    passwordNew.setFieldLabel("New Password");
    passwordNew.setPassword(true);
    passwordNew.setTabIndex(tabIndex++);

    passwordConfirm = new TextField<String>();
    passwordConfirm.setFieldLabel("Confirm Password");
    passwordConfirm.setPassword(true);
    passwordConfirm.setTabIndex(tabIndex++);

    passwordHint = new TextField<String>();
    passwordHint.setFieldLabel("Password Hint");
    passwordHint.setTabIndex(tabIndex++);

    passwordfieldSet.add(password);
    passwordfieldSet.add(passwordNew);
    passwordfieldSet.add(passwordConfirm);
    passwordfieldSet.add(passwordHint);

    FieldSet userInfofieldSet = new FieldSet();
    userInfofieldSet.setHeading("User Info");
    userInfofieldSet.setCollapsible(true);
    userInfofieldSet.setBorders(false);
    FormLayout userInfolayout = new FormLayout();
    userInfolayout.setLabelWidth(150);
    userInfofieldSet.setLayout(userInfolayout);

    firstName = new TextField<String>();
    firstName.setFieldLabel("First Name");
    firstName.setAllowBlank(false);
    // firstName.setLabelStyle("font-size:12px; margin-left: 20px");
    firstName.setTabIndex(tabIndex++);

    lastName = new TextField<String>();
    lastName.setFieldLabel("Last Name");
    lastName.setAllowBlank(false);
    lastName.setTabIndex(tabIndex++);

    userInfofieldSet.add(firstName);
    userInfofieldSet.add(lastName);

    formPanel.add(namefieldSet);
    formPanel.add(passwordfieldSet);
    formPanel.add(userInfofieldSet);

    return formPanel;
  }
Exemplo n.º 10
0
  private LayoutContainer getDetails() {
    LayoutContainer lc = new LayoutContainer();
    VBoxLayout vLayout = new VBoxLayout();
    vLayout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
    lc.setLayout(vLayout);

    FieldSet controls = new FieldSet();
    controls.setHeading("Controls");
    FormLayout fl = new FormLayout();
    fl.setLabelWidth(125);
    controls.setLayout(fl);

    Slider segments = new Slider();
    segments.setMaxValue(12);
    segments.setMinValue(1);
    segments.setIncrement(1);
    segments.setValue(numSegments);
    segments.addListener(
        Events.Change,
        new Listener<SliderEvent>() {
          public void handleEvent(SliderEvent be) {
            numSegments = be.getNewValue();
            adjustUpdateSpeed(updateSpeed);
          }
        });
    SliderField segFld = new SliderField(segments);
    segFld.setFieldLabel("Segments (#)");
    controls.add(segFld);

    final Slider update =
        new Slider() {
          @Override
          protected String onFormatValue(int value) {
            if (value == 0) return "Off";
            return super.onFormatValue(value);
          }
        };
    update.setMinValue(0);
    update.setMaxValue(3000);
    update.setIncrement(100);
    update.setValue(updateSpeed);
    update.setMessage("{0}ms");
    update.addListener(
        Events.Change,
        new Listener<SliderEvent>() {
          public void handleEvent(SliderEvent se) {
            adjustUpdateSpeed(se.getNewValue());
          }
        });
    SliderField updFld = new SliderField(update);
    updFld.setFieldLabel("Update Interval (ms)");
    controls.add(updFld);

    lc.add(controls);

    FieldSet gallery = new FieldSet();
    gallery.setHeading("Gallery");
    gallery.setLayout(new FitLayout());

    ListStore<GalleryChartModel> store = new ListStore<GalleryChartModel>();
    store.add(new GalleryChartModel("Area", "area.gif", new AreaChartExample()));
    store.add(new GalleryChartModel("Pie", "pie.gif", new PieChartExample()));
    store.add(new GalleryChartModel("Filled Bar", "filled.gif", new FilledBarChartExample()));
    store.add(new GalleryChartModel("Bar - Glass", "barglass.gif", new BarGlassChartExample()));
    store.add(new GalleryChartModel("Bar - 3D", "bar3d.gif", new Bar3DChartExample()));
    store.add(new GalleryChartModel("Radar", "radar.gif", new RadarChartExample()));
    store.add(
        new GalleryChartModel("Horizontal Bar", "horizontalbar.gif", new HorizontalChartExample()));
    store.add(new GalleryChartModel("Cylinder", "cylinder.gif", new CylinderChartExample()));
    store.add(new GalleryChartModel("Sketch Bar", "sketchbar.gif", new SketchChartExample()));

    ListView<GalleryChartModel> view =
        new ListView<GalleryChartModel>() {
          @Override
          protected GalleryChartModel prepareData(GalleryChartModel model) {
            String s = model.get("name");
            model.set("shortName", Format.ellipse(s, 15));
            return model;
          }
        };
    view.setId("img-chooser-view");
    view.setTemplate(getTemplate(!Examples.isExplorer() ? "../../" : ""));
    view.setStore(store);
    view.setItemSelector("div.thumb-wrap");
    view.getSelectionModel().select(0, false);
    view.getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<GalleryChartModel>>() {

              public void handleEvent(SelectionChangedEvent<GalleryChartModel> be) {
                example = be.getSelectedItem().getExample();
                adjustUpdateSpeed(updateSpeed);
              }
            });
    gallery.add(view, new FitData(0, 0, 20, 0));

    VBoxLayoutData vFlex = new VBoxLayoutData();
    vFlex.setFlex(1);
    lc.add(gallery, vFlex);
    return lc;
  }