コード例 #1
0
  private void buildToolbar(RowData data) {
    toolbar = new ToolBar();

    saveAndAddTaxa = new Button();
    saveAndAddTaxa.setText("Save and Add Taxa");
    saveAndAddTaxa.setIconStyle("icon-go-jump");
    saveAndAddTaxa.setTitle("Save and Add Taxa");
    saveAndAddTaxa.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            save(SAVEANDCONTINUE);
          }
        });

    save = new Button();
    save.setText("Save");
    save.setIconStyle("icon-save");
    save.setTitle("Save and Continue Editing");
    save.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            save(SAVE);
          }
        });

    saveAndExit = new Button();
    saveAndExit.setIconStyle("icon-save-and-exit");
    saveAndExit.setText("Save and Exit");
    saveAndExit.setTitle("Save and Exit without adding taxa");
    saveAndExit.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            save(SAVEANDEXIT);
          }
        });

    cancel = new Button();
    cancel.setIconStyle("icon-cancel");
    cancel.setText("Cancel");
    cancel.setTitle("Cancel");
    cancel.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            cancel();
          }
        });

    addItemsToToolBar();
    add(toolbar, data);
  }
コード例 #2
0
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    startDate = new DateWidget();
    endDate = new DateWidget();

    button = new Button("查询");

    datePanel.add(new Label("开始日期"));
    datePanel.add(startDate);
    Label space = new Label();
    space.setWidth(50);
    datePanel.add(space);
    datePanel.add(new Label("结束日期"));
    datePanel.add(endDate);
    space = new Label();
    space.setWidth(10);
    datePanel.add(space);
    datePanel.add(button);

    add(datePanel);

    html = new HtmlContainer();
    html.setHeight("100%");
    html.setWidth("100%");

    add(html);

    button.addListener(
        Events.Select,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent be) {
            Map<String, String> params = new HashMap<String, String>();

            if (startDate.getValue() != null
                && endDate.getValue() != null
                && startDate.getValue().after(endDate.getValue())) {
              MessageBox.alert("ERROR", "Invalid date inputted!", null);
              return;
            }

            DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd");

            params.put("STARTDATE", format.format(startDate.getValue()));
            params.put("ENDDATE", format.format(endDate.getValue()));

            new ReportService()
                .generateReport(
                    "UserRankReport",
                    params,
                    new ReportService.Listener() {
                      @Override
                      public void onSuccess(String content) {
                        content = content.substring(content.indexOf("<html>"));
                        html.setHtml(content);
                      }
                    });
          }
        });
  }
コード例 #3
0
  private static Button connectionButton() {
    final Button b = new Button("&nbsp;Connect");
    b.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.email2()));

    b.addListener(Events.OnClick, new ConnectBaseEventListener());
    return b;
  }
コード例 #4
0
ファイル: Menu.java プロジェクト: juanmav/SiuWeb
  private void adminMenu(ContentPanel accordionPanel) {
    /* Administracion */
    ContentPanel adminCP = new ContentPanel();
    adminCP.setAnimCollapse(false);
    adminCP.setHeading("Administracion");
    adminCP.setLayout(new RowLayout(Orientation.VERTICAL));

    Button area = new Button("ABM- Area");
    area.setWidth("100%");
    area.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            ABMArea a = new ABMArea();
            a.show();
          }
        });
    adminCP.add(area);
    Button tiporev = new Button("ABM- TipoRelevamiento");
    tiporev.setWidth("100%");
    adminCP.add(tiporev);

    Button tema = new Button("ABM- Tema");

    tema.setWidth("100%");
    adminCP.add(tema);

    accordionPanel.add(adminCP);
  }
コード例 #5
0
  private Button addChartButton() {
    Button addChartButton = new Button("&nbsp;Add Chart");
    addChartButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.lineChart()));
    addChartButton.setToolTip("Add another chart");

    addChartButton.addListener(Events.OnClick, new AddChartBaseEventListener());
    return addChartButton;
  }
