private void setDashboard(Dashboard dashboard) {
    Canvas[] members = getMembers();
    removeMembers(members);
    // pass in the resource information
    dashboardView =
        new DashboardView(
            extendLocatorId(dashboard.getName()),
            this,
            dashboard,
            EntityContext.forResource(resourceComposite.getResource().getId()),
            resourceComposite);
    addMember(dashboardView);

    footer = new LocatableToolStrip(extendLocatorId("Footer"));
    footer.setPadding(5);
    footer.setWidth100();
    footer.setMembersMargin(15);

    editButton =
        new LocatableIButton(
            footer.extendLocatorId("Mode"),
            editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
    editButton.setAutoFit(true);
    editButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent clickEvent) {
            editMode = !editMode;
            editButton.setTitle(
                editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
            dashboardView.setEditMode(editMode);
          }
        });

    resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
    resetButton.setAutoFit(true);
    resetButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent clickEvent) {
            String message = MSG.view_summaryDashboard_resetConfirm();

            SC.ask(
                message,
                new BooleanCallback() {
                  public void execute(Boolean confirmed) {
                    if (confirmed) {
                      dashboardView.delete();
                      setDashboard(getDefaultDashboard());
                      markForRedraw();
                    }
                  }
                });
          }
        });

    footer.addMember(editButton);
    footer.addMember(resetButton);

    addMember(footer);
  }
예제 #2
0
  public Canvas getViewPanel() {

    final TabSet topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setTabBarAlign(Side.LEFT);
    topTabSet.setWidth(400);
    topTabSet.setHeight(200);

    Tab tTab1 = new Tab("Blue", "pieces/16/pawn_blue.png");

    tTab1.setCanClose(true);
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    tTab1.setPane(tImg1);

    Tab tTab2 = new Tab("Green", "pieces/16/pawn_green.png");
    Img tImg2 = new Img("pieces/48/pawn_green.png", 48, 48);
    tTab2.setPane(tImg2);

    topTabSet.addTab(tTab1);
    topTabSet.addTab(tTab2);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    IButton addButton = new IButton("Add Tab");
    addButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String title = topTabSet.getTabs().length % 2 == 0 ? "Yellow" : "Green";
            String iconType = topTabSet.getTabs().length % 2 == 0 ? "pawn" : "cube";
            Tab tTab = new Tab(title, "pieces/16/" + iconType + "_" + title.toLowerCase() + ".png");
            tTab.setCanClose(true);
            Img tImg =
                new Img("pieces/48/" + iconType + "_" + title.toLowerCase() + ".png", 48, 48);
            tTab.setPane(tImg);
            topTabSet.addTab(tTab);
          }
        });

    IButton removeButton = new IButton("Remove Tab");
    removeButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            topTabSet.removeTab(topTabSet.getTabs().length - 1);
          }
        });

    buttons.addMember(addButton);
    buttons.addMember(removeButton);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    vLayout.setHeight("auto");

    return vLayout;
  }
  @Override
  protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {

    if (record != null) {
      String fieldName = this.getFieldName(colNum);

      if (fieldName.equals(EditRulesLayout.EDIT_RULES_COPY)) {
        // Copy button
        IButton copyButton = new IButton(i18n.copy());
        copyButton.setShowDown(false);
        copyButton.setShowRollOver(false);
        copyButton.setHeight(17);
        copyButton.setLayoutAlign(Alignment.CENTER);
        copyButton.setAlign(Alignment.CENTER);
        copyButton.addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                System.out.println("copy " + record.getAttribute("name"));
                String userID = getLoggedInUserId();
                EventBus.getMainEventBus()
                    .fireEvent(new CopyEvent(userID, record.getAttribute("name")));
              }
            });
        return copyButton;
      }
      return null;
    }
    return null;
  }
 public AssetCanvas(final FormItem formItem) {
   setWidth(100);
   setAlign(Alignment.CENTER);
   previewContainer = new Canvas();
   addMember(previewContainer);
   previewContainer.setWidth(100);
   previewContainer.setHeight(100);
   previewContainer.setBorder("1px solid #a6abb4");
   imageUpdateButton = new IButton("Update Artifact");
   imageUpdateButton.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           String formItemName = formItem.getName();
           ((DynamicEntityDataSource) formItem.getForm().getDataSource())
               .getFormItemCallbackHandlerManager()
               .getFormItemCallback(formItemName)
               .execute(formItem);
         }
       });
   addMember(imageUpdateButton);
   if (formItem.getDisabled()) {
     imageUpdateButton.setVisible(false);
   }
 }
예제 #5
0
파일: Setup.java 프로젝트: genievn/LD
  private void initGUI(final GUIInfo info) {
    // Prepare a value manager that will include all forms spanned in each
    // tab
    vm = new ValuesManager();

    // Create all the tabs each one for a specific setup step
    tabs = new TabSet();
    tabs.setWidth(500);
    tabs.setHeight(250);

    Tab registrationTab = setupRegistration(vm);
    Tab repositoryTab = setupRepository(vm);
    Tab databaseTab = setupDatabase(vm);
    Tab languageTab = setupLanguage(vm);
    Tab smtpTab = setupSmtp(vm);
    tabs.setTabs(registrationTab, repositoryTab, databaseTab, languageTab, smtpTab);

    // This is the button used to confirm each step
    submit = new IButton();
    submit.setTitle(I18N.message("next"));
    submit.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onSubmit(info);
          }
        });

    // Prepare the heading panel with Logo and Title
    // Prepare the logo image to be shown inside the login form
    Label header = new Label(I18N.message("setup"));
    header.setStyleName("setupHeader");
    header.setIcon(Util.brandUrl("logo.png"));
    header.setIconWidth(205);
    header.setIconHeight(40);
    header.setHeight(45);

    // Prepare a panel to layout setup components
    VLayout layout = new VLayout();
    layout.setHeight(500);
    layout.setWidth(400);
    layout.setMembersMargin(5);
    layout.addMember(header);
    layout.addMember(tabs);
    layout.addMember(submit);

    // Panel for horizontal centering
    VLayout vPanel = new VLayout();
    vPanel.setDefaultLayoutAlign(Alignment.CENTER);
    vPanel.setWidth100();
    vPanel.setHeight(300);
    vPanel.addMember(layout);

    RootPanel.get().add(vPanel);

    // Remove the loading frame
    RootPanel.getBodyElement().removeChild(RootPanel.get("loadingWrapper").getElement());
  }
  public FormAddFolderFromButton(IHMcodeMirror IHM) {
    super();
    this.IHMcodeMirror = IHM;

    WindowFactory.setParameters(this, "Create New Folder", 350, 280);

    this.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClientEvent closeClientEvent) {
            hide();
          }
        });

    DynamicForm form = new DynamicForm();
    form.setPadding(5);
    form.setLayoutAlign(VerticalAlignment.BOTTOM);

    textItem = new TextItem();
    textItem.setTitle("Name");
    textItem.setRequired(true);

    IButton ok = new IButton("Ok");
    form.setFields(textItem);
    this.addItem(form);
    this.addItem(ok);

    treeGrid = Singleton.getInstance().loadFileSystemLight(IHMcodeMirror.getAbstractItemRoot());
    this.addItem(treeGrid);

    ok.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            AbstractItem item =
                (AbstractItem) treeGrid.getSelectedRecord().getAttributeAsObject("abstractItem");
            item.setPath(item.getPath() + textItem.getEnteredValue());

            repositoryToolsServices.createFolderIntoLocalRepository(
                item,
                new AsyncCallback<Boolean>() {
                  @Override
                  public void onFailure(Throwable throwable) {}

                  @Override
                  public void onSuccess(Boolean bool) {
                    hide();
                    Singleton.getInstance()
                        .loadFileSystem(
                            IHMcodeMirror.getAbstractItemRoot(), IHMcodeMirror.getSystemFileRoot());
                  }
                });
          }
        });
  }
예제 #7
0
  private void showCurrencyForm(final int rowNum, final int colNum, Currency currency) {

    final UserWindow winModal = new UserWindow();
    winModal.setAutoSize(true);
    winModal.setTitle(constants.currency());
    final CurrencyForm currencyForm = new CurrencyForm();
    currencyForm.setCurrency(currency);

    IButton okButton = new IButton(constants.ok());
    IButton cancelButton = new IButton(constants.cancel());

    HLayout controlLayout = new HLayout();
    controlLayout.setMembers(okButton, cancelButton);

    okButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (currencyForm.validate(false)) {
              winModal.destroy();
              ListGridRecord record = currencyGrid.getRecord(rowNum);
              String fieldName = currencyGrid.getFieldName(colNum);
              record.setAttribute(fieldName, currencyForm.getCurrencyExchange());
              currencyGrid.updateData(record);
            }
          }
        });

    cancelButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            winModal.destroy();
          }
        });
    winModal.addItem(currencyForm);
    winModal.addItem(controlLayout);
    winModal.show();
  }
예제 #8
0
  private void bind() {

    if (submitButton != null)
      submitButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              if (!updateBookInfo()) {
                return;
              }
              // SC.say("提交修改");
              doUpdateBook();
            }
          });
    if (newButton != null)
      newButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              if (!updateBookInfo()) {
                return;
              }
              // SC.say("添加图书");
              doAddBook();
            }
          });
    if (uploadPicButton != null)
      uploadPicButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              // SC.say("上传图片");
              UploadImageWindow uploadWindow = new UploadImageWindow(getSelf());
              uploadWindow.show();
            }
          });
  }
예제 #9
0
  @Inject
  public LoginPageView() {

    window = new Window();
    window.setHeaderIcon(AppImages.SAVARA_ICON);
    window.setTitle("console");
    window.setWidth(300);
    window.setHeight(150);
    window.setIsModal(true);
    window.setShowMinimizeButton(false);
    window.setShowCloseButton(false);
    window.centerInPage();

    DynamicForm form = new DynamicForm();
    form.setWidth(250);

    usernameItem = new TextItem();
    usernameItem.setTitle("username");

    passwordItem = new PasswordItem();
    passwordItem.setTitle("password");

    HLayout buttonLayout = new HLayout();
    IButton loginBtn = new IButton("Login");
    loginBtn.setWidth(60);
    loginBtn.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent clickEvent) {
            String name = usernameItem.getValueAsString();
            String password = passwordItem.getValueAsString();
            presenter.login(name, password);
          }
        });
    buttonLayout.addMember(loginBtn);
    buttonLayout.setAlign(Alignment.CENTER);

    form.setFields(new FormItem[] {usernameItem, passwordItem});
    form.setPadding(10);

    window.addItem(form);
    window.addItem(buttonLayout);

    HLayout versionLayout = new HLayout();
    Label versionNo = new Label(Build.VERSION);

    versionLayout.addMember(versionNo);
    versionLayout.setAlign(Alignment.RIGHT);

    window.addItem(versionLayout);
  }
예제 #10
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout();
    layout.setMembersMargin(10);

    final Img image = new Img("other/magnifier.png", 48, 48);
    image.setTop(125);
    image.setLeft(100);
    image.setAnimateTime(500); // milliseconds

    IButton zoomButton = new IButton();
    zoomButton.setTitle("Zoom");
    zoomButton.setLeft(40);
    zoomButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(0, 50, 248, 248);
          }
        });

    IButton shrinkButton = new IButton();
    shrinkButton.setTitle("Shrink");
    shrinkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(100, 125, 48, 48);
          }
        });

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(zoomButton);
    hLayout.addMember(shrinkButton);
    layout.addMember(hLayout);

    layout.addChild(image);
    return layout;
  }
