protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    ContentPanel inforPanel = new ContentPanel();
    //		 inforPanel.setHeading(this.getCurState().getAuction().getString(IAuction.AUCTION_NAME));
    HorizontalPanel infoContent = new HorizontalPanel();
    infoContent.setSpacing(20);
    Label sk = new Label("拍卖活动名称:");
    Label sv = new Label(this.getCurState().getAuction().getString(IAuction.AUCTION_NAME));
    Label ek = new Label("拍卖商品名称:");
    Label ev = new Label(this.getCurState().getAuction().getString(IAuction.GOOD_NAME));
    infoContent.add(sk);
    infoContent.add(sv);
    infoContent.add(ek);
    infoContent.add(ev);
    inforPanel.add(infoContent);

    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.AUCTIONLOG);
    loader.load(0, 10);
    store = new ListStore<BeanObject>(loader);
    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    final CheckBoxSelectionModel<BeanObject> smRowSelection =
        new CheckBoxSelectionModel<BeanObject>();
    columns.add(smRowSelection.getColumn());
    columns.add(new ColumnConfig(IAuctionLog.BID_USER, "买家", 150));
    columns.add(new ColumnConfig(IAuctionLog.BID_PRICE, "出价", 150));
    columns.add(new ColumnConfig(IAuctionLog.BID_TIME, "时间", 150));
    columns.add(new ColumnConfig(IAuctionLog.LOG_ID, "状态", 150));

    ColumnModel cm = new ColumnModel(columns);
    grid = new Grid<BeanObject>(store, cm);

    //        grid.setLoadMask(true);
    //        grid.setBorders(true);
    grid.setSelectionModel(smRowSelection);
    grid.addPlugin(smRowSelection);
    grid.setHeight(250);

    ContentPanel contentPanel = new ContentPanel();
    contentPanel.setFrame(true);
    contentPanel.setCollapsible(true);
    contentPanel.setAnimCollapse(false);
    contentPanel.setButtonAlign(HorizontalAlignment.CENTER);
    contentPanel.setIconStyle("icon-table");
    contentPanel.setLayout(new FitLayout());
    contentPanel.add(grid);
    contentPanel.setBottomComponent(toolBar);

    topPanel.add(inforPanel);
    topPanel.add(contentPanel);
    add(topPanel);
  }
Esempio n. 2
0
  private void search() {
    criteria.removeAll();

    String keyword = txtKeyword.getText();
    if (keyword != null && keyword.trim().length() > 0) {
      Condition cond = new Condition();
      cond.setField(IGoods.KEYWORDS);
      cond.setOperator(Condition.CONTAINS);
      cond.setValue(keyword.trim());
      criteria.addCondition(cond);
    }

    toolBar.refresh();
  }
Esempio n. 3
0
  private PagingToolBar setupRpcProxy() {
    // Rpc Proxy
    proxy =
        new RpcProxy<PagingLoadResult<AuditEventEntryWeb>>() {

          @Override
          public void load(
              final Object loadConfig,
              final AsyncCallback<PagingLoadResult<AuditEventEntryWeb>> callback) {

            if (searchCriteria == null) {
              callback.onSuccess(new BasePagingLoadResult<AuditEventEntryWeb>(null, 0, 0));
              return;
            }

            // set page offset for searchCriteria
            searchCriteria.setFirstResult(((PagingLoadConfig) loadConfig).getOffset());

            getController()
                .getAuditEventDataService()
                .getAuditEventEntriesBySearch(
                    searchCriteria,
                    new AsyncCallback<AuditEventEntryListWeb>() {
                      public void onFailure(Throwable caught) {

                        if (caught instanceof AuthenticationException) {
                          Dispatcher.get().dispatch(AppEvents.Logout);
                          return;
                        }
                        Dispatcher.forwardEvent(AppEvents.Error, caught);
                      }

                      public void onSuccess(AuditEventEntryListWeb result) {
                        // Info.display("Information", "The persons: "
                        // +((PagingLoadConfig)loadConfig).getOffset());

                        // PagingLoadConfig configuration
                        callback.onSuccess(
                            new BasePagingLoadResult<AuditEventEntryWeb>(
                                result.getAuditEventEntries(),
                                ((PagingLoadConfig) loadConfig).getOffset(),
                                result.getTotalCount()));
                      }
                    });
          }
        };

    // Page loader
    pagingLoader = new BasePagingLoader<PagingLoadResult<AuditEventEntryWeb>>(proxy);
    pagingLoader.setRemoteSort(true);
    pagingLoader.addLoadListener(
        new LoadListener() {
          // After the loader be completely filled, remove the mask
          public void loaderLoad(LoadEvent le) {
            status.hide();
            searchButton.unmask();

            grid.unmask();
          }
        });

    store = new ListStore<AuditEventEntryWeb>(pagingLoader);

    PagingToolBar pagingToolBar = new PagingToolBar(PAGE_SIZE);
    pagingToolBar.bind(pagingLoader);
    return pagingToolBar;
  }