コード例 #6
0
  public void draw() {

    if (!drawn) {
      for (String definable : DefinitionCache.impl.getDefinables())
        addDefinition(definable, DefinitionCache.impl.getDefinition(definable));

      Button save = new Button();
      save.setText("Save");
      save.setIconStyle("icon-save");
      save.setTitle("Save");
      save.addListener(
          Events.Select,
          new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent be) {
              save();
            }
          });

      Button add = new Button();
      add.setText("Add new definition");
      add.setIconStyle("icon-add");
      add.setTitle("Add new definition");
      add.addListener(
          Events.Select,
          new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent be) {
              TextField<String> f = addDefinition("", "");
              layout();

              scrollIntoView(f);
            }
          });

      ToolBar toolbar = new ToolBar();
      toolbar.add(save);
      toolbar.add(add);
      setTopComponent(toolbar);

      drawn = true;
    }
  }
コード例 #7
0
ファイル: CreateGrouptopic.java プロジェクト: hchan/nositer
  private void addDefaultListeners() {
    saveButton.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            Grouptopic grouptopic = new Grouptopic();
            grouptopic.setUserid(Nositer.getInstance().getUser().getId());
            grouptopic.setGroupid(groupDiscussionsContainer.getGroupPlusView().getId());
            grouptopic.setName(name.getValue());

            Groupmessage groupmessage = new Groupmessage();
            groupmessage.setUserid(Nositer.getInstance().getUser().getId());
            groupmessage.setGrouptopicid(groupDiscussionsContainer.getGroupPlusView().getId());
            groupmessage.setDescription(description.getValue());

            grouptopic.getGroupmessages().add(groupmessage);
            AsyncCallback<Grouptopic> callback =
                new AsyncCallback<Grouptopic>() {
                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox.show("Error", caught.getMessage(), null);
                    GWTUtil.log("", caught);
                  }

                  @Override
                  public void onSuccess(final Grouptopic result) {
                    InfoMessageBox.show(
                        "Saved",
                        new Listener<MessageBoxEvent>() {
                          @Override
                          public void handleEvent(MessageBoxEvent be) {
                            groupDiscussionsContainer
                                .getGroupDiscussionLeftPanel()
                                .getGroupmessagesGrid()
                                .refresh();
                            Groupmessage groupmessage =
                                result.getGroupmessages().toArray(new Groupmessage[] {})[0];
                            groupmessage.setGrouptopic(result);
                            GroupmessagePanel groupmessagePanel =
                                new GroupmessagePanel(groupDiscussionsContainer, groupmessage);
                            groupmessagePanel.show();
                          }
                        });
                  }
                };
            ServiceBroker.groupService.createGrouptopic(
                groupDiscussionsContainer.getGroupPlusView(), grouptopic, callback);
          }
        });
  }
コード例 #8
0
ファイル: GcodeView.java プロジェクト: dalinhuang/gwtbusi
  public void init() {
    toolBar = new PagingToolBar(5, true);
    getStore();
    // initwidget();
    store.addBaseStoreListener(BaseStoreEvent.EventType.LOAD_COMPLETE, this);

    printer = new Button("打印");
    // printer.setStyleName("printer");
    // printer.setIconStyle("printer");
    // printer.setId("printer");
    printer.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.print_16()));

    printer.addListener(Events.Select, this);
  }
コード例 #9
0
  private Button getExportButton() {
    Button exportButton = new Button(I18nUtils.getMessages().config_button_export());
    exportButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.page_save()));
    exportButton.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          @Override
          public void handleEvent(BaseEvent be) {
            String url = GWT.getModuleBaseURL() + "exportconfig";
            Window.open(url, "_self", "");
          }
        });
    return exportButton;
  }
コード例 #10
0
  private Button getSubmitButton() {
    if (submitButton == null) {
      submitButton = new Button("Submit");
      submitButton.addListener(
          Events.Select,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              submitJob();
            }
          });
    }
    return submitButton;
  }
コード例 #11
0
  private Button getAddFileButton() {

    if (addFileButton == null) {
      addFileButton = new Button("Add");
      addFileButton.addListener(
          Events.Select,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              fileSelectorWindow.show();
            }
          });
    }
    return addFileButton;
  }
コード例 #12
0
  private Button getDownloadLogButton() {
    Button downloadButton = new Button(I18nUtils.getMessages().config_button_downloadLog());
    downloadButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.download()));
    downloadButton.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          @Override
          public void handleEvent(BaseEvent be) {
            String url = GWT.getModuleBaseURL() + "downloadlog";
            Window.open(url, "_self", "");
          }
        });

    return downloadButton;
  }