예제 #11
0
  private Canvas getActionLayout() {
    EnhancedVLayout actionLayout = new EnhancedVLayout(10);
    IButton deleteButton = new EnhancedIButton(MSG.common_button_delete(), ButtonColor.RED);
    // deleteButton.setIcon("subsystems/bundle/BundleVersionAction_Delete_16.png");
    deleteButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent clickEvent) {
            SC.ask(
                MSG.view_bundle_version_deleteConfirm(),
                new BooleanCallback() {
                  public void execute(Boolean aBoolean) {
                    if (aBoolean) {
                      bundleManager.deleteBundleVersion(
                          version.getId(),
                          false,
                          new AsyncCallback<Void>() {
                            public void onFailure(Throwable caught) {
                              CoreGUI.getErrorHandler()
                                  .handleError(
                                      MSG.view_bundle_version_deleteFailure(version.getVersion()),
                                      caught);
                            }

                            public void onSuccess(Void result) {
                              CoreGUI.getMessageCenter()
                                  .notify(
                                      new Message(
                                          MSG.view_bundle_version_deleteSuccessful(
                                              version.getVersion()),
                                          Message.Severity.Info));
                              // Bundle version is deleted, go back to main bundle view
                              CoreGUI.goToView(
                                  LinkManager.getBundleVersionLink(version.getBundle().getId(), 0),
                                  true);
                            }
                          });
                    }
                  }
                });
          }
        });
    actionLayout.addMember(deleteButton);

    if (!canDelete) {
      deleteButton.setDisabled(true);
    }

    return actionLayout;
  }
예제 #12
0
 public SavePanel(
     String saveTitle, ClickHandler saveClicked, String cancelTitle, ClickHandler cancelClicked) {
   if (saveTitle == null || saveTitle.trim().length() == 0)
     saveTitle = "OK"; // ClientSession.getInstance().getCaption("save");
   if (cancelTitle == null || cancelTitle.trim().length() == 0)
     cancelTitle = "Close"; // ClientSession.getInstance().getCaption("cancel");
   hl = new HLayout();
   hl.setAlign(Alignment.RIGHT);
   saveBtn = new IButton(saveTitle);
   saveBtn.addClickHandler(saveClicked);
   cancelBtn = new IButton(cancelTitle);
   cancelBtn.addClickHandler(cancelClicked);
   hl.addMember(saveBtn);
   hl.addMember(cancelBtn);
   hl.setWidth100();
   hl.setMembersMargin(10);
   hl.setHeight("30");
   Label l = new Label();
   l.setTitle("");
   l.setContents("");
   l.setWidth(0);
   hl.addMember(l);
   addMember(hl);
 }
예제 #13
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout();
    layout.setMembersMargin(10);

    final Canvas cubeBin = new Canvas("cubeBin");
    cubeBin.setTop(40);
    cubeBin.setWidth(400);
    cubeBin.setHeight(300);
    cubeBin.setShowEdges(true);

    IButton button = new IButton();
    button.setTitle("Create");
    button.setIcon("pieces/16/cube_blue.png");
    button.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final Img img = new Img();
            img.setLeft(Random.nextInt(340));
            img.setTop(Random.nextInt(240));
            img.setWidth(48);
            img.setHeight(48);
            img.setParentElement(cubeBin);
            img.setSrc("pieces/48/cube_blue.png");
            img.addClickHandler(
                new ClickHandler() {
                  public void onClick(ClickEvent event) {
                    img.destroy();
                  }
                });
            img.draw();
          }
        });
    layout.addMember(button);
    layout.addMember(cubeBin);

    return layout;
  }
    public teamsInClass_Team_Widget(
        final Criteria criteria, final UserDetailsReceivedEvent userDetails) {
      this.userDetails = userDetails;

      final TeamModelMessages targetMessages =
          (TeamModelMessages) GWT.create(TeamModelMessages.class);

      BoatTypeModelMessages boatTypeMessages =
          (BoatTypeModelMessages) GWT.create(BoatTypeModelMessages.class);

      setPadding(10);
      setIsGroup(true);
      setGroupTitle(
          classMessages.richFormView_teamsInClass_coupling_with_Team(
              targetMessages.tab_name_TeamModel()));

      // all elements from the target reference, to be picked from to make a connection

      setWidth100();
      setHeight100();

      this.grid.setWidth100();
      // grid.setHeight(150); //automatically ought to use all the space
      // grid.setHeight("*");

      this.grid.setAlternateRecordStyles(false);
      this.grid.setCellHeight(32);
      this.grid.setDataSource(dataSource);
      this.grid.setAutoFetchData(false);
      this.grid.setCanEdit(true);
      this.grid.setModalEditing(true);
      this.grid.setShowFilterEditor(true);
      this.grid.setDoubleClickDelay(100);
      this.grid.setEditEvent(ListGridEditEvent.DOUBLECLICK);
      this.grid.setListEndEditAction(RowEndEditAction.DONE);
      this.grid.setCanRemoveRecords(true);
      this.grid.setAutoSaveEdits(true);
      this.grid.setCanSelectText(true);
      this.grid.setAllowFilterExpressions(true);

      this.grid.setCanDragSelectText(true);
      this.grid.setCanRemoveRecords(
          false); // we have our own delete button, with extra functionality

      /*

      */

      ListGridField idField = new ListGridField("Team_id", "Team id");

      ListGridField sailNumberField = new ListGridField("sailNumber", targetMessages.sailNumber());

      sailNumberField.setAlign(Alignment.LEFT);

      sailNumberField = TeamRichTableView.setFormatterForsailNumber(sailNumberField);

      ListGridField teamNameField = new ListGridField("teamName", targetMessages.teamName());

      teamNameField.setAlign(Alignment.LEFT);

      teamNameField = TeamRichTableView.setFormatterForteamName(teamNameField);

      ListGridField nameCaptainField =
          new ListGridField("nameCaptain", targetMessages.nameCaptain());

      nameCaptainField.setAlign(Alignment.LEFT);

      nameCaptainField = TeamRichTableView.setFormatterFornameCaptain(nameCaptainField);

      ListGridField streetField = new ListGridField("street", targetMessages.street());

      streetField.setAlign(Alignment.LEFT);

      streetField = TeamRichTableView.setFormatterForstreet(streetField);

      ListGridField zipcodeField = new ListGridField("zipcode", targetMessages.zipcode());

      zipcodeField.setAlign(Alignment.LEFT);

      zipcodeField = TeamRichTableView.setFormatterForzipcode(zipcodeField);

      ListGridField cityField = new ListGridField("city", targetMessages.city());

      cityField.setAlign(Alignment.LEFT);

      cityField = TeamRichTableView.setFormatterForcity(cityField);

      ListGridField emailField = new ListGridField("email", targetMessages.email());

      emailField.setAlign(Alignment.LEFT);

      emailField = TeamRichTableView.setFormatterForemail(emailField);

      ListGridField phoneField = new ListGridField("phone", targetMessages.phone());

      phoneField.setAlign(Alignment.LEFT);

      phoneField = TeamRichTableView.setFormatterForphone(phoneField);

      ListGridField numPersonsField = new ListGridField("numPersons", targetMessages.numPersons());

      numPersonsField.setAlign(Alignment.LEFT);

      numPersonsField = TeamRichTableView.setFormatterFornumPersons(numPersonsField);

      ListGridField toerField = new ListGridField("toer", targetMessages.toer());

      toerField = TeamRichTableView.setFormatterFortoer(toerField);

      ListGridField spinField = new ListGridField("spin", targetMessages.spin());

      spinField = TeamRichTableView.setFormatterForspin(spinField);

      ListGridField waitinglistField =
          new ListGridField("waitinglist", targetMessages.waitinglist());

      waitinglistField = TeamRichTableView.setFormatterForwaitinglist(waitinglistField);

      ListGridField femaleTeamField = new ListGridField("femaleTeam", targetMessages.femaleTeam());

      femaleTeamField = TeamRichTableView.setFormatterForfemaleTeam(femaleTeamField);

      ListGridField remark_Field = new ListGridField("remark_", targetMessages.remark_());

      remark_Field.setAlign(Alignment.LEFT);

      remark_Field = TeamRichTableView.setFormatterForremark_(remark_Field);

      ListGridField teamStartTimeField =
          new ListGridField("teamStartTime", targetMessages.teamStartTime());

      teamStartTimeField.setAlign(Alignment.LEFT);

      teamStartTimeField = TeamRichTableView.setFormatterForteamStartTime(teamStartTimeField);

      teamStartTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      // call to a custom field, this class should be created customly
      teamStartTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom.TeamTeamStartTimeCustomFieldFactory
              .getCustomField(grid, teamStartTimeField, userDetails);

      ListGridField endTimeField = new ListGridField("endTime", targetMessages.endTime());

      endTimeField.setAlign(Alignment.LEFT);

      endTimeField = TeamRichTableView.setFormatterForendTime(endTimeField);

      endTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      ListGridField sailingTimeField =
          new ListGridField("sailingTime", targetMessages.sailingTime());

      sailingTimeField.setAlign(Alignment.LEFT);

      sailingTimeField = TeamRichTableView.setFormatterForsailingTime(sailingTimeField);

      sailingTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      // call to a custom field, this class should be created customly
      sailingTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSailingTimeCustomFieldFactory
              .getCustomField(grid, sailingTimeField, userDetails);

      ListGridField swTimeField = new ListGridField("swTime", targetMessages.swTime());

      swTimeField.setAlign(Alignment.LEFT);

      swTimeField = TeamRichTableView.setFormatterForswTime(swTimeField);

      swTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      // call to a custom field, this class should be created customly
      swTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSwTimeCustomFieldFactory
              .getCustomField(grid, swTimeField, userDetails);

      ListGridField registrationDateTimeField =
          new ListGridField("registrationDateTime", targetMessages.registrationDateTime());

      registrationDateTimeField.setAlign(Alignment.LEFT);

      registrationDateTimeField =
          TeamRichTableView.setFormatterForregistrationDateTime(registrationDateTimeField);

      //	registrationDateTimeField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
      DateTimeItem registrationDateTimeEditor = new DateTimeItem();
      registrationDateTimeEditor.setUseTextField(true);
      registrationDateTimeEditor.setUseMask(true);
      //	registrationDateTimeEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
      registrationDateTimeField.setEditorType(registrationDateTimeEditor);
      //   registrationDateTimeField.setFilterEditorType(registrationDateTimeEditor);

      // call to a custom field, this class should be created customly
      registrationDateTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom
              .TeamRegistrationDateTimeCustomFieldFactory.getCustomField(
              grid, registrationDateTimeField, userDetails);

      ListGridField payDateField = new ListGridField("payDate", targetMessages.payDate());

      payDateField.setAlign(Alignment.LEFT);

      payDateField = TeamRichTableView.setFormatterForpayDate(payDateField);

      //	payDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
      DateItem payDateEditor = new DateItem();
      payDateEditor.setUseTextField(true);
      payDateEditor.setUseMask(true);
      //	payDateEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
      payDateField.setEditorType(payDateEditor);
      // payDateField.setFilterEditorType(payDateEditor);

      ListGridField payOrderField = new ListGridField("payOrder", targetMessages.payOrder());

      payOrderField.setAlign(Alignment.LEFT);

      payOrderField = TeamRichTableView.setFormatterForpayOrder(payOrderField);

      ListGridField payIdField = new ListGridField("payId", targetMessages.payId());

      payIdField.setAlign(Alignment.LEFT);

      payIdField = TeamRichTableView.setFormatterForpayId(payIdField);

      ListGridField acceptedField = new ListGridField("accepted", targetMessages.accepted());

      acceptedField = TeamRichTableView.setFormatterForaccepted(acceptedField);

      ListGridField payStatusField = new ListGridField("payStatus", targetMessages.payStatus());

      payStatusField.setAlign(Alignment.LEFT);

      payStatusField = TeamRichTableView.setFormatterForpayStatus(payStatusField);

      ListGridField BoatTypeField =
          new ListGridField("BoatType_id", boatTypeMessages.name_single());

      ListGridField ClassField = new ListGridField("Class_id", classMessages.name_single());

      final SelectItem BoatTypeSelectItem =
          new SelectItem("BoatType_id", boatTypeMessages.name_single());

      BoatTypeSelectItem.setOptionDataSource(DataSource.get("BoatType"));
      BoatTypeSelectItem.setValueField("BoatType_id");
      BoatTypeSelectItem.setAlign(Alignment.LEFT);

      BoatTypeSelectItem.setTextAlign(Alignment.LEFT);
      BoatTypeSelectItem.setTitleAlign(Alignment.LEFT);
      ListGrid BoatTypeListGrid = new ListGrid();
      BoatTypeListGrid.setShowFilterEditor(true);
      BoatTypeListGrid.setFilterOnKeypress(true);

      SortSpecifier BoatTypeSort = new SortSpecifier("typeName", SortDirection.ASCENDING);
      SortSpecifier[] BoatTypeSorts = new SortSpecifier[] {BoatTypeSort};
      BoatTypeListGrid.setInitialSort(BoatTypeSorts);

      BoatTypeSelectItem.setDisplayField("typeName");

      BoatTypeSelectItem.setAllowEmptyValue(true);

      BoatTypeSelectItem.setPickListWidth(800);
      BoatTypeSelectItem.setPickListFields(
          new ListGridField("typeName", boatTypeMessages.typeName()),
          new ListGridField("SW_value", boatTypeMessages.SW_value()));

      BoatTypeSelectItem.setPickListProperties(BoatTypeListGrid);

      BoatTypeField.setAlign(Alignment.LEFT);

      BoatTypeField.setEditorType(BoatTypeSelectItem);
      BoatTypeField.setOptionDataSource(DataSource.get("BoatType"));
      BoatTypeField.setDisplayField("typeName");

      BoatTypeField.setFilterEditorType(BoatTypeSelectItem); // reusing this is okay appareantly

      ButtonItem newBoatType = new ButtonItem("newBoatType", boatTypeMessages.new_window());
      newBoatType.addClickHandler(
          new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
            @Override
            public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
              BoatTypeNewEntryWindow w =
                  new BoatTypeNewEntryWindow(
                      null,
                      new DSCallback() {
                        @Override
                        public void execute(
                            DSResponse response, Object rawData, DSRequest request) {
                          RecordList rl = response.getDataAsRecordList();
                          if (rl.getLength() > 0) {
                            Record r = rl.get(0);
                            Log.debug("Record found in callback");
                            Integer id = r.getAttributeAsInt("BoatType_id");
                            Log.debug("ID is " + id);
                            BoatTypeSelectItem.setValue(id); // select the just added value
                          }
                        }
                      });

              w.show();
              w.bringToFront();
            }
          });

      final SelectItem ClassSelectItem = new SelectItem("Class_id", classMessages.name_single());

      ClassSelectItem.setOptionDataSource(DataSource.get("Class"));
      ClassSelectItem.setValueField("Class_id");
      ClassSelectItem.setAlign(Alignment.LEFT);

      ClassSelectItem.setTextAlign(Alignment.LEFT);
      ClassSelectItem.setTitleAlign(Alignment.LEFT);
      ListGrid ClassListGrid = new ListGrid();
      ClassListGrid.setShowFilterEditor(true);
      ClassListGrid.setFilterOnKeypress(true);

      SortSpecifier ClassSort = new SortSpecifier("className", SortDirection.ASCENDING);
      SortSpecifier[] ClassSorts = new SortSpecifier[] {ClassSort};
      ClassListGrid.setInitialSort(ClassSorts);

      ClassSelectItem.setDisplayField("className");

      ClassSelectItem.setAllowEmptyValue(true);

      ClassSelectItem.setPickListWidth(800);
      ClassSelectItem.setPickListFields(
          new ListGridField("className", classMessages.className()),
          new ListGridField("startTime", classMessages.startTime()));

      ClassSelectItem.setPickListProperties(ClassListGrid);

      ClassField.setAlign(Alignment.LEFT);

      ClassField.setEditorType(ClassSelectItem);
      ClassField.setOptionDataSource(DataSource.get("Class"));
      ClassField.setDisplayField("className");

      ClassField.setFilterEditorType(ClassSelectItem); // reusing this is okay appareantly

      ButtonItem newClass = new ButtonItem("newClass", classMessages.new_window());
      newClass.addClickHandler(
          new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
            @Override
            public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
              ClassNewEntryWindow w =
                  new ClassNewEntryWindow(
                      null,
                      new DSCallback() {
                        @Override
                        public void execute(
                            DSResponse response, Object rawData, DSRequest request) {
                          RecordList rl = response.getDataAsRecordList();
                          if (rl.getLength() > 0) {
                            Record r = rl.get(0);
                            Log.debug("Record found in callback");
                            Integer id = r.getAttributeAsInt("Class_id");
                            Log.debug("ID is " + id);
                            ClassSelectItem.setValue(id); // select the just added value
                          }
                        }
                      });

              w.show();
              w.bringToFront();
            }
          });

      ListGridField deleteField = new ListGridField("deleteField", "-");
      deleteField.setShouldPrint(false);
      deleteField.setCellIcon(
          GWT.getHostPageBaseURL() + "images/icons/32/woofunction/remove_32.png");
      deleteField.setType(ListGridFieldType.ICON);
      deleteField.setTitle("");
      deleteField.setWidth(32);
      deleteField.setIconSize(24);
      deleteField.setCanDragResize(false);
      deleteField.setCanSort(false);
      deleteField.setCanEdit(false);
      deleteField.setCanGroupBy(false);
      deleteField.setCanFreeze(false);
      deleteField.setCanFilter(false);
      deleteField.setCanHide(false);
      deleteField.setCanReorder(false);
      this.grid.addRecordClickHandler(
          new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
              ListGridField clicked = event.getField();
              final Record r = event.getRecord();
              if ("deleteField".equals(clicked.getName())) {

                SC.confirm(
                    radosMessages.delete_confirm_coupling(),
                    new BooleanCallback() {
                      public void execute(Boolean confirmed) {
                        if (confirmed != null && confirmed) {
                          grid.removeData(r);
                        } else {
                          // Cancel
                        }
                      }
                    });
              }
            }
          });

      ArrayList<ListGridField> fields = new ArrayList<ListGridField>();

      fields.add(idField);

      fields.add(sailNumberField);

      fields.add(teamNameField);

      fields.add(nameCaptainField);

      fields.add(streetField);

      fields.add(zipcodeField);

      fields.add(cityField);

      fields.add(emailField);

      fields.add(phoneField);

      fields.add(numPersonsField);

      fields.add(toerField);

      fields.add(spinField);

      fields.add(waitinglistField);

      fields.add(femaleTeamField);

      fields.add(remark_Field);

      fields.add(teamStartTimeField);

      fields.add(endTimeField);

      fields.add(sailingTimeField);

      fields.add(swTimeField);

      fields.add(registrationDateTimeField);

      fields.add(payDateField);

      fields.add(payOrderField);

      fields.add(payIdField);

      fields.add(acceptedField);

      fields.add(payStatusField);

      fields.add(BoatTypeField);

      if (userDetails.hasAuthority("CAN_DELETE_TEAM")) {
        fields.add(deleteField);
      }

      ListGridField[] fieldsArr = fields.toArray(new ListGridField[fields.size()]);

      this.grid.setFields(fieldsArr);

      this.grid.fetchData(criteria);
      buttonPanel.setMargin(2);

      grid.hideField("Team_id");

      // newButton.setSize(32);
      newButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/add_32.png");
      newButton.setIconOrientation("right");
      newButton.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {

              Map<String, Object> defaultValues = new HashMap<String, Object>();
              defaultValues.put("Class_id", criteria.getAttribute("Class_id"));
              grid.startEditingNew(defaultValues);
            }
          });

      buttonPanel.addMember(newButton);

      /*IButton printButton = new IButton(radosMessages.richTableView_print_button());*/
      IButton printButton = new IButton(radosMessages.richTableView_print_button());
      printButton.setShowRollOver(false);
      printButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/printer_32.png");
      printButton.setIconOrientation("right");

      // Img printButton = new
      // Img(GWT.getHostPageBaseURL()+"images/icons/32/woofunction/printer_32.png");
      // printButton.setSize(32);
      // printButton.setAltText(radosMessages.richTableView_print_button());
      printButton.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              Canvas.showPrintPreview(grid);
            }
          });
      buttonPanel.addMember(printButton);

      EmailGridButtonWidget email = new EmailGridButtonWidget(new Canvas[] {grid});
      email.setDefaultMessage(targetMessages.name_single() + "overzicht");
      email.setDefaultSubject(targetMessages.name_single() + "overzicht");
      email.setDefaultFrom(BrioRaceSystemApplicationPanel.getUserdetails().getEmail());
      buttonPanel.addMember(email);

      ExportButtonWidget exportButton = new ExportButtonWidget(grid, dataSource);
      buttonPanel.addMember(exportButton);

      buttonPanel.setHeight(30);

      this.addMember(buttonPanel);
      this.addMember(grid);

      handleRights();
    }
