예제 #1
0
  private void createDatePickerDialog() {
    dpDialog = new Dialog();
    dpDialog.setHeading(HarvesterUI.CONSTANTS.datePicker());
    dpDialog.setIcon(HarvesterUI.ICONS.calendar());
    dpDialog.setButtons("");
    dpDialog.setResizable(false);
    dpDialog.setWidth(400);
    dpDialog.setHeight(250);
    dpDialog.setLayout(new FitLayout());
    dpDialog.setBodyStyleName("pad-text");
    dpDialog.setHideOnButtonClick(true);

    DatePicker datePicker = new DatePicker();
    datePicker.setValue(new Date());
    datePicker.addListener(
        Events.Select,
        new Listener<DatePickerEvent>() {
          public void handleEvent(DatePickerEvent be) {
            calendar.setDate(be.getDate());
            DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            String result = formatter.format(calendar.getDate());
            currentMonthAndYear.setText(result);
            calendarTaskManager.updateScheduleTasks();
          }
        });

    dpDialog.add(datePicker);
  }
예제 #2
0
  @SuppressWarnings("unchecked")
  @Override
  protected void handleEvent(AppEvent event) {
    if (event.getType() == AppEvents.AuditEventEntryView) {

      searchCriteria = null;
      currentEntity = Registry.get(Constants.ENTITY_ATTRIBUTE_MODEL);

      initUI();

      if (Registry.get(Constants.AUDIT_EVENT_TYPE_CODES) != null) {
        List<AuditEventTypeWeb> auditEventTypes =
            (List<AuditEventTypeWeb>) Registry.get(Constants.AUDIT_EVENT_TYPE_CODES);
        /*
         * for (AuditEventTypeWeb type : auditEventTypes) { Info.display("Information", "Event Types: "+
         * type.getAuditEventTypeCd() + ", " + type.getAuditEventTypeName()); }
         */
        eventTypesStore.removeAll();
        eventTypesStore.add(auditEventTypes);
      }

    } else if (event.getType() == AppEvents.Logout) {

      Dispatcher.get().dispatch(AppEvents.Logout);

    } else if (event.getType() == AppEvents.AuditEventReceived) {

      // Info.display("Information", "EventReceived");
      store.removeAll();

      AuditEventEntryListWeb events = (AuditEventEntryListWeb) event.getData();
      if (events.getAuditEventEntries() != null) {
        store.add(events.getAuditEventEntries());
      }

      grid.getSelectionModel().select(0, true);
      grid.getSelectionModel().deselect(0);

      status.hide();
      searchButton.unmask();

    } else if (event.getType() == AppEvents.EntityByIdRequest) {

      RecordWeb record = (RecordWeb) event.getData();

      if (record != null) {
        identifierStore.removeAll();

        buildRefRecordInfoDialog();
        refRecordInfoDialog.show();

        displayEntityRecord(attributeFieldMap, record);
        displayEntityIdentifier(record);
      }

    } else if (event.getType() == AppEvents.Error) {
      String message = event.getData();
      MessageBox.alert("Information", "Failure: " + message, null);
    }
  }
예제 #3
0
 @Override
 protected void onHide() {
   super.onHide();
   //        OverviewGrid overviewGrid = (OverviewGrid) Registry.get("asynctree");
   //        if(overviewGrid.isVisible())
   //            History.newItem("HOME", false);
 }
예제 #4
0
  public void close() {

    w = null;

    ccode_t = null;
    cardno_t = null;
    icode_t = null;
    cname_t = null;
    d.hide();
  }
  /* (non-Javadoc)
   * @see com.extjs.gxt.ui.client.widget.Window#show()
   */
  @Override
  public void show() {
    super.show();

    if (getModel() != null) {
      setHeading("Editing Profile Details for Profile #" + profile.getId());
      this.tabWidget.add(
          new ProfileDetailsTabItem(
              PROFILE_DETAILS_DIALOG_ID, profile, ProfilesManagerRemoteServiceAsync));
    }
  }
  /* (non-Javadoc)
   * @see com.extjs.gxt.ui.client.widget.Dialog#createButtons()
   */
  @Override
  protected void createButtons() {
    super.createButtons();

    this.saveStatus = new SaveStaus();
    this.saveStatus.setAutoWidth(true);

    getButtonBar().add(saveStatus);

    getButtonBar().add(new FillToolItem());
  }