コード例 #13
0
  private Button getRemoveFileButton() {

    if (removeFileButton == null) {
      removeFileButton = new Button("Remove");
      removeFileButton.addListener(
          Events.Select,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              for (GrisuFileObject file : getListView().getSelection()) {
                inputFileStore.remove(file);
              }
            }
          });
    }
    return removeFileButton;
  }
コード例 #14
0
  @Override
  public ToolBar initToolBar() {
    SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus());

    final Button importUser = new Button();

    importUser.setText(I18nUtils.getMessages().user_button_importUsers());
    importUser.setTitle(I18nUtils.getMessages().user_button_importUsers_tip());
    importUser.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.user()));
    importUser.enable();
    importUser.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            initUserImportView();
          }
        });
    toolbar.add(importUser);

    return toolbar;
  }
コード例 #15
0
ファイル: Menu.java プロジェクト: juanmav/SiuWeb
  private void tablero(ContentPanel accordionPanel) {
    /* Reportes */
    ContentPanel tablero = new ContentPanel();
    tablero.setAnimCollapse(false);
    tablero.setHeading("Tablero Partido");
    tablero.setLayout(new RowLayout(Orientation.VERTICAL));
    Button tableroControl = new Button("Tablero Control");

    tableroControl.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            TableroView tableroView = new TableroView();
            tableroView.show();
          }
        });

    tableroControl.setWidth(135);
    tablero.add(tableroControl);

    accordionPanel.add(tablero);
  }
コード例 #16
0
ファイル: Menu.java プロジェクト: juanmav/SiuWeb
  private void populateMenu(ContentPanel accordionPanel) {
    /* Reportes */
    ContentPanel populatorsContainer = new ContentPanel();
    populatorsContainer.setAnimCollapse(false);
    populatorsContainer.setHeading("Creacion de Datos Aut.");
    populatorsContainer.setLayout(new RowLayout(Orientation.VERTICAL));
    Button areaBTN = new Button("Crear Areas");
    areaBTN.setWidth("100%");
    areaBTN.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            final AreaServiceAsync areaServiceAsync = GWT.create(AreaService.class);
            areaServiceAsync.populateINIT(
                new AsyncCallback<Void>() {

                  @Override
                  public void onSuccess(Void result) {
                    Info.display("Areas Creadas", "eso");
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Info.display("FALLO Creacion areas!", "eso");
                  }
                });
          }
        });

    Button tipoRelevBTN = new Button("Crear Tipos");
    tipoRelevBTN.setWidth("100%");
    tipoRelevBTN.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            final TipoRelevamientoServiceAsync tipoRelevamientoServiceAsync =
                GWT.create(TipoRelevamientoService.class);
            tipoRelevamientoServiceAsync.populateINIT(
                new AsyncCallback<Void>() {

                  @Override
                  public void onSuccess(Void result) {
                    Info.display("Tipos Relevamiendos Creadas", "eso");
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Info.display("FALLO Creacion Tipos Relevamientos!", "eso");
                  }
                });
          }
        });

    Button temasvBTN = new Button("Crear Temas");
    temasvBTN.setWidth("100%");
    temasvBTN.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            final TemaServiceAsync tipoRelevamientoServiceAsync = GWT.create(TemaService.class);
            tipoRelevamientoServiceAsync.populateINIT(
                new AsyncCallback<Void>() {

                  @Override
                  public void onSuccess(Void result) {
                    Info.display("Temas Creadas", "eso");
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Info.display("FALLO Creacion Temas!", "eso");
                  }
                });
          }
        });

    Button inspeccionesBTN = new Button("Crear Inspecciones de Ejemplo");
    inspeccionesBTN.setWidth("100%");
    inspeccionesBTN.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            final InspeccionServiceAsync tipoRelevamientoServiceAsync =
                GWT.create(InspeccionService.class);
            tipoRelevamientoServiceAsync.examplesCreate(
                new AsyncCallback<Void>() {

                  @Override
                  public void onSuccess(Void result) {
                    Info.display("Ejemplos Creados", "eso");
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Info.display("FALLO Ejemplos Creados", "eso");
                  }
                });
          }
        });

    populatorsContainer.add(areaBTN);
    populatorsContainer.add(tipoRelevBTN);
    populatorsContainer.add(temasvBTN);
    populatorsContainer.add(inspeccionesBTN);

    accordionPanel.add(populatorsContainer);
  }