예제 #15
0
    public FieldsDialog() {

      super();
      setIsModal(true);
      setShowHeader(false);
      setShowEdges(true);
      setEdgeSize(2);
      setWidth(DIALOG_WIDTH);
      setHeight(DIALOG_HEIGHT);
      setAlign(Alignment.LEFT);

      Map<String, Integer> bodyDefaults = new HashMap<String, Integer>();
      bodyDefaults.put("layoutLeftMargin", 2);
      bodyDefaults.put("layoutTopMargin", 20);
      bodyDefaults.put("layoutButtonMargin", 2);
      setBodyDefaults(bodyDefaults);

      VLayout layout = new VLayout();
      layout.setOverflow(Overflow.HIDDEN);
      layout.setHeight100();
      layout.setWidth100();

      DynamicForm fieldForm = new DynamicForm();
      fieldForm.setTitleWidth(5);
      fieldForm.setAutoHeight();

      this.checkBoxFrom =
          new CheckboxItem(
              MessageListFields.FROM.name(), TextProvider.get().extended_search_panel_from());
      this.checkBoxTo =
          new CheckboxItem(
              MessageListFields.TO.name(), TextProvider.get().extended_search_panel_to());
      this.checkBoxCc =
          new CheckboxItem(
              MessageListFields.CC.name(), TextProvider.get().extended_search_panel_cc());
      this.checkBoxSubject =
          new CheckboxItem(
              MessageListFields.SUBJECT.name(), TextProvider.get().extended_search_panel_subject());
      this.checkBoxContent =
          new CheckboxItem(
              MessageListFields.CONTENT.name(), TextProvider.get().extended_search_panel_body());

      final IButton searchButton = new IButton(TextProvider.get().extended_search_panel_search());
      searchButton.setAutoFit(true);
      searchButton.setAlign(Alignment.CENTER);
      searchButton.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {

              searchFields = getFields();
              hide();
              fireSearchEvent();
            }
          });

      fieldForm.setItems(
          this.checkBoxFrom,
          this.checkBoxTo,
          this.checkBoxCc,
          this.checkBoxSubject,
          this.checkBoxContent);

      layout.setMembers(fieldForm, searchButton);
      setMembers(layout);

      addMouseOutHandler(
          new MouseOutHandler() {

            public void onMouseOut(MouseOutEvent event) {

              FieldsDialog dialog = (FieldsDialog) event.getSource();

              // Workaround because the mouse out handler doesn't work
              // correctly
              if ((event.getX() < dialog.getAbsoluteLeft()
                      || event.getX() > (dialog.getAbsoluteLeft() + dialog.getWidth() - 5))
                  || (event.getY() < dialog.getAbsoluteTop()
                      || event.getY() > (dialog.getAbsoluteTop() + dialog.getHeight() - 10))) {
                hide();
              }
            }
          });
    }
  public DlgSortOrderOrgs(TabOrganization tabOrganization, Record records[]) {
    try {
      this.tabOrganization = tabOrganization;
      setTitle(CallCenter.constants.sortOrgs());

      setHeight(710);
      setWidth(1000);
      setShowMinimizeButton(false);
      setIsModal(true);
      setShowModalMask(true);
      setCanDrag(false);
      setCanDragReposition(false);
      setCanDragResize(false);
      setCanDragScroll(false);
      centerInPage();

      hLayout = new VLayout(5);
      hLayout.setWidth100();
      hLayout.setHeight100();
      hLayout.setPadding(10);

      //			ToolStrip toolStrip = new ToolStrip();
      //			toolStrip.setWidth100();
      //			toolStrip.setPadding(5);
      //			hLayout.addMember(toolStrip);
      //
      //			upBtn = new ToolStripButton(CallCenter.constants.sortUp(),
      //					"sortUp.png");
      //			upBtn.setLayoutAlign(Alignment.LEFT);
      //			upBtn.setWidth(50);
      //			toolStrip.addButton(upBtn);
      //
      //			downBtn = new ToolStripButton(CallCenter.constants.sortDown(),
      //					"sortDown.png");
      //			downBtn.setLayoutAlign(Alignment.LEFT);
      //			downBtn.setWidth(50);
      //			toolStrip.addButton(downBtn);

      listGrid =
          new ListGrid() {
            protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
              ListGridRecord countryRecord = (ListGridRecord) record;
              if (countryRecord == null) {
                return super.getCellCSSText(record, rowNum, colNum);
              }
              Integer deleted = countryRecord.getAttributeAsInt("deleted");
              if (deleted != null && !deleted.equals(0)) {
                return "color:red;";
              } else {
                Integer statuse = countryRecord.getAttributeAsInt("statuse");
                switch (statuse) {
                  case 1: // not functions
                    return "color:pink;";
                  case 2: // disabled
                    return "text-decoration:line-through;";
                  default:
                    return super.getCellCSSText(record, rowNum, colNum);
                }
              }
            };
          };
      listGrid.setWidth100();
      listGrid.setHeight(625);
      listGrid.setCanReorderRecords(true);
      listGrid.setCanAcceptDroppedRecords(true);
      listGrid.setAutoSaveEdits(false);
      listGrid.setCanSelectAll(false);
      listGrid.setData(records);

      ListGridField nameField = new ListGridField("org_name", CallCenter.constants.orgName(), 400);

      ListGridField identcode =
          new ListGridField("identcode", CallCenter.constants.identCode(), 150);

      ListGridField director = new ListGridField("director", CallCenter.constants.director(), 150);

      ListGridField real_address =
          new ListGridField("real_address", CallCenter.constants.orgAddress(), 230);

      identcode.setAlign(Alignment.CENTER);
      director.setAlign(Alignment.CENTER);
      real_address.setAlign(Alignment.LEFT);

      listGrid.setFields(nameField, identcode, director, real_address);

      hLayout.addMember(listGrid);

      HLayout hLayoutItem = new HLayout(5);
      hLayoutItem.setWidth100();
      hLayoutItem.setAlign(Alignment.RIGHT);

      IButton saveItem = new IButton();
      saveItem.setTitle(CallCenter.constants.save());
      saveItem.setWidth(100);

      IButton cancItem = new IButton();
      cancItem.setTitle(CallCenter.constants.close());
      cancItem.setWidth(100);

      hLayoutItem.setMembers(saveItem, cancItem);

      hLayout.addMember(hLayoutItem);

      cancItem.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              destroy();
            }
          });
      saveItem.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              save();
            }
          });

      addItem(hLayout);
    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
