Esempio n. 1
0
  /**
   * 客户的股东和比例
   *
   * @return
   */
  private BaseGrid CreateCCodeGudongPanel() {

    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());
    ColumnConfig gudongmingcheng = new ColumnConfig("gudong", "股东名称", 100);
    TextField<String> gudongmingchengtext = new TextField<String>();
    gudongmingcheng.setEditor(new CellEditor(gudongmingchengtext));
    columns.add(gudongmingcheng);
    ColumnConfig rate = new ColumnConfig("rate", "占股比例", 100);
    TextField<String> ratetext = new TextField<String>();
    rate.setEditor(new CellEditor(ratetext));
    columns.add(rate);

    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");

    type.addField("gudong");
    type.addField("rate");

    StoreInfo info = new StoreInfo();

    info.setTablename("ccodegudong");
    info.setSql("select * from ccodegudong");
    info.setParent(store); // 关联主表
    info.setAutoinccolumn("idx"); // 自增字段,如果子表一定需要
    info.setLinkparentcolumns(new String[] {"ccode"}); // 关联主表字段
    info.setKeyname(new String[] {"ccode", "idx"}); // 主键

    BaseStore gudong = new BaseStore<JDBCModelData>(type, info);
    gudong.setName("gudong");
    ColumnModel cm = new ColumnModel(columns);
    BaseGrid gudonggrid = new BaseGrid(gudong, cm);

    cbs.setSelectionMode(SelectionMode.SINGLE);

    gudonggrid.setSelectionModel(cbs);
    gudonggrid.setAutoHeight(true);
    gudonggrid.setAutoWidth(true);

    registerStore(gudong);
    return gudonggrid;
  }
Esempio n. 2
0
  private ContentPanel CreateGcode() {
    ContentPanel panel = new ContentPanel();
    //		panel.setSize(400, 400);
    panel.setAutoHeight(true);
    panel.setAutoWidth(true);
    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());
    ColumnConfig gcode = new ColumnConfig("gcode", "商品大类编码", 100);
    TextField<String> gcodetext = new TextField<String>();
    gcode.setEditor(new CellEditor(gcodetext));
    columns.add(gcode);
    ColumnConfig gname = new ColumnConfig("gname", "商品大类名称", 100);
    TextField<String> gnametext = new TextField<String>();
    gname.setEditor(new CellEditor(gnametext));
    columns.add(gname);

    ColumnConfig attrcode = new ColumnConfig("attrcode", "商品大类属性", 100);
    TextField<String> attrcodetext = new TextField<String>();
    attrcode.setEditor(new CellEditor(attrcodetext));
    columns.add(attrcode);

    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");

    type.addField("gcode");
    type.addField("gname");
    type.addField("attrcode");

    StoreInfo info = new StoreInfo();

    info.setTablename("gcode");
    info.setKeyname(new String[] {"gcode"});
    info.setSql("select * from gcode");
    //		info.setParent(store);// 关联主表
    //		info.setAutoinccolumn("idx"); // 自增字段,如果子表一定需要
    //		info.setLinkparentcolumns(new String[] { "ccode" }); // 关联主表字段
    gcodestore = new BaseStore<JDBCModelData>(type, info);
    //		gudong.setName("gudong");
    //		gudong.setKeyname(new String[] { "ccode", "idx" }); // 主键
    ColumnModel cm = new ColumnModel(columns);
    gcodeegrid = new BaseGrid(gcodestore, cm);

    cbs.setSelectionMode(SelectionMode.SINGLE);

    gcodeegrid.setSelectionModel(cbs);
    gcodeegrid.setAutoHeight(true);
    gcodeegrid.setAutoWidth(true);
    gcodeegrid
        .getSelectionModel()
        .addSelectionChangedListener(
            new SelectionChangedListener() {

              @Override
              public void selectionChanged(SelectionChangedEvent se) {
                if (se.getSelection().size() > 0) {
                  //					attrgroupgrid.getModel()
                  attrgroupgrid.getSelectionModel().deselectAll();
                  //	int attr =
                  // ((BaseModelData)gcodeegrid.getSelectionModel().getSelectedItems().get(0)).get("attrcode");
                  //	System.out.println("size="+attrgroupgrid.getStore().getModels().size());
                  //	for(int i=0;i<((BaseModelData)attrgroupgrid.getModel()).getProperties().size())

                  int size = attrgroupgrid.getStore().getModels().size();
                  int attr =
                      Integer.parseInt(
                          ((BaseModelData) gcodeegrid.getSelectionModel().getSelectedItems().get(0))
                              .get("attrcode")
                              .toString());

                  for (int i = 0; i < size; i++) {
                    int attrcode =
                        Integer.parseInt(attrgroupgrid.getValue(i, "attrcode").toString());
                    if ((attrcode & attr) == attrcode) {
                      attrgroupgrid.getSelectionModel().select(i, true);
                    }
                  }

                } else {
                  attrgroupgrid.getSelectionModel().deselectAll();
                }
              }
            });

    registerStore(gcodestore);
    panel.add(gcodeegrid);
    panel.setScrollMode(Scroll.AUTO);
    return panel;
  }