コード例 #17
0
  private void createGrid(boolean widget) {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

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

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

    column = new ColumnConfig();
    column.setId("last");
    column.setHeader("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", 125);
    if (widget) {
      Button btn = new Button("Updated");
      btn.addListener(
          Events.OnClick,
          new Listener<ButtonEvent>() {
            public void handleEvent(ButtonEvent be) {
              // stop column from getting click and causing sort
              be.cancelBubble();
            }
          });
      btn.setStyleAttribute("float", "left");
      column.setWidget(btn, "Last Updated");
    } else {
      column.setAlignment(HorizontalAlignment.RIGHT);
      column.setHeader("Last Updated");
    }

    column.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy"));
    configs.add(column);

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

    ColumnModel cm = new ColumnModel(configs);

    cm.addHeaderGroup(0, 0, new HeaderGroupConfig("Header Grouping Example", 1, 5));
    cm.addHeaderGroup(1, 2, new HeaderGroupConfig("Stock Performance", 1, 2));

    if (widget) {
      Slider s = new Slider();
      s.setWidth(100);

      // ugly, but centers slider
      FlexTable tbl = new FlexTable();
      tbl.setWidth("100%");
      tbl.setHTML(0, 0, "&nbsp;");
      tbl.setHTML(
          0, 1, "<span style='white-space: nowrap;font-size: 11px'>Slide Me: &nbsp;</span>");
      tbl.setWidget(0, 2, s);
      tbl.setHTML(0, 3, "&nbsp;");
      tbl.getCellFormatter().setWidth(0, 0, "50%");
      tbl.getCellFormatter().setWidth(0, 3, "50%");
      cm.addHeaderGroup(1, 0, new HeaderGroupConfig(tbl, 1, 2));
    } else {
      cm.addHeaderGroup(1, 0, new HeaderGroupConfig("Stock Information", 1, 2));
    }

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(false);
    cp.setIcon(Resources.ICONS.table());
    cp.setHeading(widget ? "Column Grouping with Widget" : "Column Grouping");
    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.getView().setForceFit(true);
    grid.setBorders(true);
    cp.add(grid);

    vp.add(cp);
  }
コード例 #18
0
ファイル: BcodeLeave.java プロジェクト: dalinhuang/gwtbusi
  LayoutContainer initProButtons() {

    TableLayout tl = new TableLayout(2);
    lc.setLayout(tl);

    TableData td1 = new TableData();
    td1.setColspan(1);
    TableData td2 = new TableData();
    td2.setColspan(2);

    bsd_add =
        new BcodeSelectDialog<TreeNodeModelData>() {
          public void doposted(List<TreeNodeModelData> modeldatalist) {
            if (modeldatalist.size() > 0) {
              this.setEmptyText("已经选择了数据");

              List<TreeNodeModelData> selectchecklist = bsd_add.getTree().getCheckedSelection();

              if (selectchecklist.size() <= 0) {
                MessageBox.alert("错误", "请选择“离职人员”", null);
                return;
              }
              String bcodestr = "";
              for (TreeNodeModelData tnmd : selectchecklist) {
                BusiObject bo = new BusiObject();

                bcodestr += " systembcode like '" + tnmd.get("systembcode") + "%25' or ";
              }
              bcodestr += " 1=2";
              GWT.log("bcodestr =" + bcodestr);

              String sql =
                  "select icode, bcode,employstatus,leavereason,leavemark,Resignationdate from bcode_job where exists (select * from systembcode_view where systembcode_view.bcode = bcode_job.bcode  and ( "
                      + bcodestr
                      + "))";
              GWT.log("sql =" + sql);
              store.getStoreinfo().setSql(sql);
              store.reload();
            }
          }
        };
    bsd_add.setNeesreselect(false);
    bsd_add.setEmptyText("未选择数据");
    bsd_add.setExpanded();
    bsd_add.setCheckNodes(CheckNodes.BOTH);

    Resignationdate = new DateField();
    Resignationdate.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));

    save.addListener(Events.OnClick, getListener());
    lc.add(new LabelField("选择人员:"), td1);
    lc.add(bsd_add, td1);

    lc.add(new LabelField("状态改变为:"), td1);
    lc.add(C_num8, td1);

    lc.add(leavereason_l, td1);
    lc.add(C_num9, td1);

    lc.add(resignationdate_l, td1);
    lc.add(Resignationdate, td1);

    lc.add(mark_l, td1);
    lc.add(mark_t, td1);

    leavereason_l.setVisible(false);
    C_num9.setVisible(false);
    mark_l.setVisible(false);
    mark_t.setVisible(false);
    resignationdate_l.setVisible(false);
    Resignationdate.setVisible(false);

    lc.add(save, td2);

    bsd_add.addListener(Events.Changed, getListener());
    C_num8.addListener(Events.Changed, getListener());
    C_num9.addListener(Events.Changed, getListener());
    mark_t.addListener(Events.Changed, getListener());
    Resignationdate.addListener(Events.Changed, getListener());
    return lc;
  }
