BaseGridPanel createGrid() {
    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());

    //	ColumnConfig C1 = new ColumnConfig("icode", "icode", 80);
    //	columns.add(C1);
    ColumnConfig C2 = new ColumnConfig("code", "编码", 80);
    C2.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C2);
    ColumnConfig C3 = new ColumnConfig("name", "名称", 80);
    C3.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C3);
    //	ColumnConfig C4 = new ColumnConfig("type", "type", 80);
    //	columns.add(C4);
    //	ColumnConfig C5 = new ColumnConfig("mark", "mark", 80);
    //	columns.add(C5);

    ColumnModel cm = new ColumnModel(columns);
    grid = new BaseGridPanel(getStore(), cm, true, true);
    cbs.setSelectionMode(SelectionMode.SINGLE);
    grid.getBg().setSelectionModel(cbs);
    grid.setHeight(400);
    grid.setWidth(300);
    return grid;
  }
Example #2
0
  public UpcomingEventsTab() {

    super("Upcoming Events");
    addEventHandlers();

    setLayout(new FitLayout());

    store = new GroupingStore<UpcomingEventModelData>();
    // store.add(TestData.getStocks());

    ColumnConfig country = new ColumnConfig("country", "Country", 30);
    ColumnConfig city = new ColumnConfig("city", "City", 20);
    ColumnConfig venueName = new ColumnConfig("venueName", "Venue Name", 20);
    ColumnConfig startDate = new ColumnConfig("startDate", "Start Date", 20);
    ColumnConfig street = new ColumnConfig("street", "Street", 20);
    startDate.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));

    List<ColumnConfig> config = new ArrayList<ColumnConfig>();
    config.add(country);
    config.add(city);
    config.add(venueName);
    config.add(street);
    config.add(startDate);

    final ColumnModel cm = new ColumnModel(config);

    GroupingView view = new GroupingView();
    view.setShowGroupedColumn(false);
    view.setForceFit(true);
    view.setGroupRenderer(
        new GridGroupRenderer() {
          public String render(GroupColumnData data) {
            String f = cm.getColumnById(data.field).getHeader();
            String l = data.models.size() == 1 ? "Item" : "Items";
            return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
          }
        });

    Grid<UpcomingEventModelData> grid = new Grid<UpcomingEventModelData>(store, cm);
    grid.setView(view);
    grid.setBorders(true);

    grid.addListener(
        Events.RowDoubleClick,
        new Listener<GridEvent<UpcomingEventModelData>>() {

          public void handleEvent(GridEvent<UpcomingEventModelData> be) {

            Window.open(be.getModel().getUrl(), "Events", "");
          }
        });
    grid.setStateful(true);
    grid.setAutoExpandColumn("city");
    grid.setLoadMask(true);
    // grid.setBorders(true);
    // grid.setStripeRows(true);
    add(grid);
  }
  @Override
  public Grid<ModelData> initGrid(ListStore<ModelData> store) {
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();

    XTemplate tpl = XTemplate.create("<p><b>Message:</b> {message}</p>");

    RowExpander expander = new RowExpander();
    expander.setTemplate(tpl);

    ColumnConfig columnConfig = configColumn(JobExecEventBeanDesc.priorityRank, 50);
    columnConfig.setRenderer(
        new GridCellRenderer<ModelData>() {

          public Object render(
              ModelData model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<ModelData> store,
              Grid<ModelData> grid) {
            ExecutionStatus status = (ExecutionStatus) model.get(property);

            ImageResource imageResource = null;

            if (status == ExecutionStatus.OK) {
              imageResource = Icons.INSTANCE.accept();
            } else if (status == ExecutionStatus.RUNNING) {
              imageResource = Icons.INSTANCE.execute();
            } else if (status == ExecutionStatus.WARNING) {
              imageResource = Icons.INSTANCE.error();
            } else if (status == ExecutionStatus.ERROR) {
              imageResource = Icons.INSTANCE.exclamation();
            } else {
              imageResource = Icons.INSTANCE.information();
            }

            return new Image(imageResource);
          }
        });

    columns.add(expander);
    columns.add(configColumn(JobExecEventBeanDesc.origin, 50));
    columns.add(configColumn(JobExecEventBeanDesc.source, 50));
    columns.add(columnConfig);
    columns.add(configColumn(JobExecEventBeanDesc.time, 120));

    final ColumnModel cm = new ColumnModel(columns);

    Grid<ModelData> grid = new Grid<ModelData>(store, cm);
    grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    grid.addPlugin(expander);

    return grid;
  }
Example #4
0
  BaseGrid<BusiObject> create_bcode_contact_Grid() {
    CheckBoxSelectionModel<BusiObject> cbs = new CheckBoxSelectionModel<BusiObject>();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());

    ColumnConfig C3 = new ColumnConfig("enname", "英文名称", 80);
    C3.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C3);
    ColumnConfig C4 = new ColumnConfig("cnname", "中文名称", 80);
    C4.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C4);
    ColumnConfig C5 = new ColumnConfig("tel", "电话", 80);
    C5.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C5);
    ColumnConfig C6 = new ColumnConfig("Relationship", "关系", 80);
    BaseComboBoxX bc6 = new BaseComboBoxX("name", "dictionary", "where type='hr_relationship'");
    C6.setEditor(bc6.getCellEditor());
    columns.add(C6);

    ColumnModel cm = new ColumnModel(columns);
    bcode_contact_grid = new BaseGrid<BusiObject>(getStore(), cm, true, true);
    cbs.setSelectionMode(SelectionMode.SINGLE);
    bcode_contact_grid.setSelectionModel(cbs);
    bcode_contact_grid.setHeight(410);
    bcode_contact_grid.setWidth(750);
    return bcode_contact_grid;
  }
Example #5
0
  public ContentPanel CreateCcodeLeftPanel() {
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    ColumnConfig cname = new ColumnConfig("cname", "客户名称", 200);
    TextField<String> gnametext = new TextField<String>();
    cname.setEditor(new CellEditor(gnametext));
    columns.add(cname);

    ColumnConfig ccode = new ColumnConfig("ccode", "客户编码", 200);
    TextField<String> ccodetext = new TextField<String>();
    ccode.setEditor(new CellEditor(ccodetext));

    //		ccodetext.addListener(Events.Change,new  Listener<FieldEvent>(){
    //
    //			@Override
    //			public void handleEvent(FieldEvent be) {
    //				// TODO Auto-generated method stub
    //				System.out.println("_____________________________");
    //			}
    //
    //		});
    columns.add(ccode);
    DateField dateField = new DateField();

    ColumnModel cm = new ColumnModel(columns);

    // --set modetype
    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");
    type.setTotalName("totle");
    type.addField("ccode");
    type.addField("cname");
    // type.addField("Phone");
    // type.addField("imagepath");
    StoreInfo info = new StoreInfo();
    info.setTablename("ccode");
    info.setSql("select * from ccode");
    info.setKeyname(new String[] {"ccode"});
    BaseBusiLeftPanel basbusileftpanel = new BaseBusiLeftPanel(columns, type, info);
    store = basbusileftpanel.getStore();

    basbusileftpanel.getGrid().setAutoExpandColumn("cname");
    setMaincomponent(basbusileftpanel.getGrid());
    return basbusileftpanel.getPanel();
  }
  public void onRender(Item gradebookItemModel) {

    refreshCategoryPickerStore(gradebookItemModel);

    List<ItemModel> gradeItems = (List<ItemModel>) getGradeItems(gradebookItemModel);
    itemStore.add(gradeItems);

    // GRBK-643
    // If we have an import file/GB that doesn't have categories, we hide the columns in the setup
    // grid
    CategoryType cateogryType = gradebookItemModel.getCategoryType();
    if (CategoryType.NO_CATEGORIES == cateogryType) {

      // Hide category related columns
      columnConfigCategory.setHidden(true);
      columnConfigPercentCategory.setHidden(true);
    }
  }
Example #7
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;
  }