예제 #7
0
 /** Override this method is to select the first existent gesture, and show its configuration. */
 @Override
 protected void afterRender() {
   super.afterRender();
   if (existsGestureTypeModels.size() > 0) {
     BeanModel firstCheckedModel = existsGestureTypeModels.get(0);
     gestureTypeListView.getSelectionModel().select(firstCheckedModel, false);
     ListViewEvent<BeanModel> listViewEvent = new ListViewEvent<BeanModel>(gestureTypeListView);
     listViewEvent.setModel(firstCheckedModel);
     gestureTypeListView.fireEvent(Events.Select, listViewEvent);
   }
 }
예제 #8
0
  // RefRecordInfoDialog
  private void buildRefRecordInfoDialog() {

    if (refRecordInfoDialog != null) {
      return;
    }
    refRecordInfoDialog = new Dialog();
    refRecordInfoDialog.setBodyBorder(false);
    refRecordInfoDialog.setWidth(940);
    refRecordInfoDialog.setHeight(540);
    refRecordInfoDialog.setIcon(IconHelper.create("images/information.png"));
    refRecordInfoDialog.setHeading("Reference Record Information");
    refRecordInfoDialog.setButtons(Dialog.OK);
    refRecordInfoDialog.setModal(true);
    refRecordInfoDialog
        .getButtonById(Dialog.OK)
        .addSelectionListener(
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {

                // refPersonInfoDialog.hide();
                refRecordInfoDialog.close();
              }
            });

    ContentPanel cp = new ContentPanel();
    cp.setFrame(false);
    cp.setLayout(new BorderLayout());
    cp.setSize(930, 500);

    formButtonContainer = new LayoutContainer();
    formButtonContainer.setScrollMode(Scroll.AUTOY);

    TableLayout identlayout = new TableLayout(2);
    identlayout.setWidth("100%");
    identlayout.setCellSpacing(5);
    identlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    FormLayout toplayout = new FormLayout();

    TableLayout formlayout = new TableLayout(2);
    formlayout.setWidth("930"); // "100%"
    formlayout.setCellSpacing(5);
    formlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    identifierContainer = new LayoutContainer();
    ;
    identifierContainer.setLayout(identlayout);
    FormPanel identifierPanel = setupForm("", 150, 854);
    identifierPanel.add(setupIdentifierfieldSet(865, 1));
    identifierContainer.add(identifierPanel);

    topContainer = new LayoutContainer();
    ;
    topContainer.setLayout(toplayout);
    topFormPanel = setupForm("", 150, 400);
    topFormPanel.setStyleAttribute("padding-left", "15px");

    formContainer = new LayoutContainer();
    formContainer.setLayout(formlayout);
    leftFormPanel = setupForm("", 150, 400);
    rightFormPanel = setupForm("", 150, 400);

    if (currentEntity != null) {

      if (currentEntity.getAttributes() != null) {

        // Groups
        List<EntityAttributeGroupWeb> sortedAttributeGroups = null;
        if (currentEntity.getEntityAttributeGroups() != null) {
          sortedAttributeGroups =
              new ArrayList<EntityAttributeGroupWeb>(
                  currentEntity.getEntityAttributeGroups().size());
          for (EntityAttributeGroupWeb entityGroup : currentEntity.getEntityAttributeGroups()) {
            // Info.display("Entity Group:", entityGroup.getName()+ ";
            // "+entityGroup.getDisplayOrder());
            sortedAttributeGroups.add(entityGroup);
          }
          Collections.sort(sortedAttributeGroups, GROUP_DISPLAY_ORDER);
        }

        // Attributes
        List<EntityAttributeWeb> sortedEntityAttributes =
            new ArrayList<EntityAttributeWeb>(currentEntity.getAttributes().size());
        if (currentEntity.getAttributes() != null) {
          for (EntityAttributeWeb entityAttribute : currentEntity.getAttributes()) {
            sortedEntityAttributes.add(entityAttribute);
          }
          // sort by display order
          Collections.sort(sortedEntityAttributes, ATTRIBUTE_DISPLAY_ORDER);
        }

        attributeFieldMap = new HashMap<String, Field<?>>();

        // Attributes with no group
        for (EntityAttributeWeb entityAttribute : sortedEntityAttributes) {
          // Info.display("Attribute:", entityAttribute.getName()
          // +"; "+entityAttribute.getDatatype().getDataTypeCd());

          if (entityAttribute.getEntityAttributeGroup() == null) {
            Field<?> field = createField(entityAttribute, true, false);
            if (field != null) {
              attributeFieldMap.put(entityAttribute.getName(), field);
              topFormPanel.add(field);
            }
          }
        }

        // Attributes with group
        if (sortedAttributeGroups != null) {
          boolean leftForm = true;
          for (EntityAttributeGroupWeb attributeGroup : sortedAttributeGroups) {

            FieldSet groupfieldSet =
                createGroupFields(attributeFieldMap, attributeGroup, sortedEntityAttributes, false);

            if (groupfieldSet != null) {
              if (leftForm) {
                leftFormPanel.add(groupfieldSet);
                leftForm = false;
              } else {
                rightFormPanel.add(groupfieldSet);
                leftForm = true;
              }
            }
          }
        }
      }
    }

    topContainer.add(topFormPanel);
    formContainer.add(leftFormPanel);
    formContainer.add(rightFormPanel);

    formButtonContainer.add(identifierContainer);
    formButtonContainer.add(topContainer);
    formButtonContainer.add(formContainer);

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(4, 2, 4, 2));

    cp.add(formButtonContainer, data);

    refRecordInfoDialog.add(cp);
  }