コード例 #19
0
ファイル: NewCCode.java プロジェクト: dalinhuang/gwtbusi
  /** * 主窗口 */
  void initmainpanel() {

    w = new BaseFormPanel(getStore());
    w.setHeaderVisible(false);
    Label cardno_l = new Label("卡号:");
    cardno_l.setWidth("50");
    Label cname_l = new Label("名字:");
    cname_l.setWidth("50");
    Label sex_l = new Label("性别:");
    sex_l.setWidth("50");
    Label edu_l = new Label("学历:");
    Label bird_l = new Label("出生日期:");

    Label mobil_l = new Label("手机号:");
    Label idno_l = new Label("身份证号:");
    Label mark_l = new Label("备注:");

    cardno_t = new TextField<String>();
    cardno_t.setAllowBlank(false);
    cardno_t.addListener(Events.Change, this);
    cname_t = new TextField<String>();
    cname_t.setAllowBlank(false);

    //		passwordc_t.setAllowBlank(false);
    //		password_t.setAllowBlank(false);
    //
    // TextField<String> sex_t = new TextField<String>();
    // BaseGridEditor sex_t= CodeNameMapFactory.aa();
    BaseComboBoxForm<BaseModelData> sex_t = CodeNameMapFactory.createSexInput_F();
    TextField<String> edu_t = new TextField<String>();
    // CodeNameMapFactory codenamemap = new CodeNameMapFactory();

    // BaseGridEditor<String> edu_t =codenamemap.createSexInput_G();

    // createBocdeInput_F
    DateField bird_t = new DateField();
    bird_t.setAutoWidth(true);

    bird_t.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-M-d H:mm:ss"));
    TextField<String> mobil_t = new TextField<String>();
    mobil_t.setAllowBlank(false);
    TextField<String> idno_t = new TextField<String>();

    TextArea mark_t = new TextArea();
    mark_t.setSize(420, 40);
    // TextField<String> password_t = new TextField<String>();

    password_t.setPassword(true);
    passwordc_t.setPassword(true);
    // password_t.setToolTip("将光标放到此处,并由会员录入自己的密码");
    ccode_t = new TextField<String>();
    // ccode_t.setEnabled(false);
    ccode_t.setVisible(false);
    icode_t = new TextField<String>();
    icode_t.setVisible(false);

    cardno_t.setName("s_cardno");
    cname_t.setName("cname");
    password_t.setName("password");

    sex_t.setName("s_sex");
    edu_t.setName("s_edu");
    bird_t.setName("s_birid");
    mobil_t.setName("s_mobil");
    idno_t.setName("s_idno");
    mark_t.setName("s_mark");
    ccode_t.setName("ccode");
    icode_t.setName("icode");
    // password_t.setName("password");

    TableLayout tl = new TableLayout(4);
    tl.setWidth("600");
    w.setLayout(tl);
    TableData td = new TableData();
    td.setColspan(1);
    // td.setWidth("2000");
    td.setMargin(100);
    td.setPadding(5);
    td.setRowspan(1);

    TableData td2 = new TableData();
    td2.setColspan(3);
    // td.setWidth("2000");
    td2.setMargin(100);
    td2.setPadding(5);
    td2.setRowspan(1);

    w.add(cardno_l, td);
    w.add(cardno_t, td);
    w.add(cname_l, td);
    w.add(cname_t, td);

    w.add(mobil_l, td);
    w.add(mobil_t, td);
    w.add(sex_l, td);
    w.add(sex_t, td);

    w.add(new Label("密码:"), td);
    w.add(password_t, td);
    w.add(new Label("重新录入密码:"), td);
    w.add(passwordc_t, td);

    w.add(edu_l, td);
    w.add(edu_t, td);
    w.add(bird_l, td);
    w.add(bird_t, td);

    w.add(idno_l, td);
    w.add(idno_t, td);
    w.add(new Label(""), td);
    w.add(new Label(""), td);
    w.add(mark_l, td);
    w.add(mark_t, td2);

    w.add(new Label("销售人员:"), td);
    BaseComboBoxForm<BaseModelData> cbf = createBcode_filter();
    cbf.setName("rbcode");
    cbf.setAllowBlank(false);
    w.add(cbf, td2);

    w.add(ccode_t, td);
    w.add(icode_t, td);
    w.setBottomComponent(addfinace);

    addfinace.addListener(Events.Select, this);
    addfinace.setEnabled(false);
    w.inited();

    // w.setAutoHeight(true);
    // w.setAutoWidth(true);
    // w.setSize(661, 300);

    cardno_t.addListener(Events.Change, this);
    cname_t.addListener(Events.Change, this);

    // mobil_t.addListener(Events.Change, this);

    cardno_t.setValidateOnBlur(true);
    cname_t.setValidateOnBlur(true);
  }