Example #8
0
  private ColumnModel buildColumnModel() {
    initExpander();
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig name = buildColumnConfig(DeployedComponent.NAME, I18N.DISPLAY.name(), 225);
    name.setMenuDisabled(true);
    name.setSortable(true);

    ColumnConfig version =
        buildColumnConfig(DeployedComponent.VERSION, I18N.DISPLAY.versionColumnHeader(), 100);
    version.setSortable(false);
    version.setMenuDisabled(true);

    ColumnConfig loc = buildColumnConfig(DeployedComponent.LOCATION, I18N.DISPLAY.path(), 250);
    loc.setMenuDisabled(true);
    loc.setSortable(false);

    configs.add(expander);
    configs.add(name);
    configs.add(version);
    configs.add(loc);

    return new ColumnModel(configs);
  }
  private ColumnModel getColumnModel() {

    final DateTimeFormat dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
    final NumberFormat number = NumberFormat.getFormat("R$ 0.00");

    GridCellRenderer<DTOContrato> numberRender =
        new GridCellRenderer<DTOContrato>() {
          public String render(
              DTOContrato model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<DTOContrato> store,
              Grid<DTOContrato> grid) {
            float val = (Float) model.get(property);
            return number.format(val);
          }
        };

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig columnConfig = new ColumnConfig("id", "Código", 50);
    configs.add(columnConfig);

    columnConfig = new ColumnConfig("nomeCliente", "Cliente", 250);
    configs.add(columnConfig);

    columnConfig = new ColumnConfig("dataInicio", "Início", 80);
    columnConfig.setDateTimeFormat(dateFormat);
    columnConfig.setAlignment(HorizontalAlignment.CENTER);
    configs.add(columnConfig);

    columnConfig = new ColumnConfig("dataTermino", "Término", 80);
    columnConfig.setDateTimeFormat(dateFormat);
    columnConfig.setAlignment(HorizontalAlignment.CENTER);
    configs.add(columnConfig);

    columnConfig = new ColumnConfig("valor", "Valor", 80);
    columnConfig.setRenderer(numberRender);
    columnConfig.setAlignment(HorizontalAlignment.RIGHT);
    configs.add(columnConfig);

    return new ColumnModel(configs);
  }
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FlowLayout(10));

    GridCellRenderer<Stock> buttonRenderer =
        new GridCellRenderer<Stock>() {

          private boolean init;

          public Object render(
              final Stock model,
              String property,
              ColumnData config,
              final int rowIndex,
              final int colIndex,
              ListStore<Stock> store,
              Grid<Stock> grid) {
            if (!init) {
              init = true;
              grid.addListener(
                  Events.ColumnResize,
                  new Listener<GridEvent<Stock>>() {

                    public void handleEvent(GridEvent<Stock> be) {
                      for (int i = 0; i < be.getGrid().getStore().getCount(); i++) {
                        if (be.getGrid().getView().getWidget(i, be.getColIndex()) != null
                            && be.getGrid().getView().getWidget(i, be.getColIndex())
                                instanceof BoxComponent) {
                          ((BoxComponent) be.getGrid().getView().getWidget(i, be.getColIndex()))
                              .setWidth(be.getWidth() - 10);
                        }
                      }
                    }
                  });
            }

            Button b =
                new Button(
                    (String) model.get(property),
                    new SelectionListener<ButtonEvent>() {
                      @Override
                      public void componentSelected(ButtonEvent ce) {
                        Info.display(
                            model.getName(), "<ul><li>" + model.getSymbol() + "</li></ul>");
                      }
                    });
            b.setWidth(grid.getColumnModel().getColumnWidth(colIndex) - 10);
            b.setToolTip("Click for more information");

            return b;
          }
        };

    final NumberFormat currency = NumberFormat.getCurrencyFormat();
    final NumberFormat number = NumberFormat.getFormat("0.00");

    GridCellRenderer<Stock> change =
        new GridCellRenderer<Stock>() {
          public String render(
              Stock model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<Stock> store,
              Grid<Stock> grid) {
            double val = (Double) model.get(property);
            String style = val < 0 ? "red" : "green";
            return "<span style='color:" + style + "'>" + number.format(val) + "</span>";
          }
        };

    GridCellRenderer<Stock> gridNumber =
        new GridCellRenderer<Stock>() {
          public String render(
              Stock model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<Stock> stor,
              Grid<Stock> grid) {
            Number value = model.<Number>get(property);
            return value == null ? null : currency.format(model.<Number>get(property));
          }
        };

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();
    column.setId("name");
    column.setHeaderHtml("Company");
    column.setWidth(200);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("symbol");
    column.setHeaderHtml("Symbol");
    column.setWidth(100);
    column.setRenderer(buttonRenderer);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("last");
    column.setHeaderHtml("Last");
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setWidth(75);
    column.setRenderer(gridNumber);
    configs.add(column);

    column = new ColumnConfig("change", "Change", 100);
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setRenderer(change);
    configs.add(column);

    column = new ColumnConfig("date", "Last Updated", 100);
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy"));
    configs.add(column);

    final ListStore<Stock> store = new ListStore<Stock>();
    store.add(Stock.getStocks());

    ColumnModel cm = new ColumnModel(configs);

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(false);
    //    cp.setIconStyle("icon-printer");
    cp.setIcon(
        AbstractImagePrototype.create(
            new ImageResource() {
              public int getHeight() {
                return 0;
              }

              public int getLeft() {
                return 0;
              }

              public SafeUri getSafeUri() {
                return null;
              }

              public int getTop() {
                return 0;
              }

              public String getURL() {
                return "resources/images/fam/printer.png";
              }

              public int getWidth() {
                return 0;
              }

              public boolean isAnimated() {
                return false;
              }

              public String getName() {
                return null;
              }
            }));
    //    cp.setIcon(Resources.ICONS.table());
    cp.setHeadingHtml("Widget Renderer Grid");
    cp.setButtonAlign(HorizontalAlignment.CENTER);
    cp.setLayout(new FitLayout());
    cp.setSize(600, 300);

    Grid<Stock> grid = new Grid<Stock>(store, cm);
    grid.setStyleAttribute("borderTop", "none");
    grid.setAutoExpandColumn("name");
    grid.setBorders(true);
    cp.add(grid);

    add(cp);
  }
  @Override
  public ColumnModel prepareColumnModel() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig nameColumn = new ColumnConfig();
    nameColumn.setId(GPSimpleUserKeyValue.NAME.toString());
    nameColumn.setHeader("Name");
    configs.add(nameColumn);

    ColumnConfig usernameColumn = new ColumnConfig();
    usernameColumn.setId(GPSimpleUserKeyValue.USERNAME.toString());
    usernameColumn.setHeader("Username");
    usernameColumn.setWidth(120);
    configs.add(usernameColumn);

    CheckColumnConfig enabledColumn = new CheckColumnConfig();
    enabledColumn.setId(GPUserManageDetailKeyValue.ENABLED.toString());
    enabledColumn.setHeader("Enabled");
    enabledColumn.setWidth(50);
    enabledColumn.setFixed(true);
    configs.add(enabledColumn);

    CheckColumnConfig tempColumn = new CheckColumnConfig();
    tempColumn.setId(GPUserManageDetailKeyValue.TEMPORARY.toString());
    tempColumn.setHeader("Temporary");
    tempColumn.setWidth(65);
    tempColumn.setFixed(true);
    configs.add(tempColumn);

    ColumnConfig roleColumn = new ColumnConfig();
    roleColumn.setId(GPSimpleUserKeyValue.AUTORITHY.toString());
    roleColumn.setHeader("Role");
    roleColumn.setWidth(80);
    configs.add(roleColumn);

    ColumnConfig trustedLevelColumn = new ColumnConfig();
    trustedLevelColumn.setId(GPSimpleUserKeyValue.TRUSTED_LEVEL.toString());
    trustedLevelColumn.setHeader("Trusted");
    trustedLevelColumn.setWidth(70);
    configs.add(trustedLevelColumn);

    ColumnConfig delColumn = new ColumnConfig();
    delColumn.setId("delColumn");
    delColumn.setHeader("Delete");
    delColumn.setWidth(40);
    delColumn.setFixed(true);
    delColumn.setResizable(false);
    delColumn.setSortable(false);
    delColumn.setRenderer(new DeleteUserRenderer());
    configs.add(delColumn);

    return new ColumnModel(configs);
  }
  private Grid<BeanModel> createTypeGrid() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    ColumnConfig column = new ColumnConfig();

    column.setId("code");
    column.setHeader("类型");
    column.setWidth(50);
    column.setRowHeader(true);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("size");
    column.setHeader("尺寸");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("description");
    column.setHeader("特征");
    column.setWidth(150);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("weight");
    column.setHeader("重量");
    column.setWidth(50);
    configs.add(column);

    Grid<BeanModel> grid = new Grid<BeanModel>(ironChestStore, new ColumnModel(configs));
    grid.setBorders(true);
    grid.setStyleAttribute("backgroundColor", "#dfe8f6");
    return grid;
  }
  private Grid<BeanModel> createBracketGrid() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    ColumnConfig column = new ColumnConfig();

    column.setId("code");
    column.setHeader("托架代码");
    column.setWidth(50);
    column.setRowHeader(true);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("manufacturer");
    column.setHeader("生产厂家");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("modelNo");
    column.setHeader("型号");
    column.setWidth(70);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("specification");
    column.setHeader("规格");
    column.setWidth(150);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("weight");
    column.setHeader("重量");
    column.setWidth(50);
    configs.add(column);

    Grid<BeanModel> grid = new Grid<BeanModel>(bracketStore, new ColumnModel(configs));
    grid.setBorders(true);
    return grid;
  }