Esempio n. 4
0
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    criteria.addCondition(new Condition(IGoods.DELETED, Condition.EQUALS, "true"));
    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.GOODS, criteria);
    loader.load(0, 10);
    final ListStore<BeanObject> store = new ListStore<BeanObject>(loader);

    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    final CheckBoxSelectionModel<BeanObject> smRowSelection =
        new CheckBoxSelectionModel<BeanObject>();
    columns.add(smRowSelection.getColumn());
    columns.add(new ColumnConfig(IGoods.ID, "ID", 50));
    ColumnConfig col = new ColumnConfig(IGoods.NAME, Resources.constants.Goods_name(), 100);
    columns.add(col);
    col = new ColumnConfig(IGoods.SN, Resources.constants.Goods_SN(), 100);
    columns.add(col);

    col = new ColumnConfig(IGoods.SHOPPRICE, Resources.constants.Goods_shopPrice(), 80);
    col.setAlignment(HorizontalAlignment.RIGHT);
    col.setNumberFormat(NumberFormat.getCurrencyFormat());
    columns.add(col);

    ColumnConfig actcol = new ColumnConfig("Action", Resources.constants.GoodsList_action(), 100);
    //		columns.add(actcol);

    ColumnModel cm = new ColumnModel(columns);

    Grid<BeanObject> grid = new EditorGrid<BeanObject>(store, cm);
    grid.setLoadMask(true);
    grid.setBorders(true);
    grid.setSelectionModel(smRowSelection);
    //      grid.setAutoExpandColumn("forum");

    ActionCellRenderer render = new ActionCellRenderer(grid);
    ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_edit.gif");
    act.setAction("editGoods($id)");
    act.setTooltip(Resources.constants.GoodsList_action_edit());
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_trash.gif");
    act.setAction("deleteGoods($id)");
    act.setTooltip(Resources.constants.GoodsList_action_delete());
    render.addAction(act);

    actcol.setRenderer(render);

    HorizontalPanel header = new HorizontalPanel();
    header.add(Resources.images.icon_search().createImage());
    header.add(new Label("  " + Resources.constants.GoodsList_keyword()));
    header.add(txtKeyword);
    header.add(btnFind);
    add(header);

    btnFind.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent ce) {
            search();
          }
        });

    ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setIconStyle("icon-table");
    //        panel.setHeading("Paging Grid");
    panel.setLayout(new FitLayout());
    panel.add(grid);
    panel.setSize(880, 350);
    panel.setBottomComponent(toolBar);

    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.addButton(
        new Button(
            "彻底删除",
            new SelectionListener<ButtonEvent>() {
              public void componentSelected(ButtonEvent ce) {
                List<BeanObject> items = smRowSelection.getSelectedItems();
                purgeGoods(items);
              }
            }));

    panel.addButton(
        new Button(
            "恢复",
            new SelectionListener<ButtonEvent>() {
              public void componentSelected(ButtonEvent ce) {
                List<BeanObject> items = smRowSelection.getSelectedItems();
                restoreGoods(items);
              }
            }));

    add(panel);
  }
Esempio n. 5
0
  /** 初始化界面。 */
  public MagazineManager() {
    curState = new State();

    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.MAILTEMPLATE, criteria);
    loader.load(0, 10);
    store = new ListStore<BeanObject>(loader);
    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    ColumnConfig title = new ColumnConfig(IMailTemplate.SUBJECT, "杂志标题", 200);
    columns.add(title);
    columns.add(new ColumnConfig(IMailTemplate.LASTMODIFY, "杂志上次编辑时间", 160));
    columns.add(new ColumnConfig(IMailTemplate.LASTSEND, "杂志上次发送时间", 160));
    ColumnConfig insert = new ColumnConfig("insert", "插入发送队列", 160);
    columns.add(insert);
    ColumnConfig actcol = new ColumnConfig("Action", "操作", 100);
    columns.add(actcol);
    ColumnModel cm = new ColumnModel(columns);

    grid = new Grid<BeanObject>(store, cm);
    grid.setLoadMask(true);
    grid.setBorders(true);

    ActionCellRenderer render = new ActionCellRenderer(grid);
    ActionCellRenderer insertRender = new ActionCellRenderer(grid);
    ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_edit.gif");
    act.setAction("editMagazine($id)");
    act.setTooltip("编辑");
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_trash.gif");
    act.setAction("deleteMagazine($id)");
    act.setTooltip("删除");
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setText("插入队列");
    act.setAction("insertMagazine($id)");
    act.setTooltip("插入队列");
    insertRender.addAction(act);

    actcol.setRenderer(render);
    insert.setRenderer(insertRender);

    ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setIconStyle("icon-table");
    panel.setLayout(new FitLayout());
    panel.add(grid);
    panel.setSize(850, 350);
    panel.setBottomComponent(toolBar);
    panel.setHeading("邮件杂志列表");
    panel.setButtonAlign(HorizontalAlignment.LEFT);

    // 添加新杂志
    final com.extjs.gxt.ui.client.widget.button.Button addMagazine =
        new com.extjs.gxt.ui.client.widget.button.Button("添加新杂志");
    addMagazine.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent ce) {
            // add new magazine function
            NewMagazine.State state = new NewMagazine.State();
            state.execute();
          }
        });
    panel.addButton(addMagazine);

    add(panel);
    initJS(this);
  }