예제 #17
0
  public TabCalendar() {
    try {
      setTitle(CallCenter.constants.menuCalendar());
      setCanClose(true);

      datasource = DataSource.get("CalSecDS");

      mainLayout = new VLayout(5);
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.setMargin(5);

      searchForm = new DynamicForm();
      searchForm.setAutoFocus(true);
      searchForm.setWidth(780);
      searchForm.setTitleWidth(300);
      searchForm.setNumCols(4);
      mainLayout.addMember(searchForm);

      calendarStateItem = new ComboBoxItem();
      calendarStateItem.setTitle(CallCenter.constants.type());
      calendarStateItem.setWidth(300);
      calendarStateItem.setName("calendar_state_id");
      calendarStateItem.setValueMap(ClientMapUtil.getInstance().getCalendarStates());
      calendarStateItem.setAddUnknownValues(false);

      secCalendarTypeItem = new ComboBoxItem();
      secCalendarTypeItem.setTitle(CallCenter.constants.moonPhase());
      secCalendarTypeItem.setWidth(300);
      secCalendarTypeItem.setName("calendar_event_id");
      secCalendarTypeItem.setValueMap(ClientMapUtil.getInstance().getSecCalendarTypes());
      secCalendarTypeItem.setAddUnknownValues(false);

      calendarDayItem = new DateItem();
      calendarDayItem.setTitle(CallCenter.constants.date());
      calendarDayItem.setWidth(300);
      calendarDayItem.setValue(new Date());
      calendarDayItem.setName("calendar_day");
      calendarDayItem.setHint(CallCenter.constants.choose());

      descriptionItem = new TextItem();
      descriptionItem.setTitle(CallCenter.constants.description());
      descriptionItem.setName("calendar_description");
      descriptionItem.setWidth(300);

      commentItem = new TextItem();
      commentItem.setTitle(CallCenter.constants.comment());
      commentItem.setName("calendar_comment");
      commentItem.setWidth(300);

      byCalendarDayItem = new CheckboxItem();
      byCalendarDayItem.setTitle(CallCenter.constants.searchByDate());
      byCalendarDayItem.setWidth(300);
      byCalendarDayItem.setName("buCalDaySearch");
      byCalendarDayItem.setValue(false);

      searchForm.setFields(
          calendarStateItem,
          secCalendarTypeItem,
          descriptionItem,
          commentItem,
          byCalendarDayItem,
          calendarDayItem);

      HLayout buttonLayout = new HLayout(5);
      buttonLayout.setWidth(780);
      buttonLayout.setHeight(30);
      buttonLayout.setAlign(Alignment.RIGHT);

      clearButton = new IButton();
      clearButton.setTitle(CallCenter.constants.clear());

      findButton = new IButton();
      findButton.setTitle(CallCenter.constants.find());

      buttonLayout.setMembers(findButton, clearButton);
      mainLayout.addMember(buttonLayout);

      ToolStrip toolStrip = new ToolStrip();
      toolStrip.setWidth(780);
      toolStrip.setPadding(5);
      mainLayout.addMember(toolStrip);

      addBtn = new ToolStripButton(CallCenter.constants.add(), "addIcon.png");
      addBtn.setLayoutAlign(Alignment.LEFT);
      addBtn.setWidth(50);
      toolStrip.addButton(addBtn);

      editBtn = new ToolStripButton(CallCenter.constants.modify(), "editIcon.png");
      editBtn.setLayoutAlign(Alignment.LEFT);
      editBtn.setWidth(50);
      toolStrip.addButton(editBtn);

      disableBtn = new ToolStripButton(CallCenter.constants.disable(), "deleteIcon.png");
      disableBtn.setLayoutAlign(Alignment.LEFT);
      disableBtn.setWidth(50);
      toolStrip.addButton(disableBtn);

      activateBtn = new ToolStripButton(CallCenter.constants.enable(), "restoreIcon.gif");
      activateBtn.setLayoutAlign(Alignment.LEFT);
      activateBtn.setWidth(50);
      toolStrip.addButton(activateBtn);

      toolStrip.addSeparator();

      copyBtn = new ToolStripButton(CallCenter.constants.copy(), "copy.png");
      copyBtn.setLayoutAlign(Alignment.LEFT);
      copyBtn.setWidth(50);
      toolStrip.addButton(copyBtn);

      listGrid =
          new ListGrid() {
            protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
              ListGridRecord countryRecord = (ListGridRecord) record;
              if (countryRecord == null) {
                return super.getCellCSSText(record, rowNum, colNum);
              }
              Integer deleted = countryRecord.getAttributeAsInt("deleted");
              if (deleted != null && !deleted.equals(0)) {
                return "color:red;";
              } else {
                return super.getCellCSSText(record, rowNum, colNum);
              }
            };
          };

      listGrid.setWidth(780);
      listGrid.setHeight(260);
      listGrid.setAlternateRecordStyles(true);
      listGrid.setDataSource(datasource);
      listGrid.setAutoFetchData(false);
      listGrid.setShowFilterEditor(false);
      listGrid.setCanEdit(false);
      listGrid.setCanRemoveRecords(false);
      listGrid.setFetchOperation("searchAllSecularCalendars");
      listGrid.setShowRowNumbers(true);
      listGrid.setCanHover(true);
      listGrid.setShowHover(true);
      listGrid.setShowHoverComponents(true);

      datasource.getField("calendar_day").setTitle(CallCenter.constants.date());
      datasource.getField("event").setTitle(CallCenter.constants.moonPhase());
      datasource.getField("state").setTitle(CallCenter.constants.type());
      datasource.getField("sun_rise").setTitle(CallCenter.constants.order());
      datasource.getField("calendar_description").setTitle(CallCenter.constants.description());

      datasource.getField("calendar_comment").setTitle(CallCenter.constants.comment());
      datasource.getField("rec_date").setTitle(CallCenter.constants.recDate());
      datasource.getField("rec_user").setTitle(CallCenter.constants.recUser());
      datasource.getField("upd_date").setTitle(CallCenter.constants.updDate());
      datasource.getField("upd_user").setTitle(CallCenter.constants.updUser());

      ListGridField calendar_day =
          new ListGridField("calendar_day", CallCenter.constants.date(), 150);
      ListGridField event = new ListGridField("event", CallCenter.constants.moonPhase(), 150);
      ListGridField state = new ListGridField("state", CallCenter.constants.type(), 80);
      ListGridField sun_rise = new ListGridField("sun_rise", CallCenter.constants.sunRise(), 100);
      ListGridField calendar_description =
          new ListGridField("calendar_description", CallCenter.constants.description(), 250);

      calendar_day.setAlign(Alignment.LEFT);
      event.setAlign(Alignment.LEFT);
      state.setAlign(Alignment.CENTER);
      sun_rise.setAlign(Alignment.CENTER);

      listGrid.setFields(calendar_day, event, state, sun_rise, calendar_description);

      mainLayout.addMember(listGrid);
      findButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              search();
            }
          });
      clearButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              calendarStateItem.clearValue();
              secCalendarTypeItem.clearValue();
              calendarDayItem.clearValue();
              descriptionItem.clearValue();
              commentItem.clearValue();
            }
          });
      addBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, null, false);
              dlgEditSecCalendar.show();
            }
          });

      editBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, false);
              dlgEditSecCalendar.show();
            }
          });

      copyBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, true);
              dlgEditSecCalendar.show();
            }
          });

      disableBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              Integer deleted = listGridRecord.getAttributeAsInt("deleted");
              if (!deleted.equals(0)) {
                SC.say(CallCenter.constants.recordAlrDisabled());
                return;
              }
              final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id");
              SC.ask(
                  CallCenter.constants.askForDisable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        changeStatus(calendar_id, 1);
                      }
                    }
                  });
            }
          });
      activateBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              Integer deleted = listGridRecord.getAttributeAsInt("deleted");
              if (deleted.equals(0)) {
                SC.say(CallCenter.constants.recordAlrEnabled());
                return;
              }
              final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id");
              SC.ask(
                  CallCenter.constants.askForEnable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        changeStatus(calendar_id, 0);
                      }
                    }
                  });
            }
          });

      TabSet tabSet = new TabSet();
      tabSet.setWidth(780);
      Tab tabDetViewer = new Tab(CallCenter.constants.view());
      final DetailViewer detailViewer = new DetailViewer();
      detailViewer.setDataSource(datasource);
      detailViewer.setWidth(750);
      tabDetViewer.setPane(detailViewer);

      listGrid.addRecordClickHandler(
          new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
              detailViewer.viewSelectedData(listGrid);
            }
          });

      listGrid.addRecordDoubleClickHandler(
          new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, false);
              dlgEditSecCalendar.show();
            }
          });

      tabSet.setTabs(tabDetViewer);
      mainLayout.addMember(tabSet);
      setPane(mainLayout);
    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.getMessage().toString());
    }
  }