Example #14
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;
  }
  public void draw(DoneDrawingCallback callback) {
    removeAll();

    final List<ColumnConfig> cols = getColumns();

    final Map<String, RowData> group = getGroupsForRows();
    final Map<String, String> groupIDToName = new HashMap<String, String>();
    final GroupingStore<BaseModelData> store = new GroupingStore<BaseModelData>();
    for (RowData row : getRows()) {
      final BaseModelData model = new BaseModelData();
      model.set("id", row.getField("id"));
      model.set("lockid", row.getField("lockid"));
      for (ColumnConfig col : cols) model.set(col.getId(), row.getField(col.getId()));
      RowData gID = group.get(row.getField("id"));
      if (gID == null) {
        model.set("groupid", "none");
        model.set("groupidentifier", null);
        groupIDToName.put("none", "No Group Defined");
      } else {
        model.set("groupid", gID.get("groupid"));
        model.set("groupidentifier", gID.get("id"));
        groupIDToName.put(gID.get("groupid"), "Working Set: " + gID.get("groupname"));
      }

      store.add(model);
    }
    store.groupBy("groupid");

    final GroupingView view = new GroupingView();
    view.setShowGroupedColumn(false);
    view.setGroupRenderer(
        new GridGroupRenderer() {
          public String render(GroupColumnData data) {
            return groupIDToName.get(data.group);
          }
        });

    final GridSelectionModel<BaseModelData> sel = new GridSelectionModel<BaseModelData>();
    sel.setSelectionMode(SelectionMode.SINGLE);

    grid = new Grid<BaseModelData>(store, new ColumnModel(cols));
    grid.setSelectionModel(sel);
    grid.setView(view);
    grid.addListener(
        Events.RowClick,
        new Listener<GridEvent>() {
          public void handleEvent(GridEvent be) {
            if (groupButton != null && be != null && be.getModel() != null)
              groupButton.setEnabled(be.getModel().get("groupidentifier") != null);
          }
        });
    // grid.setWidth(680);

    int size = 25;

    final LayoutContainer wrapper = new LayoutContainer();
    wrapper.setLayout(new FillLayout());
    // wrapper.setScrollMode(Scroll.ALWAYS);
    wrapper.add(grid);

    final LayoutContainer container = new LayoutContainer(new BorderLayout());
    container.setBorders(false);
    container.add(getToolBar(), new BorderLayoutData(LayoutRegion.SOUTH, size, size, size));
    container.add(wrapper, new BorderLayoutData(LayoutRegion.CENTER));

    add(container);

    callback.isDrawn();
  }
  /*
   * (non-Javadoc)
   *
   * @see it.geosolutions.geofence.gui.client.widget.GEOFENCEGridWidget#
   * prepareColumnModel()
   */
  @Override
  public ColumnModel prepareColumnModel() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig rulePriorityColumn = new ColumnConfig();
    rulePriorityColumn.setId(BeanKeyValue.PRIORITY.getValue());
    rulePriorityColumn.setWidth(COLUMN_PRIORITY_WIDTH);
    rulePriorityColumn.setMenuDisabled(false);
    rulePriorityColumn.setSortable(true);
    configs.add(rulePriorityColumn);

    ColumnConfig ruleUserColumn = new ColumnConfig();
    ruleUserColumn.setId(BeanKeyValue.USER.getValue());
    ruleUserColumn.setHeader("User");
    ruleUserColumn.setWidth(COLUMN_USER_WIDTH);
    ruleUserColumn.setRenderer(new UserRenderer());
    ruleUserColumn.setMenuDisabled(true);
    ruleUserColumn.setSortable(false);
    configs.add(ruleUserColumn);

    ColumnConfig ruleProfileColumn = new ColumnConfig();
    ruleProfileColumn.setId(BeanKeyValue.PROFILE.getValue());
    ruleProfileColumn.setHeader("Group");
    ruleProfileColumn.setWidth(COLUMN_GROUP_WIDTH);
    ruleProfileColumn.setRenderer(new GroupRenderer());
    ruleProfileColumn.setMenuDisabled(true);
    ruleProfileColumn.setSortable(false);
    configs.add(ruleProfileColumn);

    ColumnConfig ruleInstanceColumn = new ColumnConfig();
    ruleInstanceColumn.setId(BeanKeyValue.INSTANCE.getValue());
    ruleInstanceColumn.setHeader("Instance");
    ruleInstanceColumn.setWidth(COLUMN_INSTANCE_WIDTH);
    ruleInstanceColumn.setRenderer(new InstanceRenderer());
    ruleInstanceColumn.setMenuDisabled(true);
    ruleInstanceColumn.setSortable(false);
    configs.add(ruleInstanceColumn);

    ColumnConfig ipcfg = new ColumnConfig();
    ipcfg.setId(BeanKeyValue.SOURCE_IP_RANGE.getValue());
    ipcfg.setHeader("Src IP addr");
    ipcfg.setWidth(COLUMN_IPRANGE_WIDTH);
    ipcfg.setRenderer(new IPRangeRenderer());
    ipcfg.setMenuDisabled(true);
    ipcfg.setSortable(false);
    configs.add(ipcfg);

    ColumnConfig ruleServiceColumn = new ColumnConfig();
    ruleServiceColumn.setId(BeanKeyValue.SERVICE.getValue());
    ruleServiceColumn.setHeader("Service");
    ruleServiceColumn.setWidth(COLUMN_SERVICE_WIDTH);
    ruleServiceColumn.setRenderer(new ServiceRenderer());
    ruleServiceColumn.setMenuDisabled(true);
    ruleServiceColumn.setSortable(false);
    configs.add(ruleServiceColumn);

    ColumnConfig ruleRequestColumn = new ColumnConfig();
    ruleRequestColumn.setId(BeanKeyValue.REQUEST.getValue());
    ruleRequestColumn.setHeader("Request");
    ruleRequestColumn.setWidth(COLUMN_REQUEST_WIDTH);
    ruleRequestColumn.setRenderer(new RequestRenderer());
    ruleRequestColumn.setMenuDisabled(true);
    ruleRequestColumn.setSortable(false);
    configs.add(ruleRequestColumn);

    ColumnConfig ruleWorkspacesColumn = new ColumnConfig();
    ruleWorkspacesColumn.setId(BeanKeyValue.WORKSPACE.getValue());
    ruleWorkspacesColumn.setHeader("Workspace");
    ruleWorkspacesColumn.setWidth(COLUMN_WORKSPACE_WIDTH);
    ruleWorkspacesColumn.setRenderer(new WorkspaceRenderer());
    ruleWorkspacesColumn.setMenuDisabled(true);
    ruleWorkspacesColumn.setSortable(false);
    configs.add(ruleWorkspacesColumn);

    ColumnConfig ruleLayersColumn = new ColumnConfig();
    ruleLayersColumn.setId(BeanKeyValue.LAYER.getValue());
    ruleLayersColumn.setHeader("Layer");
    ruleLayersColumn.setWidth(COLUMN_LAYER_WIDTH);
    ruleLayersColumn.setRenderer(new LayerRenderer());
    ruleLayersColumn.setMenuDisabled(true);
    ruleLayersColumn.setSortable(false);
    configs.add(ruleLayersColumn);

    ColumnConfig ruleGrantsColumn = new ColumnConfig();
    ruleGrantsColumn.setId(BeanKeyValue.GRANT.getValue());
    ruleGrantsColumn.setHeader("Grant");
    ruleGrantsColumn.setWidth(COLUMN_GRANT_WIDTH);
    ruleGrantsColumn.setRenderer(this.createGrantsCustomField());
    ruleGrantsColumn.setMenuDisabled(true);
    ruleGrantsColumn.setSortable(false);
    configs.add(ruleGrantsColumn);

    ColumnConfig editRuleColumn = new ColumnConfig();
    editRuleColumn.setId("editRuleDetails");
    editRuleColumn.setWidth(COLUMN_EDIT_RULE_WIDTH);
    editRuleColumn.setRenderer(this.editRuleButton());
    editRuleColumn.setMenuDisabled(true);
    editRuleColumn.setSortable(false);
    configs.add(editRuleColumn);

    ColumnConfig detailsActionColumn = new ColumnConfig();
    detailsActionColumn.setId("ruleDetails");
    detailsActionColumn.setWidth(COLUMN_RULE_DETAILS_WIDTH);
    detailsActionColumn.setRenderer(this.createRuleDetailsButton());
    detailsActionColumn.setMenuDisabled(true);
    detailsActionColumn.setSortable(false);
    configs.add(detailsActionColumn);

    ColumnConfig removeActionColumn = new ColumnConfig();
    removeActionColumn.setId("removeRule");
    removeActionColumn.setWidth(COLUMN_REMOVE_RULE_WIDTH);
    removeActionColumn.setRenderer(this.createRuleDeleteButton());
    removeActionColumn.setMenuDisabled(true);
    removeActionColumn.setSortable(false);
    configs.add(removeActionColumn);

    ColumnConfig addActionColumn = new ColumnConfig();
    addActionColumn.setId("addRule");
    addActionColumn.setWidth(COLUMN_ADD_RULE_WIDTH);
    addActionColumn.setRenderer(this.createRuleAddButton());
    addActionColumn.setMenuDisabled(true);
    addActionColumn.setSortable(false);
    configs.add(addActionColumn);

    ColumnConfig priorityUpActionColumn = new ColumnConfig();
    priorityUpActionColumn.setId("rulePriorityUp");
    priorityUpActionColumn.setWidth(COLUMN_UP_RULE_WIDTH);
    priorityUpActionColumn.setRenderer(this.createRulePriorityUpButton());
    priorityUpActionColumn.setMenuDisabled(true);
    priorityUpActionColumn.setSortable(false);
    configs.add(priorityUpActionColumn);

    ColumnConfig priorityDownActionColumn = new ColumnConfig();
    priorityDownActionColumn.setId("rulePriorityDwn");
    priorityDownActionColumn.setWidth(COLUMN_DOWN_RULE_WIDTH);
    priorityDownActionColumn.setRenderer(this.createRulePriorityDownButton());
    priorityDownActionColumn.setMenuDisabled(true);
    priorityDownActionColumn.setSortable(false);
    configs.add(priorityDownActionColumn);

    return new ColumnModel(configs);
  }