コード例 #20
0
 public final void addButtonListener(String buttonId, Listener<BaseEvent> listener) {
   if (buttonId.equals(BUTTON_OK)) okButton.addListener(Events.Select, listener);
   else if (buttonId.equals(BUTTON_CANCEL)) cancelButton.addListener(Events.Select, listener);
 }
コード例 #21
0
  private TabItem createLoginTab() {
    TabItem tabItem = new TabItem("Login");

    FormPanel form = new FormPanel();
    form.setHeading("Login using existing user.");
    form.setWidth(350);
    form.setLayout(new FlowLayout());

    FieldSet fieldSet = new FieldSet();

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

    final TextField<String> fieldName = new TextField<String>();
    fieldName.setFieldLabel("Name");
    fieldSet.add(fieldName);

    final TextField<String> fieldPassword = new TextField<String>();
    fieldPassword.setPassword(true);
    fieldPassword.setFieldLabel("Password");
    fieldSet.add(fieldPassword);

    form.add(fieldSet);
    form.setButtonAlign(HorizontalAlignment.CENTER);
    Button loginButton = new Button("Login");
    form.addButton(loginButton);

    loginButton.addListener(
        Events.Select,
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            final String name = fieldName.getValue();
            String pass = fieldPassword.getValue();

            if (name == null || pass == null) {
              Info.display("Loggin in Error!", "Name or password is empty!");
              return;
            }

            // Sprawdza usera
            userService.login(
                name,
                pass,
                new AsyncCallback<UserLoginRegisterResponse>() {
                  public void onSuccess(UserLoginRegisterResponse result) {
                    if (!result.isSuccess()) {
                      Info.display("Couldn't log in", result.getMessage());
                    } else {
                      User user = result.getUser();
                      Info.display(
                          "Logged in",
                          "Logged in successfuly as "
                              + user.getName()
                              + " level: "
                              + user.getUserType());
                      hide();
                      tabs.init(user);
                    }
                  }

                  public void onFailure(Throwable caught) {
                    Info.display("Error while loggin in.", caught.getMessage());
                  };
                });
          }
        });
    tabItem.add(form);
    return tabItem;
  }