예제 #18
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout(15);

    layout.addMember(
        new Label(
            "This is a full-screen example - click the \"Show Example\" button to show fullscreen."));

    final IButton button = new IButton("Show Example");
    button.setWidth(140);
    button.setIcon("silk/layout_content.png");
    button.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Rectangle rect = button.getPageRect();
            final Canvas animateOutline = new Canvas();
            animateOutline.setBorder("2px solid black");
            animateOutline.setTop(rect.getTop());
            animateOutline.setLeft(rect.getLeft());
            animateOutline.setWidth(rect.getLeft());
            animateOutline.setHeight(rect.getHeight());

            animateOutline.show();
            animateOutline.animateRect(
                0,
                0,
                Page.getWidth(),
                Page.getHeight(),
                new AnimationCallback() {
                  public void execute(boolean earlyFinish) {
                    animateOutline.hide();
                    final FullScreenApplication appWindow = new FullScreenApplication();
                    appWindow.addCloseClickHandler(
                        new CloseClickHandler() {
                          public void onCloseClick(CloseClientEvent event) {
                            animateOutline.setRect(0, 0, Page.getWidth(), Page.getHeight());
                            animateOutline.show();
                            appWindow.destroy();
                            Rectangle targetRect = button.getPageRect();
                            animateOutline.animateRect(
                                targetRect.getLeft(),
                                targetRect.getTop(),
                                targetRect.getWidth(),
                                targetRect.getHeight(),
                                new AnimationCallback() {
                                  public void execute(boolean earlyFinish) {
                                    animateOutline.hide();
                                  }
                                },
                                500);
                          }
                        });
                    appWindow.show();
                  }
                },
                500);
          }
        });

    layout.addMember(button);

    return layout;
  }
예제 #19
0
  private void initExportButton() {
    setHeight(30);
    exportButton.setShowRollOver(false);
    exportButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/export_32.png");
    exportButton.setIconOrientation("right");

    final DynamicForm exportForm = new DynamicForm();
    exportForm.setNumCols(4);
    // exportForm.setWidth(300);

    SelectItem exportTypeItem = new SelectItem("exportType", "Exporteer als");
    //    exportTypeItem.setWidth(150);
    exportTypeItem.setDefaultToFirstOption(true);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put("ooxml", "XLSX (Excel2007+/OOXML)");
    valueMap.put("xls", "XLS (Excel97)");
    valueMap.put("csv", "CSV (Excel)");
    // valueMap.put("xml", "XML");
    // valueMap.put("json", "JSON");
    exportTypeItem.setValueMap(valueMap);

    BooleanItem showInWindowItem = new BooleanItem();
    showInWindowItem.setName("showInWindow");
    showInWindowItem.setTitle("Toon Export in nieuw venster");
    showInWindowItem.setAlign(Alignment.LEFT);

    exportForm.setFields(exportTypeItem, showInWindowItem);

    exportButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String exportAs = (String) exportForm.getField("exportType").getValue();
            FormItem item = exportForm.getField("showInWindow");
            boolean showInWindow = item.getValue() == null ? false : (Boolean) item.getValue();
            DSRequest dsRequestProperties = new DSRequest();

            // set all fields, also from joined models. If they don't appear in the DS.xml file,
            // they will be ignored. Adding foreign fields to ds.xml automatically makes them being
            // exported as well.
            // (just make sure the query does some joins correctly, as is normal!)
            String[] f = fields == null ? ds.getFieldNames() : fields;

            if (hideInvisibleFieldsFromExport) {
              f = ListGridUtil.getVisibleFields(grid);
            }

            dsRequestProperties.setExportFields(f);

            if (fetchOperation != null) {
              dsRequestProperties.setOperationId(fetchOperation);
            }

            if (criteria != null) {
              dsRequestProperties.setCriteria(criteria);
              dsRequestProperties.setTextMatchStyle(TextMatchStyle.EXACT);
            }

            if (exportAs.equals("json")) {
              // JSON exports are server-side only, so use the OperationBinding on the DataSource
              dsRequestProperties.setOperationId("customJSONExport");
              dsRequestProperties.setExportDisplay(
                  showInWindow ? ExportDisplay.WINDOW : ExportDisplay.DOWNLOAD);

              grid.exportData(dsRequestProperties);
            } else {
              // exportAs is either XML or CSV, which we can do with requestProperties
              dsRequestProperties.setExportAs(
                  (ExportFormat) EnumUtil.getEnum(ExportFormat.values(), exportAs));
              dsRequestProperties.setExportDisplay(
                  showInWindow ? ExportDisplay.WINDOW : ExportDisplay.DOWNLOAD);

              grid.exportData(dsRequestProperties);
            }
          }
        });
    addMember(exportButton);
    addMember(exportForm);
  }
예제 #20
0
  public SmsQueueWindow(final Integer smsInfoId, String sms, String name) {
    setTitle(TicketMaster.constants.sms_numbers());
    setWidth(600);
    setHeight(500);
    setIsModal(true);
    setShowModalMask(true);
    setShowMaximizeButton(true);
    setShowMinimizeButton(false);
    setShowCloseButton(true);
    setAutoDraw(true);
    centerInPage();

    VLayout vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();
    form = new DynamicForm();
    form.setPadding(15);
    form.setWidth100();
    form.setNumCols(2);
    smsField = new StaticTextItem("sms", TicketMaster.constants.sms_sms());
    smsField.setValue(sms);
    smsField.setTitleVAlign(VerticalAlignment.TOP);

    StaticTextItem nameField = new StaticTextItem("name", TicketMaster.constants.name());
    nameField.setValue(name);
    form.setFields(nameField, smsField);

    Criteria c = new Criteria();
    c.setAttribute("timestamp", new Date().getTime());
    c.setAttribute("sms_info_id", smsInfoId);

    grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setDataSource(DataSource.get("SMSBroadcastDS"));
    grid.setFetchOperation("getNumbers");
    grid.setCriteria(c);
    grid.setAutoFetchData(true);
    ListGridField sendDateField =
        new ListGridField("send_date", TicketMaster.constants.sms_sendDate(), 120);
    sendDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    ListGridField deliveryDateField =
        new ListGridField("delivery_date", TicketMaster.constants.sms_deliveryDate(), 120);
    deliveryDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    grid.setFields(
        new ListGridField("id", "ID", 60),
        new ListGridField("phone_number", TicketMaster.constants.sms_number()),
        new ListGridField("state", TicketMaster.constants.sms_state()),
        sendDateField,
        deliveryDateField);

    IButton exportBtn = new IButton(TicketMaster.constants.sms_export());
    exportBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            com.google.gwt.user.client.Window.open(
                "./SMSBroadcast/ExportNumbers?sms_info_id=" + smsInfoId, "_self", "");
          }
        });
    exportBtn.setIcon("excel.gif");

    HLayout bbar = new HLayout();
    bbar.setAlign(Alignment.RIGHT);
    bbar.setMembersMargin(5);
    bbar.setPadding(5);
    bbar.addMembers(exportBtn);
    vLayout.addMembers(form, grid, bbar);

    addItem(vLayout);
  }