Example #17
0
  // 分支机构
  public ContentPanel createCcodebranchorgaddPanel() {
    ContentPanel panel = new ContentPanel();
    panel.setSize(400, 400);
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();

    ColumnConfig ccode = new ColumnConfig("ccode", "ccode", 100);
    columns.add(ccode);

    ColumnConfig column = new ColumnConfig("orgname", "分支机构名称", 100);
    TextField<String> text = new TextField<String>();
    column.setEditor(new CellEditor(text));
    columns.add(column);
    ColumnConfig gname = new ColumnConfig("addr", "街道", 100);
    TextField<String> gnametext = new TextField<String>();
    gname.setEditor(new CellEditor(gnametext));
    columns.add(gname);

    ColumnConfig ncode = new ColumnConfig("ncode", "国别地区", 100);
    TextField<String> ncodetext = new TextField<String>();
    gname.setEditor(new CellEditor(ncodetext));
    columns.add(ncode);

    ColumnConfig fax = new ColumnConfig("fax", "传真", 100);
    TextField<String> faxtext = new TextField<String>();
    gname.setEditor(new CellEditor(faxtext));
    columns.add(fax);
    ColumnConfig telephone = new ColumnConfig("telephone", "电话", 100);
    TextField<String> telephonetext = new TextField<String>();
    gname.setEditor(new CellEditor(telephonetext));
    columns.add(telephone);
    ColumnConfig mobil = new ColumnConfig("mobil", "电话", 100);
    TextField<String> mobiltext = new TextField<String>();
    gname.setEditor(new CellEditor(mobiltext));
    columns.add(mobil);
    ColumnConfig postcode = new ColumnConfig("postcode", "邮编", 100);
    TextField<String> postcodetext = new TextField<String>();
    gname.setEditor(new CellEditor(postcodetext));
    columns.add(postcode);
    ColumnModel cm = new ColumnModel(columns);

    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");
    type.setTotalName("totle");
    type.addField("ccode", "ccode");
    type.addField("orgname");

    type.addField("addr");
    type.addField("ncode");
    type.addField("idx");
    type.addField("fax");
    type.addField("telephone");
    type.addField("mobil");
    type.addField("postcode");
    StoreInfo info = new StoreInfo();

    info.setTablename("ccodebranchorgadd");
    info.setSql("select * from ccodebranchorgadd");
    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("ccodebranchorgadd");
    BaseGrid branchorgaddstore = new BaseGrid(branchorgadd, cm);
    // officegrid.setAutoExpandColumn("ccode");
    // panel.setLayout(new BorderLayout());
    panel.setLayout(new FitLayout());
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0));
    panel.add(branchorgaddstore);
    registerStore(branchorgadd);
    return panel;
  }
Example #18
0
  BaseGrid createGrid() {
    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());

    //		ColumnConfig C3 = new ColumnConfig("icode",
    //				"icode", 180);
    //		columns.add(C3);

    ColumnConfig C1 = new ColumnConfig("bcode", "人员", 100);

    columns.add(C1);
    ColumnConfig C2 = new ColumnConfig("employstatus", "状态", 100);
    TextField<String> C2_t = new TextField<String>();
    C2.setEditor(new CellEditor(C2_t));
    columns.add(C2);

    ColumnConfig C3 = new ColumnConfig("leavereason", "离职原因", 100);
    TextField<String> C3_t = new TextField<String>();
    C3.setEditor(new CellEditor(C3_t));
    C3.setHidden(true);
    columns.add(C3);

    ColumnConfig C4 = new ColumnConfig("leavemark", "离职备注", 100);
    TextField<String> C4_t = new TextField<String>();
    C4.setEditor(new CellEditor(C4_t));
    C4.setHidden(true);
    columns.add(C4);

    ColumnConfig C5 = new ColumnConfig("Resignationdate", "离职日期", 180);
    C5.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
    //		C5.setEditor(new CellEditor(C4_t));
    C5.setHidden(true);
    columns.add(C5);

    ColumnModel cm = new ColumnModel(columns);
    grid = new BaseGrid(getStore(), cm);
    cbs.setSelectionMode(SelectionMode.SIMPLE);
    grid.setSelectionModel(cbs);
    return grid;
  }
