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);
   }
 }
  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);
  }
  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;
  }
Exemple #4
0
  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 void reset() {
   geometries.clear();
   frmBuffer.reset();
   btnUndo.setDisabled(true);
   btnRedo.setDisabled(true);
   if (isDrawing()) {
     removeFreeDrawingController();
   }
 }
  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());
                  }
                });
          }
        });
  }
 private void onUndo() {
   if (geometries.size() > 0) {
     Geometry geom = geometries.remove(geometries.size() - 1);
     redoGeoms.add(geom);
     btnRedo.setDisabled(false);
     updateView();
   }
   if (geometries.size() == 0) {
     btnUndo.setDisabled(true);
   }
 }
  @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);
  }
  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;
  }
  @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;
  }
Exemple #11
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();
  }
  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();
            }
          });
  }
Exemple #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;
  }
Exemple #14
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);
 }
  private void addNewGeometry(Geometry geom) {
    if (drawController.getController() != null) {
      if (!geom.isEmpty() && geom.isValid() && !geometries.contains(geom)) {

        geometries.add(geom);
        if (geometries.size() == 1) {
          btnUndo.setDisabled(false);
        }
        updateView();
        removeFreeDrawingController();
      } else {
        SC.say(MESSAGES.geometricSearchWidgetFreeDrawingInvalidGeometry());
        removeFreeDrawingController();
      }
    } else {
      SC.say(MESSAGES.geometricSearchWidgetFreeDrawingNothingDrawn());
    }
  }
  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;
  }
 private void onDrawPolygon() {
   if (drawController.getController() != null) {
     btnPolygon.select();
   }
   startDrawing(new PolygonDrawController(mapWidget, drawController, this));
 }
 private void onDrawLine() {
   if (drawController.getController() != null) {
     btnLine.select();
   }
   startDrawing(new LineStringDrawController(mapWidget, drawController, this));
 }
 private void resetButtonState() {
   btnLine.deselect();
   btnPoint.deselect();
   btnPolygon.deselect();
 }
  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;
  }
    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 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();
    }
  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());
    }
  }
  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);
  }
  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;
  }
  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();
          }
        });
  }