예제 #21
0
  public CurrencyViewImpl() {

    Element eBasePrefix = DOM.getElementById("baseCurrencyPrefix");
    if (eBasePrefix == null) {
      throw new IllegalStateException("Base Currency Prefix div not found in hosted page");
    }
    baseCurrencyPrefix = eBasePrefix.getInnerText();

    Element eDocPrefix = DOM.getElementById("docCurrencyPrefix");
    if (eDocPrefix == null) {
      throw new IllegalStateException("Doc Currency Prefix div not found in hosted page");
    }
    docCurrencyPrefix = eDocPrefix.getInnerText();

    currencyGrid = new ListGrid();
    currencyGrid.setShowAllColumns(true);
    currencyGrid.setCanEdit(true);
    currencyGrid.setAutoFetchData(true);
    currencyGrid.setWidth100();
    currencyGrid.setHeight100();
    currencyGrid.setShowAllColumns(true);
    currencyGrid.setSelectionType(SelectionStyle.SINGLE);
    currencyGrid.setDataSource(CurrencyDataSource.getInstance());
    currencyGrid.setSortDirection(SortDirection.DESCENDING);
    currencyGrid.setSortField("dt");
    currencyGrid.setShowHeaderContextMenu(false);
    currencyGrid.setCanAutoFitFields(false);

    addRowButton = new IButton(constants.add());
    addRowButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {

            // Boolean isWindowInput = (Boolean)isWindowInputItem.getValue();
            // currencyGrid.startEditingNew();
            // currencyGrid.endEditing();
            Record firstRecord = currencyGrid.getRecordList().first();
            Record lastRecord = currencyGrid.getRecordList().last();

            Date firstDate = firstRecord.getAttributeAsDate("dt");
            Date lastDate = lastRecord.getAttributeAsDate("dt");
            Date nowDate = new Date();
            DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd.MM.yyyy");
            String firstDateStr = dateFormatter.format(firstDate);
            String lastDateStr = dateFormatter.format(lastDate);
            String nowDateStr = dateFormatter.format(nowDate);

            if (nowDateStr.equals(firstDateStr) || nowDateStr.equals(lastDateStr)) {
              SC.say(constants.warningCurrencyAlreadySet());
            } else {
              CurrencyRecord currencyRecord = new CurrencyRecord();
              currencyRecord.setDt(new Date());
              currencyRecord.setAttribute(
                  CurrencyRecord.IDENTITY_CURRENCY + baseCurrencyPrefix, 1.0);
              currencyRecord.setAttribute(
                  CurrencyRecord.IDENTITY_CURRENCY + docCurrencyPrefix, 1.0);
              currencyGrid.startEditingNew(currencyRecord);
            }
          }
        });

    editRowButton = new IButton(constants.editCurrency());
    editRowButton.setAutoFit(true);
    editRowButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            presenter.goTo(new CurrencyTypePlace(""));
          }
        });

    currencyGrid.addCellDoubleClickHandler(
        new CellDoubleClickHandler() {

          @Override
          public void onCellDoubleClick(CellDoubleClickEvent event) {
            if (currencyGrid.getFieldNum("remove") == event.getColNum()) {
              final ListGridRecord record = currencyGrid.getRecord(event.getRowNum());
              if (record != null) {
                SC.ask(
                    constants.askRemoveRecord(),
                    new BooleanCallback() {

                      @Override
                      public void execute(Boolean value) {
                        if (value) {
                          currencyGrid.removeData(record);
                        }
                      }
                    });
              }
            } else {
              Boolean isWindowInput = (Boolean) isWindowInputItem.getValue();
              if (isWindowInput) {
                String fieldName = currencyGrid.getFieldName(event.getColNum());
                Double exchange = null;
                try {
                  exchange = Double.parseDouble(event.getRecord().getAttribute(fieldName));
                } catch (Exception ex) {
                }
                if (fieldName != null
                    && exchange != null
                    && fieldName.startsWith(CurrencyRecord.IDENTITY_CURRENCY)) {
                  String name = fieldName.substring(1);
                  Currency currency = new Currency(name, exchange);
                  showCurrencyForm(event.getRowNum(), event.getColNum(), currency);
                }
              }
            }
          }
        });
    currencyGrid.addCellClickHandler(
        new CellClickHandler() {

          @Override
          public void onCellClick(CellClickEvent event) {

            if (currencyGrid.getFieldNum("remove") == event.getColNum()) {
              final ListGridRecord record = currencyGrid.getRecord(event.getRowNum());
              if (record != null) {
                SC.ask(
                    constants.askRemoveRecord(),
                    new BooleanCallback() {

                      @Override
                      public void execute(Boolean value) {
                        if (value) {
                          currencyGrid.removeData(record);
                        }
                      }
                    });
              }
            } else {
              Boolean isWindowInput = (Boolean) isWindowInputItem.getValue();
              if (isWindowInput) event.cancel();
            }
          }
        });

    DynamicForm form = new DynamicForm();
    isWindowInputItem = new CheckboxItem("output", constants.windowsInput());
    isWindowInputItem.setDefaultValue(false);
    isWindowInputItem.setAlign(Alignment.RIGHT);
    form.setItems(isWindowInputItem);
    form.setWidth("*");

    HLayout controlLayout = new HLayout();
    controlLayout.setMembers(addRowButton, editRowButton, form);

    addMember(currencyGrid);
    addMember(controlLayout);
  }
  private void build() {
    final VLayout layout = new VLayout();
    layout.setMargin(5);

    final VStack infraLayout = new VStack();
    infraLayout.setHeight(26);
    final Label infraLabel = new Label("Updating available Infrastructures and Policies");
    infraLabel.setIcon("loading.gif");
    infraLabel.setHeight(26);
    infraLabel.setAlign(Alignment.CENTER);
    infraLayout.addMember(infraLabel);

    final DynamicForm infraForm = new DynamicForm();
    infraForm.setEncoding(Encoding.MULTIPART);
    infraForm.setMethod(FormMethod.POST);
    infraForm.setAction(GWT.getModuleBaseURL() + "createnodesource");
    infraForm.setTarget("__hiddenFrame");

    infraLayout.addMember(infraForm);

    final Label label =
        new Label(
            "A Node Source is a combination of an Infrastructure, which defines how resources"
                + " will be acquired, and a Policy, that dictates when resources can be acquired.");
    label.setHeight(40);

    final HashMap<String, List<FormItem>> allForms = new HashMap<String, List<FormItem>>();

    controller.fetchSupportedInfrastructuresAndPolicies(
        new Runnable() {
          public void run() {

            infraSelect = new SelectItem("infra", "Infrastructure");
            infraSelect.setRequired(true);
            policySelect = new SelectItem("policy", "Policy");
            policySelect.setRequired(true);

            infraSelect.setWidth(300);
            policySelect.setWidth(300);

            HiddenItem name = new HiddenItem("nsName");
            HiddenItem callback = new HiddenItem("nsCallback");
            HiddenItem session = new HiddenItem("sessionId");

            ArrayList<FormItem> tmpAll = new ArrayList<FormItem>();
            tmpAll.add(name);
            tmpAll.add(callback);
            tmpAll.add(session);
            tmpAll.add(infraSelect);

            LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
            for (PluginDescriptor inf :
                controller.getModel().getSupportedInfrastructures().values()) {
              String shortName =
                  inf.getPluginName().substring(inf.getPluginName().lastIndexOf('.') + 1);
              values.put(inf.getPluginName(), shortName);

              List<Field> configurableFields = inf.getConfigurableFields();
              ArrayList<FormItem> forms = new ArrayList<FormItem>(configurableFields.size());
              for (Field f : configurableFields) {
                FormItem infra = null;
                if (f.isPassword()) {
                  infra = new PasswordItem(inf.getPluginName() + f.getName(), f.getName());
                } else if (f.isFile() || f.isCredential()) {
                  infra = new UploadItem(inf.getPluginName() + f.getName(), f.getName());
                  if (f.isCredential()) {
                    PickerIcon cred =
                        new PickerIcon(
                            new Picker(Images.instance.key_16().getSafeUri().asString()),
                            new FormItemClickHandler() {
                              @Override
                              public void onFormItemClick(FormItemIconClickEvent event) {
                                CredentialsWindow win = new CredentialsWindow();
                                win.show();
                              }
                            });
                    cred.setPrompt("Create a Credential file");
                    cred.setWidth(16);
                    cred.setHeight(16);
                    cred.setAttribute("hspace", 6);
                    infra.setIcons(cred);
                  }
                } else {
                  infra = new TextItem(inf.getPluginName() + f.getName(), f.getName());
                }
                infra.setValue(f.getValue());
                infra.setWidth(250);
                infra.setHint("<nobr>" + f.getDescription() + "</nobr>");
                forms.add(infra);
                tmpAll.add(infra);
              }
              allForms.put(inf.getPluginName(), forms);
            }
            infraSelect.setValueMap(values);

            tmpAll.add(new SpacerItem());
            values.clear();
            tmpAll.add(policySelect);
            for (PluginDescriptor inf : controller.getModel().getSupportedPolicies().values()) {
              String shortName =
                  inf.getPluginName().substring(inf.getPluginName().lastIndexOf('.') + 1);
              values.put(inf.getPluginName(), shortName);

              List<Field> configurableFields = inf.getConfigurableFields();
              ArrayList<FormItem> forms = new ArrayList<FormItem>(configurableFields.size());
              for (Field f : configurableFields) {
                FormItem pol = null;
                if (f.isPassword()) {
                  pol = new PasswordItem(inf.getPluginName() + f.getName(), f.getName());
                } else if (f.isFile() || f.isCredential()) {
                  pol = new UploadItem(inf.getPluginName() + f.getName(), f.getName());
                  if (f.isCredential()) {
                    PickerIcon cred =
                        new PickerIcon(
                            new Picker(Images.instance.key_16().getSafeUri().asString()),
                            new FormItemClickHandler() {
                              @Override
                              public void onFormItemClick(FormItemIconClickEvent event) {
                                CredentialsWindow win = new CredentialsWindow();
                                win.show();
                              }
                            });
                    cred.setPrompt("Create a Credential file");
                    cred.setWidth(16);
                    cred.setHeight(16);
                    cred.setAttribute("hspace", 6);
                    pol.setIcons(cred);
                  }
                } else {
                  pol = new TextItem(inf.getPluginName() + f.getName(), f.getName());
                }
                pol.setValue(f.getValue());
                pol.setWidth(250);
                pol.setHint("<nobr>" + f.getDescription() + "</nobr>");
                forms.add(pol);
                tmpAll.add(pol);
              }
              allForms.put(inf.getPluginName(), forms);
            }
            policySelect.setValueMap(values);

            infraSelectChanged =
                new Runnable() {
                  @Override
                  public void run() {
                    if (policySelect.getValueAsString() == null) {
                      return;
                    }

                    String nsName = infraSelect.getValueAsString();
                    if (oldInfra != null) {
                      for (FormItem f : allForms.get(oldInfra)) {
                        f.hide();
                      }
                    }
                    for (FormItem f : allForms.get(nsName)) {
                      f.show();
                    }

                    if (oldInfra == null) {
                      oldInfra = nsName;
                      policySelectChanged.run();
                    } else {
                      oldInfra = nsName;
                    }
                  }
                };

            policySelectChanged =
                new Runnable() {
                  @Override
                  public void run() {
                    if (infraSelect.getValueAsString() == null) {
                      return;
                    }

                    String policy = policySelect.getValueAsString();
                    if (oldPolicy != null) {
                      for (FormItem f : allForms.get(oldPolicy)) {
                        f.hide();
                      }
                    }
                    for (FormItem f : allForms.get(policy)) {
                      f.show();
                    }

                    if (oldPolicy == null) {
                      oldPolicy = policy;
                      infraSelectChanged.run();
                    } else {
                      oldPolicy = policy;
                    }
                  }
                };

            infraSelect.addChangedHandler(
                new ChangedHandler() {
                  public void onChanged(ChangedEvent event) {
                    infraSelectChanged.run();
                  }
                });

            policySelect.addChangedHandler(
                new ChangedHandler() {
                  public void onChanged(ChangedEvent event) {
                    policySelectChanged.run();
                  }
                });

            infraForm.setFields(tmpAll.toArray(new FormItem[tmpAll.size()]));
            infraLabel.hide();
            infraForm.show();

            for (List<FormItem> li : allForms.values()) {
              for (FormItem it : li) {
                it.hide();
              }
            }
          }
        },
        new Runnable() {
          @Override
          public void run() {
            window.hide();
          }
        });

    final TextItem nameItem = new TextItem("nsName", "Name");
    DynamicForm nameForm = new DynamicForm();
    nameForm.setFields(nameItem);

    HLayout buttons = new HLayout();

    buttons.setWidth100();
    buttons.setHeight(22);
    buttons.setMargin(5);
    buttons.setAlign(Alignment.RIGHT);
    buttons.setMembersMargin(5);

    final IButton okButton = new IButton("Ok");
    okButton.setIcon(Images.instance.ok_16().getSafeUri().asString());
    okButton.setShowDisabledIcon(false);
    final IButton cancelButton = new IButton("Cancel");
    cancelButton.setIcon(Images.instance.cancel_16().getSafeUri().asString());
    cancelButton.setShowDisabledIcon(false);

    okButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            infraForm.setValue("infra", infraSelect.getValueAsString());
            infraForm.setValue("nsName", nameItem.getValueAsString());
            infraForm.setValue("policy", policySelect.getValueAsString());
            infraForm.setValue("sessionId", LoginModel.getInstance().getSessionId());
            infraForm.setCanSubmit(true);

            /* this smartGWT form looks nice but cannot do callbacks ;
             * we register a native JS function to the document, send it to
             * the servlet so that it writes it back when returning
             * when the browser reads the return value and interprets it as JS,
             * the callback is called */
            infraForm.setValue(
                "nsCallback",
                JSUtil.register(
                    new JSUtil.JSCallback() {
                      public void execute(JavaScriptObject obj) {
                        JSONObject js = new JSONObject(obj);
                        if (js.containsKey("result")
                            && js.get("result").isBoolean().booleanValue()) {
                          window.hide();
                          LogModel.getInstance()
                              .logMessage(
                                  "Successfully created nodesource: "
                                      + nameItem.getValueAsString());
                        } else {
                          String msg;
                          if (js.get("errorMessage").isString() != null) {
                            msg = js.get("errorMessage").isString().stringValue();
                          } else {
                            msg = js.toString();
                          }
                          label.setContents(
                              "<span style='color:red'>Failed to create Node Source :<br>"
                                  + msg
                                  + "</span>");
                          LogModel.getInstance()
                              .logImportantMessage(
                                  "Failed to create nodesource "
                                      + nameItem.getValueAsString()
                                      + ": "
                                      + msg);
                          layout.scrollToTop();
                        }
                        infraLabel.hide();
                        infraForm.show();
                        okButton.setDisabled(false);
                        cancelButton.setDisabled(false);
                      }
                    }));
            infraForm.submitForm();

            cancelButton.setDisabled(true);
            okButton.setDisabled(true);

            infraLabel.setContents("Node Source creation requested...");
            infraLabel.show();
            infraForm.hide();
          }
        });
    cancelButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            window.hide();
          }
        });
    buttons.setMembers(okButton, cancelButton);

    VLayout scroll = new VLayout();
    scroll.setHeight100();
    scroll.setWidth100();
    scroll.setMembers(infraLayout);
    scroll.setOverflow(Overflow.AUTO);
    scroll.setBorder("1px solid #ddd");
    scroll.setBackgroundColor("#fafafa");

    layout.addMember(label);
    layout.addMember(nameForm);
    layout.addMember(scroll);
    layout.addMember(buttons);

    int winWidth = com.google.gwt.user.client.Window.getClientWidth() * 80 / 100;
    int winHeight = com.google.gwt.user.client.Window.getClientHeight() * 80 / 100;
    winWidth = Math.min(1000, winWidth);
    winHeight = Math.min(1000, winHeight);

    this.window = new Window();
    this.window.setTitle("Create Node Source");
    this.window.setShowMinimizeButton(false);
    this.window.setIsModal(true);
    this.window.setShowModalMask(true);
    this.window.addItem(layout);
    this.window.setWidth(winWidth);
    this.window.setHeight(winHeight);
    this.window.setCanDragResize(true);
    this.window.setCanDragReposition(true);
    this.window.centerInPage();
  }
  protected void initItem(int width, int height) {
    String legacyHtml = "";
    if (toolBar != null) {
      toolBar.removeFromParent();
    }
    if (textArea != null) {
      legacyHtml = textArea.getHTML();
      textArea.removeFromParent();
    }
    if (mainLayout != null) {
      removeItem(mainLayout);
      mainLayout.destroy();
    }
    textArea = new RichTextArea();
    toolBar = new RichTextToolbar(textArea, DisplayType.DETAILED);

    saveButton = new IButton(BLCMain.getMessageManager().getString("ok"));
    IButton cancelButton = new IButton(BLCMain.getMessageManager().getString("cancel"));
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });

    final HtmlEditingPresenter pp = HtmlEditingPresenter.getInstance();

    final HLayout buttonsLayout = new HLayout(10);
    buttonsLayout.setAlign(Alignment.CENTER);
    buttonsLayout.addMember(saveButton);
    buttonsLayout.addMember(cancelButton);
    buttonsLayout.setLayoutTopMargin(2);
    buttonsLayout.setLayoutBottomMargin(2);
    buttonsLayout.setWidth100();
    buttonsLayout.setHeight(25);

    mainLayout = new VLayout();
    mainLayout.setWidth100();
    mainLayout.setHeight100();

    toolBar.setHeight("60px");
    final VLayout toolbarLayout = new VLayout();
    toolbarLayout.setWidth100();
    toolbarLayout.setHeight(60);
    toolbarLayout.addMember(toolBar);

    int textHeight = height - 130;
    textArea.setHeight(textHeight + "px");
    textArea.setWidth(width + "px");
    final VLayout textAreaLayout = new VLayout();
    textAreaLayout.setWidth100();
    textAreaLayout.setHeight(textHeight);
    textAreaLayout.addMember(textArea);

    mainLayout.addMember(toolbarLayout);
    mainLayout.addMember(textAreaLayout);
    mainLayout.addMember(buttonsLayout);
    addItem(mainLayout);

    toolBar.addAssetHandler(
        new Command() {
          @Override
          public void execute() {
            pp.displayAssetSearchDialog(toolBar);
          }
        });

    textArea.setHTML(legacyHtml);

    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (richTextItem != null) {
              richTextItem.setValue(toolBar.getHTML());
              richTextItem.getForm().fireEvent(new ItemChangedEvent(richTextItem.getJsObj()));
            }
            hide();
          }
        });
  }
