예제 #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
  // 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);
  }