Exemple #27
0
  private void onSubmit(final GUIInfo info) {
    vm.validate();
    Tab tab = tabs.getSelectedTab();
    int tabIndex = tabs.getSelectedTabNumber();
    DynamicForm form = (DynamicForm) tab.getPane();
    if (form.hasErrors()) {

    } else {
      if (step == 4) {
        if (!vm.validate()) SC.warn("invalidfields");

        SetupInfo data = new SetupInfo();
        data.setDbDriver(vm.getValueAsString(DB_DRIVER));
        data.setDbUrl(vm.getValueAsString(DB_URL));
        data.setDbUsername(vm.getValueAsString(DB_USERNAME));
        data.setDbPassword(vm.getValueAsString(DB_PASSWORD));
        data.setDbEngine(vm.getValueAsString(DB_ENGINE));
        data.setDbType(vm.getValueAsString(DB_TYPE));
        data.setLanguage(vm.getValueAsString(LANGUAGE));
        data.setSmtpHost(vm.getValueAsString(SMTP_HOST));
        data.setSmtpPort((Integer) vm.getValues().get(SMTP_PORT));
        data.setSmtpUsername(vm.getValueAsString(SMTP_USERNAME));
        data.setSmtpPassword(vm.getValueAsString(SMTP_PASSWORD));
        data.setSmtpSender(vm.getValueAsString(SMTP_SENDER));
        data.setSmtpSecureAuth((Boolean) vm.getValues().get(SMTP_SECURE_AUTH));
        data.setSmtpSecuryConntection(vm.getValueAsString(SMTP_SECURITY_CONNECTION));
        data.setRepositoryFolder(vm.getValueAsString(REPOSITORY_FOLDER));
        data.setDbDialect(engines.get(data.getDbEngine())[3]);
        data.setDbValidationQuery(engines.get(data.getDbEngine())[4]);
        data.setRegEmail(vm.getValueAsString(REG_EMAIL));
        data.setRegName(vm.getValueAsString(REG_NAME));
        data.setRegOrganization(vm.getValueAsString(REG_ORGANIZATION));
        data.setRegWebsite(vm.getValueAsString(REG_WEBSITE));
        if (data.getDbType().equals(I18N.message(INTERNAL))) {
          data.setDbEngine("Hsqldb");
          data.setDbDriver("org.hsqldb.jdbcDriver");
          data.setDbUrl(
              ("jdbc:hsqldb:" + data.getRepositoryFolder() + "/db/").replaceAll("//", "/"));
          data.setDbUsername("sa");
          data.setDbPassword("");
          data.setDbValidationQuery("SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS");
          data.setDbDialect("org.hibernate.dialect.HSQLDialect");
        }

        SetupServiceAsync setupService = (SetupServiceAsync) GWT.create(SetupService.class);
        setupService.setup(
            data,
            new AsyncCallback<Void>() {
              @Override
              public void onFailure(Throwable caught) {
                SC.warn(caught.getMessage());
                submit.setDisabled(false);
              }

              @Override
              public void onSuccess(Void arg) {
                SC.say(
                    I18N.message("installationperformed"),
                    I18N.message("installationend", info.getProductName()),
                    new BooleanCallback() {
                      @Override
                      public void execute(Boolean value) {
                        Util.redirect(Util.contextPath() + "frontend.jsp");
                      }
                    });
                submit.setDisabled(false);
              }
            });
        submit.setDisabled(true);

        // Clear an eventually saved documents list grid settings.
        Offline.put("doclist", "");
      } else {
        // Go to the next tab and enable the contained panel
        tabs.selectTab(tabIndex + 1);
        tabs.getSelectedTab().getPane().setDisabled(false);
        if (step < tabs.getSelectedTabNumber()) step++;
        if (step == 4) submit.setTitle(I18N.message("setup"));
      }
    }
  }
  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 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;
  }
  public PCAPanel(DatasetInformation datasetInfo) {
    this.setWidth("400px");
    this.setHeight("150px");
    this.setTitle("Principal component analysis");
    this.setShowMinimizeButton(false);
    this.setIsModal(false);
    this.centerInPage();
    this.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClickEvent event) {
            hide();
            destroy();
          }
        });

    VLayout vp = new VLayout();
    vp.setWidth100();
    vp.setHeight100();
    this.addItem(vp);

    HLayout hp1 = new HLayout();
    hp1.setWidth100();
    hp1.setHeight("20px");
    Label l1 = new Label("X AXES ");
    l1.setHeight("20px");
    l1.setWidth("100px");
    pcaI = new ListBox();
    pcaI.setWidth("200px");
    pcaI.setHeight("20px");
    pcaI.setTitle("X AXES");

    hp1.addMember(l1);
    hp1.addMember(pcaI);
    hp1.setMargin(5);

    vp.addMember(hp1);
    hp1.setAlign(Alignment.LEFT);

    HLayout hp2 = new HLayout();
    hp2.setWidth100();
    hp2.setHeight("20px");
    Label l2 = new Label("Y AXES ");
    l2.setHeight("20px");
    l2.setWidth("100px");

    pcaII = new ListBox();
    pcaII.setWidth("200px");
    pcaII.setHeight("20px");
    pcaII.setTitle("Y AXES");

    hp2.addMember(l2);
    hp2.addMember(pcaII);
    hp2.setMargin(5);

    vp.addMember(hp2);
    hp2.setAlign(Alignment.LEFT);

    if (datasetInfo != null) {
      for (String str : datasetInfo.getColsNames()) {
        pcaI.addItem(str);
        pcaII.addItem(str);
      }
      pcaI.setSelectedIndex(0);
      pcaII.setSelectedIndex(1);
    }
    okBtn = new IButton("Start Process");
    okBtn.setWidth("200px");
    okBtn.setAlign(Alignment.CENTER);
    okBtn.setShowRollOver(true);
    okBtn.setShowDown(true);
    okBtn.setTitleStyle("stretchTitle");

    HLayout btnLayout = new HLayout();
    btnLayout.setWidth100();
    btnLayout.setHeight("20px");
    btnLayout.addMember(okBtn);
    btnLayout.setAlign(Alignment.CENTER);

    vp.addMember(btnLayout);
    vp.setTop(20);
    vp.setMembersMargin(15);

    this.show();
  }