@Override
  protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);
    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);

    vp.add(createStandard());
    vp.add(createMulti());
    vp.add(createMulti2());
    vp.add(createMixed());
    add(vp);
  };
Example #2
0
  Widget initwidget() {
    VerticalPanel v = new VerticalPanel();
    v.setSpacing(2);

    TabPanel tabpanel = new TabPanel();
    tabpanel.setPlain(true);
    tabpanel.setHeight(450);
    tabpanel.setWidth(760);
    TabItem t1 = new TabItem();
    t1.setText("配偶");
    VerticalPanel vt1 = new VerticalPanel();
    vt1.setSpacing(2);

    vt1.add(createbcode_Spouse_Form());
    t1.add(vt1);
    t1.setScrollMode(Scroll.AUTO);

    TabItem t2 = new TabItem();
    t2.setText("家庭成员");
    VerticalPanel vt2 = new VerticalPanel();
    vt2.setSpacing(2);
    vt2.add(create_bcode_famify_Grid());
    t2.add(vt2);
    t2.setScrollMode(Scroll.AUTO);

    TabItem t3 = new TabItem();
    t3.setText("紧急联络方式");
    VerticalPanel vt3 = new VerticalPanel();
    vt3.setSpacing(2);
    vt3.add(create_bcode_contact_Grid());
    t3.add(vt3);
    t3.setScrollMode(Scroll.AUTO);

    tabpanel.add(t3);
    tabpanel.add(t2);
    tabpanel.add(t1);

    v.add(tabpanel);

    this.add(v);
    return null;
  }
  @Override
  public void addComponent() {
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(10);
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading("Share Project to Users");
    fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    this.projectNameLabel = new Label();
    this.projectNameLabel.setStyleAttribute("font-size", "13");
    this.ownerLabel = new Label();
    this.ownerLabel.setStyleAttribute("font-size", "13");
    this.organizationLabel = new Label();
    this.organizationLabel.setStyleAttribute("font-size", "13");
    fieldSet.add(this.projectNameLabel, new MarginData(10));
    fieldSet.add(ownerLabel, new MarginData(10));
    fieldSet.add(organizationLabel, new MarginData(10));
    verticalPanel.add(fieldSet);
    //
    LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout());
    labelListContainer.setHeight(20);
    labelListContainer.setStyleAttribute("background-color", "white");
    labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    Label organizationUserLabel = new Label("Organization Users:");
    organizationUserLabel.setStyleAttribute("font-size", "13");
    organizationUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST));
    Label projectSharedUserLabel = new Label("Project Shared Users:");
    projectSharedUserLabel.setStyleAttribute("font-size", "13");
    projectSharedUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST));
    verticalPanel.add(labelListContainer);
    //
    final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>();
    lists.setMode(Mode.INSERT);
    lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75);
    lists.setStyleAttribute("margin-left", "11px");
    lists.setHideLabel(Boolean.TRUE);

    ListField<GPSimpleUser> from = lists.getFromList();
    from.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.fromStore = new ListStore<GPSimpleUser>();
    from.setStore(this.fromStore);
    ListField<GPSimpleUser> to = lists.getToList();
    to.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.toStore = new ListStore<GPSimpleUser>();
    to.setStore(this.toStore);
    Button cancelButton =
        new Button(
            "GoTo Search Project",
            BasicWidgetResources.ICONS.gear(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                ShareProjectPanel.this.reset();
                projectManagementWidget.showSearchProjectPanel();
              }
            });
    super.addButton(cancelButton);
    saveButton =
        new Button(
            "Save",
            BasicWidgetResources.ICONS.save(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                toStore.commitChanges();
                List<Long> accountIDsProject =
                    Lists.newArrayListWithCapacity(toStore.getModels().size());
                IGPAccountDetail accountDetail =
                    Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
                boolean test = false;
                for (GPSimpleUser user : toStore.getModels()) {
                  if (user.getId().equals(accountDetail.getId())) {
                    test = true;
                  }
                  accountIDsProject.add(user.getId());
                }
                final boolean isShared = test;
                ShareProjectPanel.this.reset();
                LayerRemote.Util.getInstance()
                    .shareProjectToUsers(
                        project.getId(),
                        accountIDsProject,
                        new AsyncCallback<Boolean>() {
                          @Override
                          public void onFailure(Throwable caught) {
                            System.out.println("Error on saving user to share project");
                          }

                          @Override
                          public void onSuccess(Boolean result) {
                            //                                System.out.println("Project is Shared:
                            // " + isShared);
                            if (project.isDefaultProject()) {
                              GPClientProject projInSession =
                                  Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name());
                              if (isShared) {
                                projInSession.setShared(Boolean.TRUE);
                              } else {
                                projInSession.setShared(Boolean.FALSE);
                              }
                            }
                            project.setShared(Boolean.TRUE);
                            loadData(project);
                          }
                        });
              }
            });
    super.addButton(saveButton);
    super.add(verticalPanel);
    super.add(lists, new FormData("98%"));
    LayoutContainer filterContainer = new LayoutContainer(new BorderLayout());
    this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users");
    filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST));
    this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List");
    filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST));
    filterContainer.setStyleAttribute("margin", "11px");
    super.add(filterContainer);
  }
  private void createUploadComponent(String uploadAction, final GPExtensions... extensions) {
    uploaderProgressBar = new UploaderProgressBar();
    formPanel.setAction(GWT.getModuleBaseURL() + uploadAction);
    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);

    this.verticalPanel = new VerticalPanel();

    this.queryParameter = new Hidden();

    this.verticalPanel.add(queryParameter);

    formPanel.setWidget(verticalPanel);

    fileUpload = new FileUpload();
    fileUpload.setName("uploadFormElement");
    verticalPanel.add(fileUpload);

    buttonSubmit =
        new Button(
            ButtonsConstants.INSTANCE.submitText(),
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                uploaderProgressBar.show("Uploading...");
                formPanel.submit();
                if ((fileUpload.getFilename() != null)
                    && isValidExtensions(fileUpload.getFilename(), extensions)) {
                  LayoutManager.getInstance()
                      .getStatusMap()
                      .setBusy(BasicWidgetConstants.INSTANCE.GPFileUploader_uploadInProgressText());
                }
              }
            });
    verticalPanel.add(buttonSubmit);

    // Add an event handler to the form.
    formPanel.addSubmitHandler(
        new FormPanel.SubmitHandler() {

          @Override
          public void onSubmit(SubmitEvent event) {
            // This event is fired just before the form is submitted. We can
            // take this opportunity to perform validation
            if (!isValidExtensions(fileUpload.getFilename(), extensions)) {
              uploaderProgressBar.hide();
              LayoutManager.getInstance()
                  .getStatusMap()
                  .setStatus(
                      BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(),
                      EnumSearchStatus.STATUS_NO_SEARCH.toString());
              GeoPlatformMessage.errorMessage(
                  BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorMessageTitleText(),
                  BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorKindFileBodyText());
              event.cancel();
              formPanel.reset();
            }
          }
        });

    formPanel.addSubmitCompleteHandler(
        new FormPanel.SubmitCompleteHandler() {

          @Override
          public void onSubmitComplete(SubmitCompleteEvent event) {
            // When the form submission is successfully completed,
            // this event is fired. Assuming the service returned a
            // response of type text/html, we can get the result text here
            // (see the FormPanel documentation for further explanation)
            htmlResult = event.getResults();
            System.out.println("HTML Result: " + htmlResult);
            // Execute this code only if the session is still alive
            if (htmlResult.contains("Session Timeout")) {
              GPHandlerManager.fireEvent(new GPLoginEvent(null));
            } else if (!htmlResult.contains("HTTP ERROR")) {
              formPanel.reset();
              htmlResult = htmlResult.replaceAll("<pre>", "");
              htmlResult = htmlResult.replaceAll("</pre>", "");
              htmlResult =
                  htmlResult.replaceAll(
                      "<pre style=\"word-wrap: break-word; white-space: pre-wrap;\">", "");
              if (GPSharedUtils.isNotEmpty(htmlResult)) {
                //                                logger.info("HTMLResult: " + htmlResult);
                uploadEvent.setResult(htmlResult);
                GPHandlerManager.fireEvent(uploadEvent);
                // done.enable();
                // mapPreviewWidget.drawAoiOnMap(wkt);
                LayoutManager.getInstance()
                    .getStatusMap()
                    .setStatus(
                        BasicWidgetConstants.INSTANCE.GPFileUploader_successStatusText(),
                        EnumSearchStatus.STATUS_SEARCH.toString());
              } else {
                LayoutManager.getInstance()
                    .getStatusMap()
                    .setStatus(
                        BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(),
                        EnumSearchStatus.STATUS_NO_SEARCH.toString());
              }
            } else {
              GeoPlatformMessage.errorMessage(
                  BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorMessageTitleText(),
                  BasicWidgetConstants.INSTANCE.GPFileUploader_failedErrorGenericBodyText());
              LayoutManager.getInstance()
                  .getStatusMap()
                  .setStatus(
                      BasicWidgetConstants.INSTANCE.GPFileUploader_failedStatusText(),
                      EnumSearchStatus.STATUS_NO_SEARCH.toString());
            }
            uploaderProgressBar.hide();
          }
        });
  }
 private Widget initWeigetx() {
   VerticalPanel vpanel = new VerticalPanel();
   vpanel.add(createGrid());
   return vpanel;
 }
  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);
  }