Example #19
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;
  }
  private List<ColumnConfig> createColumns() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();

    column = new ColumnConfig();
    column.setId("nome");
    column.setHeader("Nominativo");
    column.setWidth(140);
    ListStore<PersonaleModel> store = new ListStore<PersonaleModel>();
    cmbxPersonale = new ComboBox<PersonaleModel>();
    cmbxPersonale.setStore(store);
    cmbxPersonale.setDisplayField("nomeCompleto");
    cmbxPersonale.setEmptyText("Selezionare..");
    cmbxPersonale.setEditable(true);
    cmbxPersonale.setVisible(true);
    cmbxPersonale.setTriggerAction(TriggerAction.ALL);
    cmbxPersonale.setForceSelection(true);
    cmbxPersonale.setAllowBlank(false);
    cmbxPersonale.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            getAllDipendenti();
          }

          private void getAllDipendenti() {
            AdministrationService.Util.getInstance()
                .getListaDipendentiModel(
                    "",
                    new AsyncCallback<List<PersonaleModel>>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        Window.alert("Errore connessione on getListaDipendentiModel();");
                        caught.printStackTrace();
                      }

                      @Override
                      public void onSuccess(List<PersonaleModel> result) {
                        if (result != null) {
                          ListStore<PersonaleModel> lista = new ListStore<PersonaleModel>();
                          lista.setStoreSorter(new StoreSorter<PersonaleModel>());
                          lista.setDefaultSort("nomeCompleto", SortDir.ASC);

                          lista.add(result);
                          cmbxPersonale.clear();
                          cmbxPersonale.setStore(lista);

                        } else Window.alert("error: Errore durante l'accesso ai dati Personale.");
                      }
                    });
          }
        });
    cmbxPersonale.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            int idPersonale = cmbxPersonale.getValue().get("idPersonale");

            csm.getSelectedItem().set("idPersonale", idPersonale);
          }
        });
    CellEditor editor =
        new CellEditor(cmbxPersonale) {
          @Override
          public Object preProcessValue(Object value) {
            if (value == null) {
              return value;
            }
            return cmbxPersonale.getValue();
          }

          @Override
          public Object postProcessValue(Object value) {
            if (value == null) {
              return value;
            }
            return ((ModelData) value).get("nomeCompleto");
          }
        };
    column.setEditor(editor);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("tipoOrario");
    column.setHeader("Orario Giornaliero");
    column.setWidth(50);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoAnnuo");
    column.setHeader("Costo Annuo");
    column.setWidth(100);
    txtfldcostoAnno = new TextField<String>();
    txtfldcostoAnno.setValue("0.00");
    txtfldcostoAnno.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldcostoAnno.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldcostoAnno.getValue() == null) txtfldcostoAnno.setValue("0.00");
              else {
                String valore = txtfldcostoAnno.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldcostoAnno.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldcostoAnno));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("orePreviste");
    column.setHeader("Ore Previste");
    column.setWidth(100);
    txtfldoreAnno = new TextField<String>();
    txtfldoreAnno.setValue("0");
    txtfldoreAnno.setRegex("^([0-9]+)");
    txtfldoreAnno.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldoreAnno.getValue() == null) txtfldoreAnno.setValue("0");
              else {
                String valore = txtfldoreAnno.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0";

                txtfldoreAnno.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldoreAnno));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoOrario");
    column.setHeader("Costo Orario");
    column.setWidth(100);
    txtfldcostoOrario = new TextField<String>();
    txtfldcostoOrario.setValue("0.00");
    txtfldcostoOrario.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldcostoOrario.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldcostoOrario.getValue() == null) txtfldcostoOrario.setValue("0.00");
              else {
                String valore = txtfldcostoOrario.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldcostoOrario.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldcostoOrario));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoTrasferta");
    column.setHeader("Costo Trasferta");
    column.setWidth(100);
    txtfldcostoTrasferta = new TextField<String>();
    txtfldcostoTrasferta.setValue("0.00");
    txtfldcostoTrasferta.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldcostoTrasferta.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldcostoTrasferta.getValue() == null) txtfldcostoTrasferta.setValue("0.00");
              else {
                String valore = txtfldcostoTrasferta.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldcostoTrasferta.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldcostoTrasferta));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoStruttura");
    column.setHeader("Costo Struttura");
    column.setWidth(100);
    txtfldCostoStruttura = new TextField<String>();
    txtfldCostoStruttura.setValue("0.00");
    txtfldCostoStruttura.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoStruttura.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoStruttura.getValue() == null) txtfldCostoStruttura.setValue("0.00");
              else {
                String valore = txtfldCostoStruttura.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoStruttura.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoStruttura));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoOneri");
    column.setHeader("Costo Oneri");
    column.setWidth(100);
    txtfldCostoOneri = new TextField<String>();
    txtfldCostoOneri.setValue("0.00");
    txtfldCostoOneri.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoOneri.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoOneri.getValue() == null) txtfldCostoOneri.setValue("0.00");
              else {
                String valore = txtfldCostoOneri.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoOneri.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoOneri));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoSw");
    column.setHeader("Costo SW");
    column.setWidth(100);
    txtfldCostoSoftware = new TextField<String>();
    txtfldCostoSoftware.setValue("0.00");
    txtfldCostoSoftware.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoSoftware.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoSoftware.getValue() == null) txtfldCostoSoftware.setValue("0.00");
              else {
                String valore = txtfldCostoSoftware.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoSoftware.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoSoftware));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoHw");
    column.setHeader("Costo HW");
    column.setWidth(100);
    txtfldCostoHardware = new TextField<String>();
    txtfldCostoHardware.setValue("0.00");
    txtfldCostoHardware.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoHardware.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoHardware.getValue() == null) txtfldCostoHardware.setValue("0.00");
              else {
                String valore = txtfldCostoHardware.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoHardware.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoHardware));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoHwSw");
    column.setHeader("Costo HwSw");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoOrarioTotale");
    column.setHeader("CostoTot/h");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("gruppoLavoro");
    column.setHeader("Area");
    column.setWidth(160);
    configs.add(column);

    return configs;
  }
Example #21
0
  private ColumnModel createColumnModel() {
    ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>();

    mainGridSelectionModel = new CheckBoxSelectionModel<ModelData>();
    mainGridSelectionModel.setSelectionMode(Style.SelectionMode.MULTI);
    columns.add(mainGridSelectionModel.getColumn());

    countryColumn = new ColumnConfig("country", HarvesterUI.ICONS.worldmap().getHTML(), 35);
    countryColumn.setAlignment(Style.HorizontalAlignment.CENTER);

    countryColumn.setRenderer(
        new GridCellRenderer<ModelData>() {
          public Object render(
              ModelData model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<ModelData> store,
              Grid<ModelData> grid) {
            if (model instanceof DataProviderUI) {
              if (model.get("country") != null && !model.get("country").equals("none")) {
                return "<img src=\"resources/images/countries/"
                    + model.get("country")
                    + ".png\" alt=\""
                    + model.get("countryName")
                    + "\" title=\""
                    + model.get("countryName")
                    + "\"/> ";
              }
            }
            return "";
          }
        });
    columns.add(countryColumn);

    ColumnConfig name =
        new ColumnConfig("name", "<CENTER>" + HarvesterUI.CONSTANTS.name() + "</CENTER>", 100);
    name.setRenderer(new TreeGridCellRenderer<ModelData>());
    name.setWidth(260);
    columns.add(name);

    // Europeana column only
    if (HarvesterUI.getProjectType().equals("EUROPEANA")) {
      ColumnConfig nameCode =
          new ColumnConfig(
              "nameCode", "<CENTER>" + HarvesterUI.CONSTANTS.nameCodeHeader() + "</CENTER>", 100);
      columns.add(nameCode);
    }

    ColumnConfig dataSourceSet =
        new ColumnConfig(
            "dataSourceSet", "<CENTER>" + HarvesterUI.CONSTANTS.dataSetHeader() + "</CENTER>", 100);
    columns.add(dataSourceSet);

    ColumnConfig metadataFormat =
        new ColumnConfig(
            "metadataFormat",
            "<CENTER>" + HarvesterUI.CONSTANTS.oaiSchemasHeader() + "</CENTER>",
            100);
    metadataFormat.setWidth(110);
    columns.add(metadataFormat);

    ColumnConfig ingest =
        new ColumnConfig(
            "ingest", "<CENTER>" + HarvesterUI.CONSTANTS.ingestTypeHeader() + "</CENTER>", 150);
    ingest.setRenderer(new IngestTypeRenderer());
    columns.add(ingest);
    ColumnConfig lastIngest =
        new ColumnConfig(
            "lastIngest", "<CENTER>" + HarvesterUI.CONSTANTS.lastIngestHeader() + "</CENTER>", 100);
    lastIngest.setWidth(130);
    lastIngest.setAlignment(Style.HorizontalAlignment.CENTER);
    lastIngest.setRenderer(new LastIngestRenderer());
    columns.add(lastIngest);
    ColumnConfig nextIngest =
        new ColumnConfig(
            "nextIngest", "<CENTER>" + HarvesterUI.CONSTANTS.nextIngestHeader() + "</CENTER>", 100);
    nextIngest.setRenderer(new NextIngestRenderer());
    nextIngest.setAlignment(Style.HorizontalAlignment.CENTER);
    nextIngest.setWidth(130);
    columns.add(nextIngest);
    ColumnConfig records =
        new ColumnConfig(
            "records", "<CENTER>" + HarvesterUI.CONSTANTS.records() + "</CENTER>", 100);
    records.setAlignment(Style.HorizontalAlignment.RIGHT);
    records.setRenderer(new RecordsRenderer());
    columns.add(records);
    ColumnConfig ingestStatus =
        new ColumnConfig(
            "status", "<CENTER>" + HarvesterUI.CONSTANTS.ingestStatusHeader() + "</CENTER>", 100);
    ingestStatus.setRenderer(new IngestStatusRenderer());
    ingestStatus.setAlignment(Style.HorizontalAlignment.CENTER);
    columns.add(ingestStatus);

    return new ColumnModel(columns);
  }