예제 #9
0
  private void initWidget() {
    initmainpanel();
    addfinace.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.addfinance()));
    d.setHeading("添加新会员");
    d.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.contact24()));
    d.setLayout(new RowLayout(Orientation.HORIZONTAL));

    d.setButtons(Dialog.YESNO);
    d.getButtonById(Dialog.YES).setText("添加新会员");
    d.getButtonById(Dialog.NO).setText("关闭");
    d.getButtonById(Dialog.YES)
        .setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.contact24()));

    d.getButtonById(Dialog.YES).addListener(Events.Select, this);
    d.getButtonById(Dialog.NO).addListener(Events.Select, this);

    d.add(w, new RowData(1, 1));

    d.setSize(607, 373);
    // d.setAutoHeight(true);
    // d.setAutoWidth(true);

    store._LoadComplete();
  }
예제 #10
0
  @Override
  public void handleEvent(BaseEvent be) {
    // TODO Auto-generated method stub

    if (be.getType().equals(Events.Select)) {
      // 会员充值
      if (be.getSource().equals(addfinace)) {
        AddFinace_acc addfinace_acc = new AddFinace_acc();
        addfinace_acc.setIsnew(0);
        addfinace_acc.showDialog();
      }
      if (be.getSource().equals(d.getButtonById(Dialog.NO))) {
        close();
      } else if (be.getSource().equals(d.getButtonById(Dialog.YES))) {
        passwordc_t.clearInvalid();

        String passwordc = (passwordc_t.getValue() == null ? "" : passwordc_t.getValue());
        String password = (password_t.getValue() == null ? "" : password_t.getValue());
        if ((!passwordc.equals(password))) {

          passwordc_t.markInvalid("两次录入密码不一致");
          MessageBox.alert("提示", "两次密码录入不一致", null);
          return;
        }
        if (w.isValid()) {

          CommandSyncContainer list = new CommandSyncContainer();
          CommandSyncsql commandsql = new CommandSyncsql();

          // 保存
          commandsql.getV().addAll(store._trySave(0));
          // 更新ccode
          /** 不得已才如此操作,因为ccode的ccode字段是与其他操作管理的字段,和ccodepanel里的做法一直, 默认与icode同值 */
          GWT.log(
              "update ccode set ccode =icode where s_cardno='"
                  + cardno_t.getValue()
                  + "' and cname='"
                  + cname_t.getValue()
                  + "'",
              null);
          commandsql
              .getV()
              .add(
                  "update ccode set ccode =icode where s_cardno='"
                      + cardno_t.getValue()
                      + "' and cname='"
                      + cname_t.getValue()
                      + "'");

          list.add(commandsql);

          final com.base.myproject.client.tools.GreetingServiceAsync greetingService =
              GWT.create(com.base.myproject.client.tools.GreetingService.class);
          greetingService.SendCommandSync(
              list,
              new AsyncCallback<CommandSyncReturnObject>() {
                public void onFailure(Throwable caught) {
                  Window.alert("网络连接不稳定,请稍后重试!");
                }

                public void onSuccess(CommandSyncReturnObject cyro) {

                  System.out.println("成功:" + cyro.getMessage() + cyro.isB() + cyro.getRetrunstr());
                  if (cyro.isB()) {
                    Info.display("", "保存成功", "");
                    addfinace.setEnabled(true);
                    // close();
                  } else {
                    MessageBox.alert("错误", "保存错误!" + cyro.getMessage(), null);
                  }
                }
              });

          // store.trySave(0);
          d.getButtonById(Dialog.YES).setEnabled(false);
        } else MessageBox.alert("禁止", "请检查录入是否正确!", null);
      }

    } else if (be.getType().equals(Events.Change)) {
      if (be.getSource().equals(cardno_t)) {

        final com.base.myproject.client.tools.GreetingServiceAsync greetingService =
            GWT.create(com.base.myproject.client.tools.GreetingService.class);
        greetingService.getDataSet(
            "select count(*) as c from ccode where s_cardno='" + cardno_t.getValue() + "'",
            new AsyncCallback<DataSet>() {

              @Override
              public void onFailure(Throwable caught) {}

              @Override
              public void onSuccess(DataSet result) {

                if (Integer.parseInt(result.getValue(0, "c")) > 0) {
                  Validator v =
                      new Validator() {

                        @Override
                        public String validate(Field<?> field, String value) {

                          return "已经存在相同卡号的用户";
                        }
                      };

                  cardno_t.setValidator(v);

                } else {
                  cardno_t.setValidator(null);
                }
                cardno_t.validate();
              }
            });

      } else if (be.getSource().equals(cname_t)) {

        final com.base.myproject.client.tools.GreetingServiceAsync greetingService =
            GWT.create(com.base.myproject.client.tools.GreetingService.class);
        greetingService.getDataSet(
            "select count(*) as c from ccode where cname='" + cname_t.getValue() + "'",
            new AsyncCallback<DataSet>() {

              @Override
              public void onFailure(Throwable caught) {}

              @Override
              public void onSuccess(DataSet result) {

                if (Integer.parseInt(result.getValue(0, "c")) > 0) {
                  Validator v =
                      new Validator() {

                        @Override
                        public String validate(Field<?> field, String value) {

                          return "已经存在相同名字的用户";
                        }
                      };

                  cname_t.setValidator(v);
                } else {
                  cname_t.setValidator(null);
                }

                cname_t.validate();
              }
            });
      }
      //			else if (name.equals("s_cardno")) {
      //				ccode_t.setFireChangeEventOnSetValue(true);
      //				ccode_t.setValue(icode_t.getValue());
      //				ccode_t.setFireChangeEventOnSetValue(false);
      //			}
    }
  }
예제 #11
0
 public void show() {
   d.show();
 }
예제 #12
0
 @Override
 protected void onRender(Element parent, int index) {
   super.onRender(parent, index);
 }