コード例 #22
0
  /*
   * (non-Javadoc)
   *
   * @see
   * it.geosolutions.geofence.gui.client.widget.GEOFENCEGridWidget#createStore
   * ()
   */
  @Override
  public void createStore() {
    this.toolBar =
        new PagingToolBar(it.geosolutions.geofence.gui.client.Constants.DEFAULT_PAGESIZE);

    // Loader for rulesService
    this.proxy =
        new RpcProxy<PagingLoadResult<Rule>>() {

          @Override
          protected void load(Object loadConfig, AsyncCallback<PagingLoadResult<Rule>> callback) {
            rulesService.getRules(
                ((PagingLoadConfig) loadConfig).getOffset(),
                ((PagingLoadConfig) loadConfig).getLimit(),
                false,
                callback);
          }
        };
    loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
    loader.setRemoteSort(false);
    loader.setSortField(BeanKeyValue.PRIORITY.getValue());
    loader.setSortDir(SortDir.ASC);
    store = new ListStore<Rule>(loader);

    if (store != null) {
      store.setSortField(BeanKeyValue.PRIORITY.getValue());
      store.setSortDir(SortDir.ASC);
    }

    // Search tool
    SearchFilterField<Rule> filter =
        new SearchFilterField<Rule>() {

          @Override
          protected boolean doSelect(
              Store<Rule> store, Rule parent, Rule record, String property, String filter) {

            String field = ((GSUser) parent.get(BeanKeyValue.USER.getValue())).getName();
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = ((UserGroup) parent.get(BeanKeyValue.PROFILE.getValue())).getName();
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = ((GSInstance) parent.get(BeanKeyValue.INSTANCE.getValue())).getName();
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = parent.get(BeanKeyValue.SERVICE.getValue());
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = parent.get(BeanKeyValue.REQUEST.getValue());
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = parent.get(BeanKeyValue.WORKSPACE.getValue());
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = parent.get(BeanKeyValue.LAYER.getValue());
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            field = parent.get(BeanKeyValue.GRANT.getValue());
            field = field.toLowerCase();
            if (field.indexOf(filter.toLowerCase()) != -1) {
              return true;
            }

            return false;
          }
        };

    filter.setWidth(130);
    filter.setIcon(Resources.ICONS.search());

    // Bind the filter field to your grid store (grid.getStore())
    filter.bind(store);

    // Apply Changes button
    // TODO: generalize this!
    Button addRuleButton = new Button("Add Rule");
    addRuleButton.setIcon(Resources.ICONS.add());

    addRuleButton.addListener(
        Events.OnClick,
        new Listener<ButtonEvent>() {

          public void handleEvent(ButtonEvent be) {
            Dispatcher.forwardEvent(
                GeofenceEvents.SEND_INFO_MESSAGE, new String[] {"GeoServer Rules", "Add Rule"});

            Rule new_rule = new Rule();
            new_rule.setId(-1);
            new_rule.setPriority(-1);
            new_rule = Constants.getInstance().createNewRule(new_rule);
            Dispatcher.forwardEvent(GeofenceEvents.EDIT_RULE, new GridStatus(grid, new_rule));
          }
        });

    this.toolBar.bind(loader);
    this.toolBar.add(new SeparatorToolItem());
    this.toolBar.add(addRuleButton);
    this.toolBar.add(new SeparatorToolItem());
    this.toolBar.add(filter);
    this.toolBar.add(new SeparatorToolItem());
    setUpLoadListener();
  }
コード例 #23
0
  public void initUserImportView() {
    final Window window = new Window();
    window.setBodyBorder(false);
    FormPanel reportPanel = new FormPanel();
    Label dLabel = new Label(I18nUtils.getMessages().user_userImportReports());

    reportPanel.add(dLabel);
    reportPanel.setHeight(120);
    reportPanel.setBodyBorder(false);
    reportPanel.setHeaderVisible(false);
    reportPanel.setHideLabels(true);
    Button close = new Button(I18nUtils.getMessages().user_userImportReports_close());
    close.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            window.hide();
          }
        });

    window.setTitle(I18nUtils.getMessages().user_userImportReports_window());
    window.setWidth(560);
    window.setHeading(I18nUtils.getMessages().user_importUsersPanel_title());
    window.setClosable(true);
    MyFileUpload importUserTool =
        new MyFileUpload("importusers") {

          @SuppressWarnings("unchecked")
          @Override
          public void fireActionComplete(String responseText) {
            JSONObject json = (JSONObject) JSONParser.parseLenient(responseText);
            JSONValue number = json.get("reportId");
            JSONNumber sJsonNumber = number.isNumber();

            UserService.Util.getInstance()
                .importUsers(
                    (int) sJsonNumber.doubleValue(),
                    new AsyncCallback() {

                      public void onFailure(Throwable caught) {
                        MessageBox.alert(
                            I18nUtils.getMessages().user_importUsersPanel_title(),
                            caught.getMessage(),
                            null);
                        GWT.log("importing users failed");
                      }

                      public void onSuccess(final Object result) {
                        ImportUserReport[] reports = (ImportUserReport[]) result;
                        String msg = "";
                        for (ImportUserReport r : reports) {
                          msg += r + "<br/>";
                        }
                        Dialog report = new Dialog();
                        report.setHeight(300);
                        report.setWidth(480);
                        report.addText(msg);
                        report.setHideOnButtonClick(true);
                        report.show();

                        load();
                      }
                    });
          }

          @Override
          public void actionEnd() {
            GWT.log("importing users  end up");
          }
        };

    reportPanel.add(importUserTool);
    reportPanel.addButton(close);
    reportPanel.setButtonAlign(HorizontalAlignment.RIGHT);
    window.add(reportPanel);

    window.show();
  }