Example #22
0
  BaseGrid<BusiObject> create_bcode_famify_Grid() {
    CheckBoxSelectionModel<BusiObject> cbs = new CheckBoxSelectionModel<BusiObject>();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());
    ColumnConfig C3 = new ColumnConfig("ChineseName", "中文名", 80);
    C3.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C3);
    ColumnConfig C4 = new ColumnConfig("englishname", "英文名称", 80);
    C4.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C4);
    ColumnConfig C5 = new ColumnConfig("Relationship", "关系", 80);
    BaseComboBoxX bc5 = new BaseComboBoxX("name", "dictionary", "where type='hr_relationship'");
    C5.setEditor(bc5.getCellEditor());

    columns.add(C5);
    ColumnConfig C6 = new ColumnConfig("Birthday", "生日", 80);
    DateField dateField6 = new DateField();
    dateField6.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
    C6.setEditor(new CellEditor(dateField6));
    C6.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
    columns.add(C6);
    ColumnConfig C7 = new ColumnConfig("sex", "性别", 80);
    BaseComboBoxX bc7 = new BaseComboBoxX("name", "dictionary", "where type='hr_sex'");
    C7.setEditor(bc7.getCellEditor());
    columns.add(C7);
    ColumnConfig C8 = new ColumnConfig("Nationality", "国籍", 80);
    BaseComboBoxX bc8 = new BaseComboBoxX("name", "dictionary", "where type='hr_Country'");
    C8.setEditor(bc8.getCellEditor());
    columns.add(C8);
    ColumnConfig C9 = new ColumnConfig("PassportNo", "护照编码", 80);
    C9.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C9);
    ColumnConfig C10 = new ColumnConfig("PassportIssueCountry", "护照发出地", 80);
    C10.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C10);
    ColumnConfig C11 = new ColumnConfig("PassportIssueDate", "护照发出日期", 80);
    DateField dateField11 = new DateField();
    dateField11.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
    C11.setEditor(new CellEditor(dateField11));
    C11.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
    columns.add(C11);
    ColumnConfig C12 = new ColumnConfig("Occupation", "职业", 80);
    C12.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C12);
    ColumnConfig C13 = new ColumnConfig("Company", "公司", 80);
    C13.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C13);
    ColumnConfig C14 = new ColumnConfig("JobPosition", "职位", 80);
    C14.setEditor(new CellEditor(new TextField<String>()));
    columns.add(C14);

    ColumnModel cm = new ColumnModel(columns);
    bcode_famify_grid = new BaseGrid<BusiObject>(get_bcode_famify_Store(), cm, true, true);
    cbs.setSelectionMode(SelectionMode.SINGLE);
    bcode_famify_grid.setSelectionModel(cbs);
    bcode_famify_grid.setHeight(400);
    return bcode_famify_grid;
  }
Example #23
0
  /** Creates and configures the users grid.<br> */
  private void addGrid() {

    // renderer for active column
    GridCellRenderer<PortalUserSelModelData> activeRenderer =
        new GridCellRenderer<PortalUserSelModelData>() {
          public String render(
              PortalUserSelModelData model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<PortalUserSelModelData> s) {
            String checked = "";
            if (model.getDTO().isActive()) {
              checked = "checked='checked'";
            }
            return "<input type='checkbox' disabled='disabled' " + checked + " />";
          }
        };

    List<ColumnConfig> configs = new LinkedList<ColumnConfig>();

    ColumnConfig ccName = new ColumnConfig();
    ccName.setId(PortalUserSelModelData.PROPERTY_NAME);
    ccName.setWidth(COLUMN_NAME_WIDTH);
    ccName.setHeader(COLUMN_NAME_HEADER);
    configs.add(ccName);

    ColumnConfig ccDisplay = new ColumnConfig();
    ccDisplay.setId(PortalUserSelModelData.PROPERTY_DISPLAY_NAME);
    ccDisplay.setWidth(COLUMN_DISPLAY_NAME_WIDTH);
    ccDisplay.setHeader(COLUMN_DISPLAY_NAME_HEADER);
    configs.add(ccDisplay);

    ColumnConfig ccActive = new ColumnConfig();
    ccActive.setId(PortalUserSelModelData.PROPERTY_ACTIVE);
    ccActive.setWidth(COLUMN_ACTIVE_WIDTH);
    ccActive.setHeader(COLUMN_ACTIVE_HEADER);
    ccActive.setRenderer(activeRenderer);
    ccActive.setAlignment(HorizontalAlignment.CENTER);
    configs.add(ccActive);

    ColumnModel cm = new ColumnModel(configs);

    store = new ListStore<PortalUserSelModelData>();

    grid = new Grid<PortalUserSelModelData>(store, cm);
    grid.setAutoExpandColumn(PortalUserSelModelData.PROPERTY_NAME);
    grid.setSelectionModel(new GridSelectionModel<PortalUserSelModelData>());
    grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    grid.addListener(
        Events.RowClick,
        new Listener<GridEvent>() {
          public void handleEvent(GridEvent ge) {
            if (grid.getSelectionModel().getSelectedItem() != null) {
              enableButtons(true);
            }
          }
        });
    grid.getView().setForceFit(true);

    add(grid);
  }
Example #24
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;
  }