예제 #24
0
  private HLayout createSearchLayout() {
    HLayout searchLayout = new HLayout();

    searchLayout.setWidth100();
    searchLayout.setHeight(20);
    searchLayout.setMembersMargin(15);

    i_searchForm = new DynamicForm();
    i_searchForm.setWidth(250);
    i_searchForm.setHeight100();
    i_searchForm.setAlign(Alignment.LEFT);
    i_searchForm.setAutoFocus(true);

    i_searchTextItem = new TextItem();
    i_searchTextItem.setTitle("Search");
    i_searchTextItem.setWidth(200);
    i_searchTextItem.setHint(SEARCH_HINT);
    i_searchTextItem.setShowHintInField(true);
    i_searchTextItem.setCanFocus(true);
    i_searchTextItem.setSelectOnFocus(true);

    i_searchTextItem.addKeyUpHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            event.getKeyName();

            // ignore the arrow keys
            if (isValidSearchText()) {
              i_searchListGrid.getData(i_searchTextItem.getValueAsString());
              i_addButton.setDisabled(true);
            }
          }
        });

    i_searchForm.setFields(i_searchTextItem);

    // add button to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout buttonVlayout = new VLayout();
    buttonVlayout.setWidth(40);
    buttonVlayout.setAlign(VerticalAlignment.CENTER);
    buttonVlayout.setMargin(2);

    i_clearButton = new IButton(CLEAR_BUTTON_TITLE);
    i_clearButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            i_searchTextItem.setValue("");
            i_rowsRetrievedLabel.setContents("");
            i_searchListGrid.clearData();
            i_addButton.setDisabled(true);
          }
        });
    buttonVlayout.addMember(i_clearButton);

    // add Label to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout labelVlayout = new VLayout();
    labelVlayout.setWidth(100);
    labelVlayout.setAlign(VerticalAlignment.BOTTOM);
    labelVlayout.setMargin(2);

    i_rowsRetrievedLabel = new Label();
    i_rowsRetrievedLabel.setWrap(false);
    i_rowsRetrievedLabel.setWidth100();
    i_rowsRetrievedLabel.setHeight(23);

    labelVlayout.addMember(i_rowsRetrievedLabel);

    searchLayout.addMember(i_searchForm);
    searchLayout.addMember(buttonVlayout);
    searchLayout.addMember(labelVlayout);

    return searchLayout;
  }
  public DlgOrgInfoViewByPhone(String phone) {
    super();
    setWidth(600);
    setHeight(700);
    setTitle("ორგანიზაციები ნომრის მიხედვით");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setCanDrag(false);
    setCanDragReposition(false);
    setCanDragResize(false);
    setCanDragScroll(false);
    centerInPage();

    VLayout hLayout = new VLayout(5);
    hLayout.setWidth100();
    hLayout.setHeight100();

    DataSource dataSource = DataSource.get("OrgInfoByPhoneDS");
    dataSource.getField("org_name").setTitle("ორგანიზაციის დასახელება");
    dataSource.getField("note").setTitle("შენიშვნა");
    dataSource.getField("workinghours").setTitle("სამუშაო საათები");
    dataSource.getField("director").setTitle("დირექტორი");
    dataSource.getField("identcode").setTitle("საიდ. კოდი");
    dataSource.getField("founded").setTitle("დაარსდა");
    dataSource.getField("legaladdress").setTitle("მისამართი");
    dataSource.getField("mail").setTitle("ელ. ფოსტა");
    dataSource.getField("webaddress").setTitle("ვებ გვერდი");
    dataSource.getField("org_info").setTitle("ორგ. ინფორმაცია");
    dataSource.getField("contactperson").setTitle("საკონტაქტო პიროვნება");
    dataSource.getField("dayoffs").setTitle("დასვენების დღეები");
    dataSource.getField("legal_statuse").setTitle("სტატუსი");
    dataSource.getField("partnerbank").setTitle("პარტნიორი ბანკი");
    dataSource.getField("workpersoncountity").setTitle("თანამშრომლების რაოდენობა");
    dataSource.getField("upd_user").setTitle("ვინ განაახლა");
    dataSource.getField("upd_date").setTitle("როდის განახლდა");
    dataSource.getField("ind").setTitle("ინდექსი");
    dataSource.getField("org_name_eng").setTitle("ორგ. დასახელება(ინგლისურად)");
    dataSource.getField("new_identcode").setTitle("ახალი კოდი");

    ListGridField org_name = new ListGridField("org_name", "ორგანიზაციის დასახელება", 250);
    ListGridField director = new ListGridField("director", "დირექტორი", 150);
    ListGridField identcode = new ListGridField("identcode", "საიდ. კოდი", 120);

    final ListGrid orgGrid = new ListGrid();
    orgGrid.setWidth100();
    orgGrid.setHeight(100);
    orgGrid.setAlternateRecordStyles(true);
    orgGrid.setShowFilterEditor(false);
    orgGrid.setCanEdit(false);
    orgGrid.setCanRemoveRecords(false);
    orgGrid.setShowRowNumbers(true);
    orgGrid.setCanHover(true);
    orgGrid.setShowHover(true);
    orgGrid.setShowHoverComponents(true);

    orgGrid.setAutoFetchData(true);
    Criteria criteria = new Criteria();
    criteria.setAttribute("phone", phone);
    orgGrid.setCriteria(criteria);
    orgGrid.setDataSource(dataSource);
    orgGrid.setFetchOperation("getOrgInfoByPhoneForAbonent");
    orgGrid.setFields(org_name, director, identcode);

    final DetailViewer detailViewer = new DetailViewer();
    detailViewer.setCanSelectText(true);
    detailViewer.setHeight(520);
    detailViewer.setWidth100();
    detailViewer.setDataSource(dataSource);

    orgGrid.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            detailViewer.viewSelectedData(orgGrid);
          }
        });

    HLayout hLayoutItem = new HLayout(5);
    hLayoutItem.setWidth100();
    hLayoutItem.setAlign(Alignment.RIGHT);
    hLayoutItem.setMargin(10);

    IButton cancItem = new IButton();
    cancItem.setTitle("დახურვა");
    cancItem.setWidth(100);

    hLayoutItem.setMembers(cancItem);
    hLayout.setMembers(orgGrid, detailViewer, hLayoutItem);
    addItem(hLayout);

    cancItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            destroy();
          }
        });
  }
예제 #26
0
파일: ProxyPanel.java 프로젝트: genievn/LD
  public ProxyPanel(GUIParameter[] parameters) {
    setWidth100();
    setMembersMargin(10);
    setMargin(30);
    setHeight(400);

    TabSet tabs = new TabSet();
    tabs.setWidth(380);
    tabs.setHeight(250);
    Tab tab = new Tab();
    tab.setTitle(I18N.message("proxy"));
    tabs.setTabs(tab);

    DynamicForm proxySettingsForm = new DynamicForm();
    proxySettingsForm.setWidth(300);
    proxySettingsForm.setColWidths(1, "*");
    proxySettingsForm.setValuesManager(vm);
    proxySettingsForm.setTitleOrientation(TitleOrientation.LEFT);

    List<FormItem> items = new ArrayList<FormItem>();

    for (GUIParameter f : parameters) {
      if (f.getName().equals("password")) {
        PasswordItem item = ItemFactory.newPasswordItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else if (f.getName().equals("port")) {
        IntegerItem item =
            ItemFactory.newValidateIntegerItem(
                f.getName(), f.getName(), Integer.parseInt(f.getValue()), 1, null);
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else {
        TextItem item = ItemFactory.newTextItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      }
    }

    proxySettingsForm.setItems(items.toArray(new FormItem[0]));

    IButton save = new IButton();
    save.setTitle(I18N.message("save"));
    save.addClickHandler(
        new ClickHandler() {
          @SuppressWarnings("unchecked")
          public void onClick(ClickEvent event) {
            Map<String, Object> values = (Map<String, Object>) vm.getValues();

            if (vm.validate()) {
              List<GUIParameter> proxySettings = new ArrayList<GUIParameter>();
              for (String name : values.keySet()) {
                GUIParameter proxyParam = new GUIParameter(name, values.get(name).toString());
                proxySettings.add(proxyParam);
              }

              service.saveProxySettings(
                  Session.get().getSid(),
                  proxySettings.toArray(new GUIParameter[0]),
                  new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                      Log.serverError(caught);
                    }

                    @Override
                    public void onSuccess(Void result) {
                      Log.info(I18N.message("settingssaved"), null);
                    }
                  });
            }
          }
        });

    tab.setPane(proxySettingsForm);
    setMembers(tabs, save);
  }
예제 #27
0
  public Layout getWindowLayout() {
    setWidth(500);
    setHeight(500);
    setTitle("Register");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setAutoCenter(true);
    setDismissOnOutsideClick(true);
    setShowShadow(true);
    setShadowOffset(0);
    setShadowSoftness(10);

    addCloseClickHandler(
        new CloseClickHandler() {
          public void onCloseClick(CloseClientEvent event) {
            destroy();
          }
        });

    Img profileImg =
        new Img(
            member.getProfilePic(),
            100,
            ImageUtil.getScaledImageHeight(member.getProfilePic(), 100));
    profileImg.setImageType(ImageStyle.STRETCH);

    HeaderItem header = new HeaderItem();
    header.setDefaultValue("Registration");
    emailItem.setValue(member.getEmail());
    emailItem.setRequired(true);
    firstNameItem.setValue(member.getFirstname());
    firstNameItem.setRequired(true);
    lastNameItem.setValue(member.getLastname());
    lastNameItem.setRequired(true);
    AWSSecretItem.setValue(member.getAWSSecretKey());
    AWSAccessItem.setValue(member.getAWSAccessKey());

    form.setFields(header, emailItem, firstNameItem, lastNameItem, AWSSecretItem, AWSAccessItem);
    form.setAutoFocus(true);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);
    buttons.setAlign(Alignment.CENTER);

    IButton cancelButton = new IButton("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            destroy();
            // com.google.gwt.user.client.Window.Location.assign(GWT.getHostPageBaseURL());
          }
        });
    saveButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            final LoginServiceAsync loginService = GWT.create(LoginService.class);
            loginService.memberExists(
                emailItem.getValueAsString(),
                new AsyncCallback<Boolean>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    SC.say("Could not check if member already exists.");
                  }

                  @Override
                  public void onSuccess(Boolean result) {
                    emailItem.setValidators(new MemberExistsValidator(result));
                    if (form.validate()) {
                      member.setEmail(emailItem.getValueAsString());
                      member.setFirstname(firstNameItem.getValueAsString());
                      member.setLastname(lastNameItem.getValueAsString());
                      member.setAWSSecretKey(AWSSecretItem.getValueAsString());
                      member.setAWSAccessKey(AWSAccessItem.getValueAsString());

                      loginService.registerMember(
                          member,
                          new AsyncCallback<Member>() {

                            @Override
                            public void onSuccess(Member result) {
                              if (member != null) {
                                destroy();
                                com.google.gwt.user.client.Window.Location.assign(
                                    GWT.getHostPageBaseURL());
                              } else SC.warn("Email address already in use!");
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                              if (caught instanceof MemberExistsException)
                                SC.warn("Email address already in use!");
                              else SC.warn("Something went wrong!");
                            }
                          });
                    }
                  }
                });
          }
        });

    buttons.addMember(saveButton);
    buttons.addMember(cancelButton);

    VLayout windowLayout = new VLayout();
    windowLayout.setMargin(10);
    windowLayout.setMembersMargin(15);
    windowLayout.addMember(profileImg);
    windowLayout.addMember(form);
    windowLayout.addMember(buttons);

    return windowLayout;
  }