コード例 #24
0
  private TabItem createRegisterTab() {
    TabItem tabItem = new TabItem("Register");

    FormPanel form = new FormPanel();
    form.setFrame(false);
    form.setHeading("Create a new account.");
    form.setWidth(350);
    form.setLayout(new FlowLayout());

    FieldSet fieldSet = new FieldSet();

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

    final TextField<String> nameField = new TextField<String>();
    nameField.setFieldLabel("Name");
    fieldSet.add(nameField);

    final TextField<String> passField = new TextField<String>();
    passField.setPassword(true);
    passField.setFieldLabel("Password");
    fieldSet.add(passField);

    final TextField<String> emailField = new TextField<String>();
    emailField.setFieldLabel("Email");
    fieldSet.add(emailField);

    form.add(fieldSet);
    form.setButtonAlign(HorizontalAlignment.CENTER);
    Button registerButton = new Button("Register");
    form.addButton(registerButton);

    registerButton.addListener(
        Events.Select,
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            String name = nameField.getValue();
            String pass = passField.getValue();
            String email = emailField.getValue();

            if (name == null || pass == null || email == null) {
              Info.display(
                  "Incorrect register data", "Name, password and email must not be empty!");
              return;
            }

            userService.register(
                name,
                pass,
                email,
                new AsyncCallback<UserLoginRegisterResponse>() {
                  // @Override
                  public void onFailure(Throwable caught) {
                    Info.display("Error while registering account!", caught.getMessage());
                  }
                  // @Override
                  public void onSuccess(UserLoginRegisterResponse result) {
                    if (!result.isSuccess()) {
                      Info.display("The account not registered!", result.getMessage());
                    } else {
                      User user = result.getUser();
                      Info.display(
                          "Registered :)",
                          "Registered successfuly. You've been automaticly logged in as "
                              + user.getName()
                              + " level: "
                              + user.getUserType());
                      hide();
                      tabs.init(user);
                    }
                  }
                });
          }
        });

    tabItem.add(form);
    return tabItem;
  }
コード例 #25
0
  @Override
  public ToolBar initToolBar() {
    SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus(), getSubModule().hasEditRight());
    final Button bmToolbarButton =
        new Button(
            I18nUtils.getMessages().project_button_BranchManagment(),
            AbstractImagePrototype.create(Icons.INSTANCE.branches()));
    AdaptId.adapt(bmToolbarButton, IdElementsAdmResource.INSTANCE.idBranchManagementButton());
    bmToolbarButton.disable();
    bmToolbarButton.setTitle(I18nUtils.getMessages().project_button_BranchManagment());
    bmToolbarButton.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            ModelData selected = getSelectedItem();
            if (selected != null && bmToolbarButton.isEnabled()) {
              Object obj = selected.get(ProjectBeanDesc.id.getName());
              int projectId = 0;
              if (obj != null) {
                projectId = (Integer) obj;
              }
              String name = selected.get(ProjectBeanDesc.label.getName());
              String warning = selected.get(ProjectBeanDesc.warning.getName());
              if (warning == null) {
                Window window = new BranchManagmentWindow(projectId, name);
                window.show();
              } else {
                String messageTitle = "<font size='3'>" + "Can't manage branches:" + "<font/><br>";
                String messageDetail =
                    "<I><font size='2' style='color:red'>" + warning + "<font/><I/>";
                String message = messageTitle + messageDetail;
                MessageBox.alert("Warning", message, null);
              }
            }
          }
        });

    if (!getSubModule().hasEditRight()) {
      GXTUtils.hideComponents(bmToolbarButton);
    }

    getEventBus()
        .addHandler(
            SubModuleEvent.getType(),
            new SubModuleHandler() {

              public void onEvent(SubModuleEvent event) {
                if (event.getEventType() == EventType.OnGridSelect
                    && getSubModule().hasEditRight()) {
                  bmToolbarButton.enable();
                } else if (event.getEventType() == EventType.OnGridUnselect
                    || event.getEventType() == EventType.OnClickCancel) {
                  bmToolbarButton.disable();
                }
              }
            });

    toolbar.add(bmToolbarButton);
    return toolbar;
  }