Example #25
0
  private Grid<AuditEventEntryWeb> setupGrid() {

    GridCellRenderer<AuditEventEntryWeb> refButtonRenderer =
        new GridCellRenderer<AuditEventEntryWeb>() {
          private boolean init;

          @Override
          public Object render(
              final AuditEventEntryWeb model,
              String property,
              com.extjs.gxt.ui.client.widget.grid.ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<AuditEventEntryWeb> store,
              Grid<AuditEventEntryWeb> grid) {

            if (!init) {
              init = true;
              grid.addListener(
                  Events.ColumnResize,
                  new Listener<GridEvent<AuditEventEntryWeb>>() {

                    public void handleEvent(GridEvent<AuditEventEntryWeb> be) {
                      for (int i = 0; i < be.getGrid().getStore().getCount(); i++) {
                        if (be.getGrid().getView().getWidget(i, be.getColIndex()) != null
                            && be.getGrid().getView().getWidget(i, be.getColIndex())
                                instanceof BoxComponent) {
                          ((BoxComponent) be.getGrid().getView().getWidget(i, be.getColIndex()))
                              .setWidth(be.getWidth() - 10);
                        }
                      }
                    }
                  });
            }

            AuditEventEntryWeb auditEvent = model;
            Long refRecordId = auditEvent.getRefRecordId();
            Button b = null;
            if (refRecordId != null) {
              b =
                  new Button(
                      "" + refRecordId.longValue(),
                      new SelectionListener<ButtonEvent>() {
                        @Override
                        public void componentSelected(ButtonEvent ce) {

                          AuditEventEntryWeb auditEvent = model;
                          // Info.display("Information", "Ref Record: "+
                          // auditEvent.getRefRecordId());
                          if (currentEntity != null) {
                            AppEvent event = new AppEvent(AppEvents.EntityByIdRequest);
                            event.setData("entityModel", currentEntity);
                            event.setData("recordId", auditEvent.getRefRecordId());
                            controller.handleEvent(event);
                          }
                        }
                      });
              b.setWidth(grid.getColumnModel().getColumnWidth(colIndex) - 10);
              b.setToolTip("Click for record detail information");
            }

            return b;
          }
        };

    GridCellRenderer<AuditEventEntryWeb> altButtonRenderer =
        new GridCellRenderer<AuditEventEntryWeb>() {
          private boolean init;

          @Override
          public Object render(
              final AuditEventEntryWeb model,
              String property,
              com.extjs.gxt.ui.client.widget.grid.ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<AuditEventEntryWeb> store,
              Grid<AuditEventEntryWeb> grid) {

            if (!init) {
              init = true;
              grid.addListener(
                  Events.ColumnResize,
                  new Listener<GridEvent<AuditEventEntryWeb>>() {

                    public void handleEvent(GridEvent<AuditEventEntryWeb> be) {
                      for (int i = 0; i < be.getGrid().getStore().getCount(); i++) {
                        if (be.getGrid().getView().getWidget(i, be.getColIndex()) != null
                            && be.getGrid().getView().getWidget(i, be.getColIndex())
                                instanceof BoxComponent) {
                          ((BoxComponent) be.getGrid().getView().getWidget(i, be.getColIndex()))
                              .setWidth(be.getWidth() - 10);
                        }
                      }
                    }
                  });
            }

            AuditEventEntryWeb auditEvent = model;
            Long refRecordId = auditEvent.getAltRefRecordId();
            Button b = null;
            if (refRecordId != null) {
              b =
                  new Button(
                      "" + refRecordId.longValue(),
                      new SelectionListener<ButtonEvent>() {
                        @Override
                        public void componentSelected(ButtonEvent ce) {

                          AuditEventEntryWeb auditEvent = model;
                          // Info.display("Information", "Alt Ref Record: "+
                          // auditEvent.getAltRefRecordId());
                          if (currentEntity != null) {
                            AppEvent event = new AppEvent(AppEvents.EntityByIdRequest);
                            event.setData("entityModel", currentEntity);
                            event.setData("recordId", auditEvent.getAltRefRecordId());
                            controller.handleEvent(event);
                          }
                        }
                      });
              b.setWidth(grid.getColumnModel().getColumnWidth(colIndex) - 10);
              b.setToolTip("Click for record detail information");
            }

            return b;
          }
        };

    // Render to display "Created By" as firstName LastName (Account)
    GridCellRenderer<AuditEventEntryWeb> adminRenderer =
        new GridCellRenderer<AuditEventEntryWeb>() {
          @Override
          public Object render(
              final AuditEventEntryWeb model,
              String property,
              com.extjs.gxt.ui.client.widget.grid.ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<AuditEventEntryWeb> store,
              Grid<AuditEventEntryWeb> grid) {

            AuditEventEntryWeb auditEvent = model;
            UserWeb user = auditEvent.getUserCreatedBy();
            String createdBy = "";
            if (user != null) {
              createdBy =
                  user.getFirstName() + " " + user.getLastName() + " (" + user.getUsername() + ")";
            }
            return createdBy;
          }
        };

    // Audit Event Grid
    ColumnConfig typeColumn =
        new ColumnConfig("auditEventType.auditEventTypeName", "Event Type", 150);
    ColumnConfig descriptionColumn = new ColumnConfig("auditEventDescription", "Description", 350);
    ColumnConfig dateTimeColumn = new ColumnConfig("dateCreated", "Date Created", 120);
    dateTimeColumn.setDateTimeFormat(DateTimeFormat.getShortDateTimeFormat());
    ColumnConfig refPersonColumn = new ColumnConfig("refRecordId", "Reference Record", 150);
    refPersonColumn.setRenderer(refButtonRenderer);
    ColumnConfig altRefPersonColumn =
        new ColumnConfig("altRefRecordId", "Alt Reference Record", 150);
    altRefPersonColumn.setRenderer(altButtonRenderer);
    ColumnConfig userCreatedByColumn =
        new ColumnConfig("userCreatedBy.username", "Created By", 150);
    userCreatedByColumn.setRenderer(adminRenderer);
    List<ColumnConfig> config = new ArrayList<ColumnConfig>();
    config.add(typeColumn);
    config.add(descriptionColumn);
    config.add(dateTimeColumn);
    config.add(refPersonColumn);
    config.add(altRefPersonColumn);
    config.add(userCreatedByColumn);

    final ColumnModel cm = new ColumnModel(config);

    Grid<AuditEventEntryWeb> grid = new Grid<AuditEventEntryWeb>(store, cm);
    grid.setBorders(true);
    grid.setAutoWidth(true);
    grid.setStripeRows(true);
    grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    grid.setHeight(330);

    grid.getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<AuditEventEntryWeb>>() {

              public void handleEvent(SelectionChangedEvent<AuditEventEntryWeb> be) {
                List<AuditEventEntryWeb> selection = be.getSelection();
              }
            });

    grid.addListener(
        Events.SortChange,
        new Listener<GridEvent<AuditEventEntryWeb>>() {
          public void handleEvent(GridEvent<AuditEventEntryWeb> be) {
            AuditEventEntryWeb selectField = be.getGrid().getSelectionModel().getSelectedItem();
          }
        });

    return grid;
  }
  private Grid<BeanModel> createGrid() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    ColumnConfig column = new ColumnConfig();

    column.setId("containerNo");
    column.setHeader("集装箱号");
    column.setWidth(100);
    column.setRowHeader(true);
    configs.add(column);

    GridCellRenderer<BeanModel> sizeCellRenderer =
        new GridCellRenderer<BeanModel>() {

          @Override
          public Object render(
              BeanModel model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<BeanModel> store,
              Grid<BeanModel> grid) {
            String code = model.get(property);
            ContainerSize containerSize = containerSizeStore.findModel("code", code).getBean();
            return containerSize.getSize();
          }
        };

    column = new ColumnConfig();
    column.setRenderer(sizeCellRenderer);
    column.setId("size");
    column.setHeader("尺寸");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("valentNum");
    column.setHeader("标准箱个数");
    column.setWidth(100);
    configs.add(column);

    ColumnModel cm = new ColumnModel(configs);

    AggregationRowConfig<BeanModel> statistics = new AggregationRowConfig<BeanModel>();
    statistics.setHtml("containerNo", "统计");

    statistics.setSummaryType("size", SummaryType.COUNT);
    statistics.setRenderer(
        "size",
        new AggregationRenderer<BeanModel>() {
          public Object render(
              Number value, int colIndex, Grid<BeanModel> grid, ListStore<BeanModel> store) {
            return "集装箱" + ContainerTabItem.this.store.getCount() + "个";
          }
        });

    statistics.setSummaryType("valentNum", SummaryType.SUM);
    statistics.setRenderer(
        "valentNum",
        new AggregationRenderer<BeanModel>() {
          public Object render(
              Number value, int colIndex, Grid<BeanModel> grid, ListStore<BeanModel> store) {
            if (value == null) {
              return "";
            }
            return "标准箱" + value.intValue() + "个";
          }
        });
    cm.addAggregationRow(statistics);

    store.setMonitorChanges(true);
    Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
    grid.setView(
        new GridView() {
          @Override
          protected void afterRender() {
            refresh(true);
          }
        });
    grid.setBorders(true);

    return grid;
  }