예제 #28
0
  private RegistrationWindow() {
    super();

    final DynamicForm form = new DynamicForm();
    form.setWidth("100%");

    uName = new TextItem();
    uName.setName("Username");
    uName.setTitle("Username");
    uName.setWidth("100%");

    password1 = new PasswordItem();
    password1.setName("Password1");
    password1.setTitle("Enter Password");
    password1.setWidth("100%");
    password2 = new PasswordItem();
    password2.setName("Password2");
    password2.setTitle("Confirm Password");
    password2.setWidth("100%");
    name = new TextItem();
    name.setName("Name");
    name.setTitle("Name");
    name.setWidth("100%");

    surName = new TextItem();
    surName.setName("Surname");
    surName.setTitle("Surname");
    surName.setWidth("100%");
    email = new TextItem();
    email.setName("Email");
    email.setTitle("Email");
    email.setWidth("100%");

    final IButton buttonItem = new IButton();
    final IButton cancelItem = new IButton();
    cancelItem.setTitle("Cancel");
    cancelItem.setWidth("100%");
    cancelItem.setAlign(Alignment.CENTER);
    cancelItem.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            RegistrationWindow.getInstance().hide();
          }
        });
    buttonItem.setTitle("Register");
    buttonItem.setWidth("100%");
    buttonItem.setAlign(Alignment.CENTER);
    buttonItem.addClickHandler(new MyHandler());

    form.setFields(uName, password1, password2, name, surName, email);

    HLayout layout = new HLayout();
    layout.addMember(buttonItem);
    layout.addMember(cancelItem);
    layout.setAlign(Alignment.CENTER);
    setWidth(360);
    setHeight(250);
    setTitle("Contact Details");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    centerInPage();
    addCloseClickHandler(
        new CloseClickHandler() {

          @Override
          public void onCloseClick(CloseClientEvent event) {

            instance.hide();
          }
        });

    addItem(form);
    addItem(layout);
    draw();
  }
  public Canvas getSearchCanvas() {
    final VLayout mainLayout = new VLayout(20);
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.setPadding(5);

    Label titleBar = new Label(MESSAGES.geometricSearchWidgetFreeDrawingSearchTitle());
    titleBar.setBackgroundColor("#E0E9FF");
    titleBar.setWidth100();
    titleBar.setHeight(20);
    titleBar.setPadding(5);

    HLayout geomsButtonBar = new HLayout();
    geomsButtonBar.setWidth100();
    geomsButtonBar.setAutoHeight();
    geomsButtonBar.setMembersMargin(10);
    HLayout actionsButtonBar = new HLayout();
    actionsButtonBar.setWidth100();
    actionsButtonBar.setAutoHeight();
    actionsButtonBar.setMembersMargin(10);

    btnPoint = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPoint());
    btnPoint.setIcon(WidgetLayout.iconPointCreate);
    btnPoint.setWidth(
        btnPoint.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPoint.setActionType(SelectionType.RADIO);
    btnPoint.setRadioGroup("drawType");
    btnPoint.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPoint();
          }
        });

    btnLine = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingLine());
    btnLine.setIcon(WidgetLayout.iconLineCreate);
    btnLine.setWidth(
        btnLine.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnLine.setActionType(SelectionType.RADIO);
    btnLine.setRadioGroup("drawType");
    btnLine.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawLine();
          }
        });

    btnPolygon = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPolygon());
    btnPolygon.setIcon(WidgetLayout.iconPolygonCreate);
    btnPolygon.setWidth(
        btnPolygon.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPolygon.setActionType(SelectionType.RADIO);
    btnPolygon.setRadioGroup("drawType");
    btnPolygon.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPolygon();
          }
        });

    btnUndo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingUndo());
    btnUndo.setIcon(WidgetLayout.iconUndo);
    btnUndo.setWidth(
        btnUndo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnUndo.setDisabled(true);
    btnUndo.setShowDisabledIcon(false);
    btnUndo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onUndo();
          }
        });

    btnRedo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingRedo());
    btnRedo.setIcon(WidgetLayout.iconRedo);
    btnRedo.setWidth(
        btnRedo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnRedo.setDisabled(true);
    btnRedo.setShowDisabledIcon(false);
    btnRedo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onRedo();
          }
        });

    frmBuffer = new DynamicForm();
    frmBuffer.setWidth100();
    spiBuffer = new SpinnerItem();
    spiBuffer.setTitle(MESSAGES.geometricSearchWidgetBufferLabel());
    spiBuffer.setDefaultValue(5);
    spiBuffer.setMin(0);
    spiBuffer.setWidth(60);
    spiBuffer.addChangedHandler(
        new ChangedHandler() {
          public void onChanged(ChangedEvent event) {
            updateView();
          }
        });
    frmBuffer.setFields(spiBuffer);

    // ----------------------------------------------------------

    geomsButtonBar.addMember(btnPoint);
    geomsButtonBar.addMember(btnLine);
    geomsButtonBar.addMember(btnPolygon);

    actionsButtonBar.addMember(btnUndo);
    actionsButtonBar.addMember(btnRedo);

    mainLayout.addMember(titleBar);
    mainLayout.addMember(geomsButtonBar);
    mainLayout.addMember(actionsButtonBar);
    mainLayout.addMember(frmBuffer);

    return mainLayout;
  }
예제 #30
0
  public TabFindAbonent() {
    setTitle(CallCenter.constants.findAbonent());
    setCanClose(true);

    datasource = DataSource.get("AbonentsDS");

    mainLayout = new VLayout(5);
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.setMargin(5);

    searchForm = new DynamicForm();
    searchForm.setAutoFocus(true);
    searchForm.setWidth(750);
    searchForm.setNumCols(3);
    searchForm.setTitleOrientation(TitleOrientation.TOP);
    mainLayout.addMember(searchForm);

    firstNameItem = new TextItem();
    firstNameItem.setTitle(CallCenter.constants.name());
    firstNameItem.setWidth(250);
    firstNameItem.setName("firstNameItem");

    lastNameItem = new TextItem();
    lastNameItem.setTitle(CallCenter.constants.lastName());
    lastNameItem.setWidth(250);
    lastNameItem.setName("lastNameItem");

    phoneItem = new TextItem();
    phoneItem.setTitle(CallCenter.constants.phone());
    phoneItem.setWidth(250);
    phoneItem.setName("phone");

    streetItem = new TextItem();
    streetItem.setTitle(CallCenter.constants.street());
    streetItem.setName("street_name_geo");
    streetItem.setWidth(250);

    citiesItem = new ComboBoxItem();
    citiesItem.setTitle(CallCenter.constants.city());
    citiesItem.setName("city_name_geo");
    citiesItem.setWidth(250);
    citiesItem.setFetchMissingValues(true);
    citiesItem.setFilterLocally(false);
    citiesItem.setAddUnknownValues(false);

    DataSource cityDS = DataSource.get("CityDS");
    citiesItem.setOptionOperationId("searchCitiesFromDBForCombos");
    citiesItem.setOptionDataSource(cityDS);
    citiesItem.setValueField("city_id");
    citiesItem.setDisplayField("city_name_geo");

    citiesItem.setOptionCriteria(new Criteria());
    citiesItem.setAutoFetchData(false);

    citiesItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = citiesItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("city_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("city_id", nullO);
              }
            }
          }
        });

    regionItem = new ComboBoxItem();
    regionItem.setTitle(CallCenter.constants.cityRegion());
    regionItem.setName("city_region_name_geo");
    regionItem.setWidth(250);
    regionItem.setFetchMissingValues(true);
    regionItem.setFilterLocally(false);
    regionItem.setAddUnknownValues(false);

    DataSource streetsDS = DataSource.get("CityRegionDS");
    regionItem.setOptionOperationId("searchCityRegsFromDBForCombos");
    regionItem.setOptionDataSource(streetsDS);
    regionItem.setValueField("city_region_id");
    regionItem.setDisplayField("city_region_name_geo");

    Criteria criteria = new Criterion();
    regionItem.setOptionCriteria(criteria);
    regionItem.setAutoFetchData(false);

    regionItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = regionItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("city_region_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("city_region_id", nullO);
              }
            }
          }
        });

    searchForm.setFields(
        lastNameItem, firstNameItem, phoneItem, streetItem, citiesItem, regionItem);

    HLayout buttonLayout = new HLayout(5);
    buttonLayout.setWidth(750);
    buttonLayout.setHeight(30);
    buttonLayout.setAlign(Alignment.RIGHT);

    clearButton = new IButton();
    clearButton.setTitle(CallCenter.constants.clear());

    findButton = new IButton();
    findButton.setTitle(CallCenter.constants.find());

    buttonLayout.setMembers(findButton, clearButton);
    mainLayout.addMember(buttonLayout);

    listGrid =
        new ListGrid() {
          protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
            ListGridRecord countryRecord = (ListGridRecord) record;
            if (countryRecord == null) {
              return super.getCellCSSText(record, rowNum, colNum);
            }
            Integer deleted = countryRecord.getAttributeAsInt("deleted");
            if (deleted != null && !deleted.equals(0)) {
              return "color:red;";
            } else {
              return super.getCellCSSText(record, rowNum, colNum);
            }
          };
        };

    listGrid.setWidth(1000);
    listGrid.setHeight100();
    listGrid.setAlternateRecordStyles(true);
    listGrid.setDataSource(datasource);
    listGrid.setAutoFetchData(false);
    listGrid.setShowFilterEditor(false);
    listGrid.setCanEdit(false);
    listGrid.setCanRemoveRecords(false);
    listGrid.setFetchOperation("customSearchForCC");
    listGrid.setCanSort(false);
    listGrid.setCanResizeFields(false);
    listGrid.setCanSelectText(true);
    listGrid.setCanDragSelectText(true);
    listGrid.setShowFilterEditor(true);
    listGrid.setFilterOnKeypress(true);

    ListGridField firstname = new ListGridField("firstname", CallCenter.constants.name(), 120);
    firstname.setCanFilter(true);

    ListGridField lastname = new ListGridField("lastname", CallCenter.constants.lastName(), 150);
    lastname.setCanFilter(true);

    ListGridField city = new ListGridField("city", CallCenter.constants.city(), 140);
    city.setCanFilter(false);

    ListGridField address = new ListGridField("address", CallCenter.constants.address());
    address.setCanFilter(true);

    ListGridField phone = new ListGridField("phone", CallCenter.constants.phone(), 100);
    phone.setCanFilter(true);

    firstname.setAlign(Alignment.LEFT);
    lastname.setAlign(Alignment.LEFT);
    city.setAlign(Alignment.LEFT);
    address.setAlign(Alignment.LEFT);
    phone.setAlign(Alignment.CENTER);

    listGrid.setFields(lastname, firstname, city, address, phone);
    mainLayout.addMember(listGrid);

    clearButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            firstNameItem.clearValue();
            lastNameItem.clearValue();
            phoneItem.clearValue();
            streetItem.clearValue();
            citiesItem.clearValue();
            regionItem.clearValue();
          }
        });

    findButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            search();
          }
        });

    citiesItem.addChangedHandler(
        new ChangedHandler() {
          @Override
          public void onChanged(ChangedEvent event) {
            String value = citiesItem.getValueAsString();
            if (value == null) {
              return;
            }
            regionItem.clearValue();
            fillCityRegionCombo(new Integer(value));
          }
        });

    firstNameItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });
    lastNameItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });
    phoneItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });
    streetItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });

    listGrid.addRecordDoubleClickHandler(
        new RecordDoubleClickHandler() {
          @Override
          public void onRecordDoubleClick(RecordDoubleClickEvent event) {
            DlgViewAbonent dlgViewAbonent =
                new DlgViewAbonent(listGrid, datasource, listGrid.getSelectedRecord());
            dlgViewAbonent.show();
          }
        });

    setPane(mainLayout);
  }