Esempio n. 3
0
  private ContentPanel CreateGcodeAttrgroup() {
    ContentPanel panel = new ContentPanel();
    CheckBoxSelectionModel cbs =
        new CheckBoxSelectionModel() {
          public void deselectAll() {
            doDeselect(new ArrayList(selected), true);
          }
        };
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());
    ColumnConfig attr = new ColumnConfig("attrcode", "商品属性", 100);
    TextField<String> attrtext = new TextField<String>();
    attr.setEditor(new CellEditor(attrtext));
    columns.add(attr);

    ColumnConfig attrname = new ColumnConfig("attrname", "商品属性", 100);
    //		TextField<String> attrnametext = new TextField<String>();
    //		attrname.setEditor(new CellEditor(attrnametext));
    columns.add(attrname);

    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");

    type.addField("attrcode");
    type.addField("attrname");

    StoreInfo info = new StoreInfo();

    info.setTablename("b2cgcodeattrgroup");

    info.setSql("select * from b2cgcodeattrgroup");
    //		info.setParent(store);// 关联主表
    //		info.setAutoinccolumn("idx"); // 自增字段,如果子表一定需要
    //		info.setLinkparentcolumns(new String[] { "ccode" }); // 关联主表字段
    BaseStore<JDBCModelData> gcodeattrgroup = new BaseStore<JDBCModelData>(type, info);
    //		gudong.setName("gudong");
    //		gudong.setKeyname(new String[] { "ccode", "idx" }); // 主键
    ColumnModel cm = new ColumnModel(columns);
    attrgroupgrid = new BaseGrid(gcodeattrgroup, cm);

    cbs.setSelectionMode(SelectionMode.MULTI);

    attrgroupgrid.setSelectionModel(cbs);
    attrgroupgrid.setAutoHeight(true);
    attrgroupgrid.setAutoWidth(true);

    attrgroupgrid
        .getSelectionModel()
        .addSelectionChangedListener(
            new SelectionChangedListener() {

              @Override
              public void selectionChanged(SelectionChangedEvent se) {

                //
                //	System.out.println("----"+gcodeegrid.getSelectionModel().getSelectedItems().size());
                if (gcodeegrid.getSelectionModel().getSelectedItems().size() < 1
                    && attrgroupgrid.getSelectionModel().getSelectedItems().size() > 0) {

                  MessageBox.alert("警告", "请先选择商品大类!否则属性将不能正确设置。", null);
                  return;
                }

                if (gcodeegrid.getSelectionModel().getSelectedItems().size() < 1) {
                  return;
                }
                int size = se.getSelection().size();
                int z = 0;
                for (int i = 0; i < size; i++) {
                  //
                  //	System.out.println("--"+((BaseModelData)se.getSelection().get(i)).get("attrcode"));
                  z =
                      z
                          | Integer.parseInt(
                              ((BaseModelData) se.getSelection().get(i))
                                  .get("attrcode")
                                  .toString());
                }

                System.out.println("z=" + z);
                // ((BaseModelData)gcodeegrid.getSelectionModel().getSelectedItems().get(0)).set("attrcode", z);
                int index = 0;
                if (gcodeegrid.getSelectionModel().getSelectedItems().size() > 0)
                  index =
                      gcodestore.indexOf(
                          (BaseModelData) gcodeegrid.getSelectionModel().getSelectedItems().get(0));
                if (index >= 0) gcodestore.setValue(index, "attrcode", z);
                else {
                  MessageBox.alert("警告", "未找到指定的行!", null);
                }
              }
            });

    //		registerStore(gcodeattrgroup); 不参与保存,所以不注册
    panel.add(attrgroupgrid);

    return panel;
  }
Esempio n. 4
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;
  }