Example #27
0
  /**
   * 商品大类的属性
   *
   * @return
   */
  private ContentPanel CreateGcodeAttr() {
    ContentPanel panel = new ContentPanel();
    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 qty = new ColumnConfig("qty", "商品数量", 100);
    TextField<String> qtytext = new TextField<String>();
    qty.setEditor(new CellEditor(qtytext));
    columns.add(qty);

    ColumnConfig qtyunit = new ColumnConfig("qtyunit", "商品数量单位", 100);
    TextField<String> qtyunittext = new TextField<String>();
    qtyunit.setEditor(new CellEditor(qtyunittext));
    columns.add(qtyunit);

    ColumnConfig discount = new ColumnConfig("discount", "折扣比例", 100);
    TextField<String> discounttext = new TextField<String>();
    discount.setEditor(new CellEditor(discounttext));
    columns.add(discount);
    /*
    ColumnConfig attr = new ColumnConfig("attr", "商品属性", 60);
    TextField<String> attrtext = new TextField<String>();
    attr.setEditor(new CellEditor(attrtext));
    columns.add(attr);

    ColumnConfig attr2 = new ColumnConfig("attr2", "商品属性", 60);
    TextField<String> attr2text = new TextField<String>();
    attr2.setEditor(new CellEditor(attr2text));
    columns.add(attr2);
    ColumnConfig attr3 = new ColumnConfig("attr3", "商品属性", 60);
    TextField<String> attr3text = new TextField<String>();
    attr3.setEditor(new CellEditor(attr3text));
    columns.add(attr3);
    ColumnConfig attr4 = new ColumnConfig("attr4", "商品属性", 60);
    TextField<String> attr4text = new TextField<String>();
    attr4.setEditor(new CellEditor(attr4text));
    columns.add(attr4);
    ColumnConfig attr5 = new ColumnConfig("attr5", "商品属性", 60);
    TextField<String> attr5text = new TextField<String>();
    attr5.setEditor(new CellEditor(attr5text));
    columns.add(attr5);
    ColumnConfig attr6 = new ColumnConfig("attr6", "商品属性", 60);
    TextField<String> attr6text = new TextField<String>();
    attr6.setEditor(new CellEditor(attr6text));
    columns.add(attr6);

    ColumnConfig attr7 = new ColumnConfig("attr7", "商品属性", 60);
    TextField<String> attr7text = new TextField<String>();
    attr7.setEditor(new CellEditor(attr7text));
    columns.add(attr7);

    ColumnConfig attr8 = new ColumnConfig("attr8", "商品属性", 60);
    TextField<String> attr8text = new TextField<String>();
    attr8.setEditor(new CellEditor(attr8text));
    columns.add(attr8);*/

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

    type.addField("gcode");
    type.addField("qty");
    type.addField("qtyunit");
    type.addField("discount");

    /*		type.addField("attr1");
    type.addField("attr2");
    type.addField("attr3");
    type.addField("attr4");
    type.addField("attr5");
    type.addField("attr6");
    type.addField("attr7");
    type.addField("attr8");*/

    StoreInfo info = new StoreInfo();

    info.setTablename("b2cgcodeattr");

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

    cbs.setSelectionMode(SelectionMode.SINGLE);

    attrgrid.setSelectionModel(cbs);
    attrgrid.setAutoHeight(true);
    // attrgrid.setAutoWidth(true);

    registerStore(gcodeattr);
    attrgrid.setAutoHeight(true);
    panel.add(attrgrid);

    panel.setScrollMode(Scroll.AUTO);
    return panel;
  }
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    setLayout(new FlowLayout(10));

    Folder model = TestData.getTreeModel();

    TreeStore<ModelData> store = new TreeStore<ModelData>();

    store.add(model.getChildren(), true);

    ColumnConfig name = new ColumnConfig("name", "Name", 100);
    name.setRenderer(new TreeGridCellRenderer<ModelData>());

    ColumnConfig date = new ColumnConfig("author", "Author", 100);

    ColumnConfig size = new ColumnConfig("genre", "Genre", 100);

    ColumnModel cm = new ColumnModel(Arrays.asList(name, date, size));

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(false);
    cp.setHeading("TreeGrid");
    cp.setButtonAlign(HorizontalAlignment.CENTER);
    cp.setLayout(new FitLayout());
    cp.setFrame(true);
    cp.setSize(600, 300);

    TreeGrid<ModelData> tree = new TreeGrid<ModelData>(store, cm);
    tree.setBorders(true);
    tree.getStyle().setLeafIcon(Resources.ICONS.music());
    tree.setAutoExpandColumn("name");
    tree.setTrackMouseOver(false);

    cp.add(tree);

    add(cp);

    StoreFilterField<ModelData> filter =
        new StoreFilterField<ModelData>() {

          @Override
          protected boolean doSelect(
              Store<ModelData> store,
              ModelData parent,
              ModelData record,
              String property,
              String filter) {
            // only match leaf nodes
            if (record instanceof Folder) {
              return false;
            }
            String name = record.get("name");
            name = name.toLowerCase();
            if (name.startsWith(filter.toLowerCase())) {
              return true;
            }
            return false;
          }
        };
    filter.bind(store);

    ToolBar toolBar = new ToolBar();
    toolBar.setBorders(true);
    toolBar.add(new LabelToolItem("Filter:"));
    toolBar.add(filter);

    cp.setTopComponent(toolBar);
  }
  private Grid<BeanModel> createGrid() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    ColumnConfig column = new ColumnConfig();

    configs.add(selectionMode.getColumn());

    column.setId("no");
    column.setHeader("序号");
    column.setWidth(100);
    column.setRowHeader(true);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("name");
    column.setHeader("成品名称");
    column.setWidth(226);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("goodModel");
    column.setHeader("规格、型号");
    column.setWidth(226);
    configs.add(column);

    column = new ColumnConfig();
    column.setNumberFormat(NumberFormat.getCurrencyFormat(new MyCurrencyData()));
    column.setId("processFee");
    column.setHeader("加工费(单价)");
    column.setWidth(100);
    configs.add(column);

    store.setMonitorChanges(true);
    Grid<BeanModel> grid = new Grid<BeanModel>(store, new ColumnModel(configs));
    grid.setSelectionModel(selectionMode);
    grid.addPlugin(selectionMode);
    return grid;
  }
Example #30
0
  // 办公地址信息
  public ContentPanel createOfficePanel() {
    ContentPanel panel = new ContentPanel();
    panel.setSize(400, 400);
    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());
    ColumnConfig ccode = new ColumnConfig("ccode", "ccode", 100);
    columns.add(ccode);

    ColumnConfig column = new ColumnConfig("addrtype", "地址类型", 100);
    TextField<String> text = new TextField<String>();
    column.setEditor(new CellEditor(text));
    columns.add(column);
    ColumnConfig addr = new ColumnConfig("addr", "街道", 100);
    TextField<String> addrtext = new TextField<String>();
    addr.setEditor(new CellEditor(addrtext));
    columns.add(addr);

    ColumnConfig ncode = new ColumnConfig("ncode", "国别地区", 100);
    TextField<String> ncodetext = new TextField<String>();
    ncode.setEditor(new CellEditor(ncodetext));
    columns.add(ncode);

    ColumnConfig fax = new ColumnConfig("fax", "传真", 100);
    TextField<String> faxtext = new TextField<String>();
    fax.setEditor(new CellEditor(faxtext));
    columns.add(fax);

    ColumnModel cm = new ColumnModel(columns);

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

    type.addField("ccode", "ccode");
    type.addField("idx");
    type.addField("addrtype");
    type.addField("addr");
    type.addField("ncode");
    type.addField("fax");
    StoreInfo info = new StoreInfo();

    info.setTablename("ccodeofficeaddress");
    info.setSql("select * from ccodeofficeaddress");
    info.setParent(store);
    info.setAutoinccolumn("idx");
    info.setLinkparentcolumns(new String[] {"ccode"});
    info.setKeyname(new String[] {"ccode", "idx"});

    BaseStore<JDBCModelData> officestore = new BaseStore<JDBCModelData>(type, info);
    officestore.setName("ccodeofficeaddress");
    BaseGrid officegrid = new BaseGrid(officestore, cm);
    cbs.setSelectionMode(SelectionMode.SINGLE);
    officegrid.setSelectionModel(cbs);
    // officegrid.setAutoExpandColumn("ccode");
    // panel.setLayout(new BorderLayout());
    panel.setLayout(new FitLayout());
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0));
    panel.add(officegrid);
    // officegrid.set

    registerStore(officestore);
    return panel;
  }