コード例 #1
0
  public LayerSettingsForm() {

    // 		setWidth100();
    setColWidths("125", "*");

    name = new TextItem();
    name.setTitle(MESSAGES.layerSettingsLayerName());
    name.setWidth(250);
    name.setRequired(true);

    publicLayer = new CheckboxItem();
    publicLayer.setTitle(MESSAGES.layerSettingsPublic());
    publicLayer.setTooltip(MESSAGES.layerSettingsPublicTooltip());

    active = new CheckboxItem();
    active.setTitle(MESSAGES.layerSettingsActive());
    active.setTooltip(MESSAGES.layerSettingsActiveTooltip());

    visible = new CheckboxItem();
    visible.setTitle(MESSAGES.layerSettingsVisibleByDefault());
    visible.setTooltip(MESSAGES.layerSettingsVisibleByDefaultTooltip());

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

    setFields(name, publicLayer, active, visible);
  }
コード例 #2
0
  public SearchForm(DataSource userDS) {

    setDataSource(userDS);
    setTop(20);
    setCellPadding(6);
    setNumCols(7);
    setStyleName("defaultBorder");

    findUser = new ButtonItem("Find");
    findUser.setIcon("silk/find.png");
    findUser.setWidth(70);
    findUser.setEndRow(false);

    TextItem searchWord = new TextItem("searchWord", "Search Word");
    searchWord.setEndRow(false);
    searchWord.addKeyPressHandler(
        new KeyPressHandler() {

          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              findUser.fireEvent(new ClickEvent(null));
            }
          }
        });

    searchCondition = new ComboBoxItem("searchCondition", "Select");
    LinkedHashMap<String, String> data = new LinkedHashMap<String, String>();
    data.put("userId", "User ID");
    data.put("userName", "User Name");
    searchCondition.setValueMap(data);
    searchCondition.setValue("userId");

    setItems(findUser, searchCondition, searchWord);
  }
コード例 #3
0
  private void fillFields() {
    try {
      DataSource countryDS = DataSource.get("CountryDS");
      countryItem.setOptionOperationId("searchAllCountriesForCombos");
      countryItem.setOptionDataSource(countryDS);
      countryItem.setValueField("country_id");
      countryItem.setDisplayField("country_name");
      Criteria criteria = new Criteria();
      countryItem.setOptionCriteria(criteria);
      countryItem.setAutoFetchData(false);
      if (lCityRecord != null) {
        countryItem.setValue(lCityRecord.getAttribute("country_id"));
      } else {
        countryItem.setValue(Constants.defCountryGeorgiaId);
      }

      if (lCityRecord == null) {
        isCapitalItem.setValue("0");
        return;
      }

      townTypeItem.setValue(lCityRecord.getAttribute("town_type_id"));
      cityNameGeoItem.setValue(lCityRecord.getAttribute("town_name"));
      cityCodeItem.setValue(lCityRecord.getAttribute("town_code"));
      cityNewCodeItem.setValue(lCityRecord.getAttribute("town_new_code"));
      isCapitalItem.setValue(lCityRecord.getAttribute("capital_town"));
      ofGmtItem.setValue(lCityRecord.getAttribute("normal_gmt"));
      ofGmtWinterItem.setValue(lCityRecord.getAttribute("winter_gmt"));

    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
コード例 #4
0
  private void search() {
    try {
      String firstname = firstNameItem.getValueAsString();
      String lastname = lastNameItem.getValueAsString();
      String phone = phoneItem.getValueAsString();
      String street_id_str = streetItem.getValueAsString();
      String city_id_str = citiesItem.getValueAsString();
      String city_region_id_str = regionItem.getValueAsString();

      if ((firstname == null || firstname.trim().equals(""))
          && (lastname == null || lastname.trim().equals(""))
          && (phone == null || phone.trim().equals(""))
          && (street_id_str == null || street_id_str.trim().equals(""))) {
        SC.say(CallCenter.constants.warning(), CallCenter.constants.enterAbonentSearchParam());
        return;
      }
      Criteria criteria = new Criteria();
      if (firstname != null && !firstname.trim().equals("")) {
        criteria.setAttribute("firstname_param", firstname);
      }
      if (lastname != null && !lastname.trim().equals("")) {
        criteria.setAttribute("lastname_param", lastname);
      }
      if (phone != null && !phone.trim().equals("")) {
        criteria.setAttribute("phone_param", phone);
      }
      if (street_id_str != null && !street_id_str.trim().equals("")) {
        String tmp = street_id_str.trim();
        String arrStr[] = tmp.split(" ");
        int i = 1;
        for (String string : arrStr) {
          String item = string.trim();
          criteria.setAttribute("street_name_geo_param" + i, item);
          i++;
        }
      }
      if (city_id_str != null && !city_id_str.trim().equals("")) {
        criteria.setAttribute("city_id", new Integer(city_id_str));
      }
      if (city_region_id_str != null && !city_region_id_str.trim().equals("")) {
        criteria.setAttribute("city_region_id", new Integer(city_region_id_str));
      }
      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "customSearchForCC");
      listGrid.invalidateCache();
      listGrid.fetchData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);

    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
コード例 #5
0
  public EventViewerWindow() {
    super();

    setTitle(AppMessages.EVENT_VIEWER_LABEL);
    setShortcutIcon(AppImages.EVENT_DETAIL_SHORTCUT);
    setHeaderIcon(AppImages.EVENT_DETAIL_ICON);

    stack = new SectionStack();
    stack.setVisibilityMode(VisibilityMode.MULTIPLE);

    SectionStackSection findSection = new SectionStackSection("Find");
    findSection.setExpanded(true);

    final DynamicForm form = new SearchForm();
    form.setNumCols(7);
    form.setHeight(35);
    form.setTop(15);
    form.setCellPadding(10);

    TextItem actIdItem = new TextItem();
    actIdItem.setTitle("Activity ID");
    TextItem contextItem = new TextItem();
    contextItem.setTitle("Context");
    ButtonItem findBtn = new ButtonItem("Search");
    findBtn.setStartRow(false);
    findBtn.setIcon(AppImages.SEARCH_ICON);
    findBtn.setWidth("125px");

    form.setFields(actIdItem, contextItem, findBtn);
    findSection.addItem(form);

    SectionStackSection resultSection = new SectionStackSection("Activities");
    resultSection.setExpanded(true);

    grid = new ListGrid();
    grid.setShowAllRecords(true);
    grid.setHeight(300);

    ListGridField actId = new ListGridField("activityId", "ID", 40);
    ListGridField actDate = new ListGridField("activityDate", "Date", 150);
    ListGridField actCtx = new ListGridField("activityContext", "Context", 220);
    ListGridField actDesc = new ListGridField("activityDescription", "Description");

    grid.setFields(actId, actCtx, actDesc, actDate);
    grid.setData(getData());

    resultSection.addItem(grid);

    SectionStackSection detailSection = new SectionStackSection("Activity Detail");
    detailSection.setExpanded(true);

    stack.addSection(findSection);
    stack.addSection(resultSection);
    stack.addSection(detailSection);

    this.addItem(stack);
  }
コード例 #6
0
 private void setDefaultNameIfNeeded() {
   if (!StringUtils.hasText(nameItem.getValue()) && selection.size() == 1) {
     // Cast is valid because selection predicate supplied to TreeOptions
     // precludes non TropixObjectTreeItems
     final TropixObjectLocation selectionItem =
         (TropixObjectLocation) Iterables.getOnlyElement(selection);
     nameItem.setValue(selectionItem.getObject().getName());
   }
 }
コード例 #7
0
ファイル: PZoneChange.java プロジェクト: ditogam/gwt-docflow
 private void setNewZone(int region, int subregion) {
   String mask = "";
   String value = "" + region + (((subregion < 10) ? "0" : "") + "" + subregion);
   for (int i = 0; i < CHARCOUNT; i++) {
     mask += "#";
     if (i > 2) value += "0";
   }
   tiNewZone.setMask(mask);
   tiNewZone.setValue(value);
 }
コード例 #8
0
  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());
                  }
                });
          }
        });
  }
コード例 #9
0
ファイル: PZoneChange.java プロジェクト: ditogam/gwt-docflow
  protected void saveData() {

    long zoneId = 0;
    try {
      if (tiNewZone.getValue().toString().length() != CHARCOUNT) throw new Exception();
      zoneId = Long.parseLong(tiNewZone.getValue().toString());
    } catch (Exception e) {
      SC.say(
          "Please enter normal new Zone",
          new BooleanCallback() {

            @Override
            public void execute(Boolean value) {
              tiNewZone.focusInItem();
              tiNewZone.selectValue();
            }
          });
      return;
    }
    if (getItemValue((SelectItem) addrComp.getSiSubregion()) == 0) {
      SC.say("Please enter normal new Sub Region");
      return;
    }
    Record[] recs = lgZoneCustomers.getRecords();
    if (recs == null || recs.length == 0) {
      SC.say("Please add some data!!!");
      return;
    }
    int customerIds[] = new int[recs.length];
    for (int i = 0; i < customerIds.length; i++) {
      customerIds[i] = recs[i].getAttributeAsInt("cusid");
    }
    SplashDialog.showSplash();
    DocFlow.docFlowService.changeZoneToCustomers(
        customerIds,
        zoneId,
        new AsyncCallback<Void>() {

          @Override
          public void onFailure(Throwable caught) {
            SplashDialog.hideSplash();
            SC.say(caught.toString());
          }

          @Override
          public void onSuccess(Void result) {
            search();
            lgZoneCustomers.selectAllRecords();
            lgZoneCustomers.removeSelectedData();
            SplashDialog.hideSplash();
          }
        });
  }
コード例 #10
0
ファイル: Setup.java プロジェクト: genievn/LD
  /** Prepares the SMTP form */
  private Tab setupSmtp(final ValuesManager vm) {
    // Prepare the SMTP connection tab
    Tab smtpTab = new Tab();
    smtpTab.setTitle(I18N.message("smtpserver"));
    final DynamicForm smtpForm = new DynamicForm();
    smtpForm.setDisabled(true);
    smtpForm.setID("smtpForm");
    smtpForm.setTitleOrientation(TitleOrientation.TOP);
    smtpForm.setValuesManager(vm);
    smtpTab.setPane(smtpForm);

    TextItem smtpHost = ItemFactory.newTextItem(SMTP_HOST, "host", null);
    smtpHost.setValue("localhost");
    smtpHost.setWrapTitle(false);

    IntegerItem smtpPort = ItemFactory.newIntegerItem(SMTP_PORT, "port", null);
    smtpPort.setValue(25);
    smtpPort.setWrapTitle(false);

    TextItem smtpUsername = ItemFactory.newTextItem(SMTP_USERNAME, "username", null);
    smtpUsername.setWrapTitle(false);

    PasswordItem smtpPassword = new PasswordItem();
    smtpPassword.setTitle(I18N.message("password"));
    smtpPassword.setName(SMTP_PASSWORD);
    smtpPassword.setWrapTitle(false);

    BooleanItem smtpSecureAuth = new BooleanItem();
    smtpSecureAuth.setTitle(I18N.message("secureauth"));
    smtpSecureAuth.setName(SMTP_SECURE_AUTH);
    smtpSecureAuth.setWrapTitle(false);
    smtpSecureAuth.setDefaultValue(false);

    SelectItem smtpConnectionSecurity = new SelectItem();
    smtpConnectionSecurity.setTitle(I18N.message("connectionsecurity"));
    smtpConnectionSecurity.setName("smtpConnectionSecurity");
    smtpConnectionSecurity.setDefaultValue(Constants.SMTP_SECURITY_NONE);
    smtpConnectionSecurity.setWrapTitle(false);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put(Constants.SMTP_SECURITY_NONE, I18N.message("none"));
    valueMap.put(Constants.SMTP_SECURITY_SSL, I18N.message("ssl"));
    valueMap.put(Constants.SMTP_SECURITY_TLS, I18N.message("tls"));
    valueMap.put(Constants.SMTP_SECURITY_TLS_IF_AVAILABLE, I18N.message("tlsavailable"));
    smtpConnectionSecurity.setValueMap(valueMap);

    TextItem smtpSender = ItemFactory.newEmailItem(SMTP_SENDER, "sender", false);
    smtpSender.setWrapTitle(false);
    smtpSender.setValue("*****@*****.**");

    smtpForm.setFields(
        smtpHost,
        smtpPort,
        smtpUsername,
        smtpPassword,
        smtpSender,
        smtpConnectionSecurity,
        smtpSecureAuth);
    return smtpTab;
  }
コード例 #11
0
  public LaunchFormLayout(String title, String icon, final String description) {

    super("600", "*");
    addTitle(title, icon);

    Label docLabel =
        WidgetUtil.getLabel(
            "Documentation and Terms of Use", CoreConstants.ICON_INFORMATION, 30, Cursor.HAND);
    docLabel.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            new DocumentationLayout(event.getX(), event.getY(), description).show();
          }
        });
    this.addMember(docLabel);

    simulationNameItem = FieldUtil.getTextItem(400, "[0-9A-Za-z-_ ]");
    simulationNameItem.setValidators(ValidatorUtil.getStringValidator());
    addField("Simulation Name", simulationNameItem);

    sourcesLayout = new VLayout(5);
    sourcesLayout.setAutoHeight();
    this.addMember(sourcesLayout);
  }
コード例 #12
0
 public LayerModelDto getLayerModel() {
   layerModel.setActive(active.getValueAsBoolean());
   layerModel.setDefaultVisible(visible.getValueAsBoolean());
   layerModel.setName(name.getValueAsString());
   layerModel.setPublic(publicLayer.getValueAsBoolean());
   return layerModel;
 }
コード例 #13
0
 public void setLayerModel(LayerModelDto model) {
   this.layerModel = model;
   name.setValue(model.getName());
   publicLayer.setValue(model.isPublic());
   active.setValue(model.isActive());
   visible.setValue(model.isDefaultVisible());
 }
コード例 #14
0
 public DynamicLayerConfiguration getData() {
   layerConfig.getClientLayerInfo().setLabel(name.getValueAsString());
   layerConfig.getClientLayerInfo().setVisible(visible.getValueAsBoolean());
   extraLayerInfo.setPublic(publicLayer.getValueAsBoolean());
   extraLayerInfo.setActive(active.getValueAsBoolean());
   return layerConfig;
 }
コード例 #15
0
  /**
   * Get content for bookmark popup
   *
   * @return
   */
  private HLayout getPopupContent() {
    HLayout hlayout = new HLayout();
    hlayout.setWidth100();
    hlayout.setHeight100();
    DynamicForm form = new DynamicForm();
    form.setHeight100();
    form.setWidth(260);
    form.setTitleWidth(100);
    bookmarkTitle = new TextItem();
    bookmarkTitle.setTitle("Title");
    if (!view.getSettings().inSingleEndpointMode()) {
      includeEndpoint = new CheckboxItem();
      includeEndpoint.setTitle("Include endpoint");
      includeEndpoint.setLabelAsTitle(true);
      form.setItems(bookmarkTitle, includeEndpoint);
    } else {
      form.setItems(bookmarkTitle);
    }

    Button bookmarkButton = new Button("Bookmark");
    bookmarkButton.setHeight100();
    bookmarkButton.setWidth(60);
    bookmarkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Bookmark bookmark = new Bookmark();
            if (includeEndpoint != null && includeEndpoint.getValueAsBoolean()) {
              bookmark.setEndpoint(view.getSelectedTabSettings().getEndpoint());
            }
            bookmark.setQuery(view.getSelectedTabSettings().getQueryString());
            bookmark.setTitle(bookmarkTitle.getValueAsString());

            window.clear();
            setSrc(Imgs.get(Imgs.LOADING));
            view.getRemoteService()
                .addBookmark(
                    bookmark,
                    new AsyncCallback<Void>() {
                      public void onFailure(Throwable caught) {
                        setSrc(Imgs.get(Imgs.BOOKMARK_QUERY));
                        if (caught instanceof OpenIdException) {
                          view.getElements().onError(caught.getMessage() + ". Logging out");
                          view.getOpenId().logOut();
                        } else {
                          view.getElements().onError(caught);
                        }
                      }

                      @Override
                      public void onSuccess(Void result) {
                        setSrc(Imgs.get(Imgs.BOOKMARK_QUERY));
                      }
                    });
          }
        });
    hlayout.addMembers(form, Helper.getHSpacer(), bookmarkButton);
    return hlayout;
  }
コード例 #16
0
 public void setData(DynamicLayerConfiguration layerConfig) {
   this.layerConfig = layerConfig;
   this.extraLayerInfo =
       (DeskmanagerClientLayerInfo) layerConfig.getClientLayerInfo().getUserData();
   name.setValue(layerConfig.getClientLayerInfo().getLabel());
   publicLayer.setValue(extraLayerInfo.isPublic());
   active.setValue(extraLayerInfo.isActive());
   visible.setValue(layerConfig.getClientLayerInfo().isVisible());
 }
コード例 #17
0
  private void search() {
    try {

      String calendar_state_id = calendarStateItem.getValueAsString();
      Criteria criteria = new Criteria();
      if (calendar_state_id != null && !calendar_state_id.trim().equals("")) {
        criteria.setAttribute("calendar_state_id", new Integer(calendar_state_id));
      }
      String calendar_event_id = secCalendarTypeItem.getValueAsString();
      if (calendar_event_id != null && !calendar_event_id.trim().equals("")) {
        criteria.setAttribute("calendar_event_id", new Integer(calendar_event_id));
      }
      boolean checkedDate = byCalendarDayItem.getValueAsBoolean();
      if (checkedDate) {
        Date calendar_day = calendarDayItem.getValueAsDate();
        if (calendar_day != null) {
          criteria.setAttribute("calendar_day", calendar_day);
        }
      }
      String calendar_description = descriptionItem.getValueAsString();
      if (calendar_description != null && !calendar_description.trim().equals("")) {
        criteria.setAttribute("calendar_description", calendar_description);
      }
      String calendar_comment = commentItem.getValueAsString();
      if (calendar_comment != null && !calendar_comment.trim().equals("")) {
        criteria.setAttribute("calendar_comment", calendar_comment);
      }

      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "searchAllSecularCalendars");
      listGrid.invalidateCache();
      listGrid.filterData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
コード例 #18
0
ファイル: Setup.java プロジェクト: genievn/LD
  /** Prepares the repository form */
  private Tab setupRepository(final ValuesManager vm) {
    // Prepare the tab used to configure the repository where documents and
    // other data will be stored
    Tab repositoryTab = new Tab();
    repositoryTab.setTitle(I18N.message("repository"));

    final DynamicForm repositoryForm = new DynamicForm();
    repositoryForm.setID("repositoryForm");
    repositoryForm.setValuesManager(vm);
    TextItem repositoryItem = ItemFactory.newTextItem(REPOSITORY_FOLDER, "repofolder", null);
    repositoryItem.setWidth(200);
    repositoryItem.setRequired(true);
    repositoryItem.setWrapTitle(false);
    repositoryItem.setDefaultValue(getDefaultFolder());
    repositoryForm.setFields(repositoryItem);
    repositoryForm.setDisabled(true);

    repositoryTab.setPane(repositoryForm);
    return repositoryTab;
  }
コード例 #19
0
  @Override
  protected List<FormItem> createFormItems(EnhancedDynamicForm form) {
    List<FormItem> items = new ArrayList<FormItem>();

    TextItem nameItem = new TextItem(BundleGroupsDataSource.FIELD_NAME);
    nameItem.setShowTitle(true);
    nameItem.setSelectOnFocus(true);
    nameItem.setTabIndex(1);
    nameItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE, true);
    items.add(nameItem);

    TextItem descriptionItem = new TextItem(BundleGroupsDataSource.FIELD_DESCRIPTION);
    descriptionItem.setShowTitle(true);
    descriptionItem.setTabIndex(5);
    descriptionItem.setColSpan(form.getNumCols());
    descriptionItem.setAttribute(EnhancedDynamicForm.OUTPUT_AS_HTML_ATTRIBUTE, true);
    items.add(descriptionItem);

    return items;
  }
コード例 #20
0
  private void search() {
    try {
      Criteria criteria = new Criteria();
      String billing_company_name = billingCompNameItem.getValueAsString();
      criteria.setAttribute("billing_company_name", billing_company_name);

      String phoneIndex = phoneIndexItem.getValueAsString();

      if (phoneIndex != null && !phoneIndex.equals("")) {

        try {
          new Long(phoneIndex);
        } catch (Exception e) {
          SC.say(CallCenterBK.constants.invalidPhone());
          return;
        }

        criteria.setAttribute("phoneIndex", new Integer(phoneIndex));
      }

      String has_calculation_str = hasCalcItem.getValueAsString();
      if (has_calculation_str != null && !has_calculation_str.equals("-1")) {
        criteria.setAttribute("has_calculation", Integer.parseInt(has_calculation_str));
      }
      Integer operator_src = Integer.parseInt(operatorItem.getValueAsString());
      criteria.setAttribute("operator_src", operator_src);

      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "searchAllBillingComps");
      billingCompsGrid.invalidateCache();
      billingCompsGrid.filterData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
コード例 #21
0
  /** @return */
  public boolean validate() {

    boolean valid = simulationNameItem.validate();
    for (Canvas canvas : sourcesLayout.getMembers()) {
      if (canvas instanceof AbstractSourceLayout) {
        AbstractSourceLayout source = (AbstractSourceLayout) canvas;
        if (!source.validate()) {
          valid = false;
        }
      }
    }
    return valid;
  }
コード例 #22
0
  /**
   * A valid search text would be different than the previous search text.
   *
   * @return
   */
  public boolean isValidSearchText() {

    String currentText = i_searchTextItem.getValueAsString();
    currentText = currentText == null ? "" : currentText;

    boolean isValid = !i_previousText.equals(currentText);

    if (isValid) {
      i_previousText = currentText;
    }

    return isValid;
  }
コード例 #23
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);
  }
コード例 #24
0
ファイル: PZoneChange.java プロジェクト: ditogam/gwt-docflow
 protected void newZoneKeyPressed(KeyPressEvent event) {
   int[] selection = tiNewZone.getSelectionRange();
   if (selection[0] > selection[1]) {
     int tmp = selection[0];
     selection[0] = selection[1];
     selection[1] = tmp;
   }
   event.cancel();
   for (int i = 0; i < restrictedEdits.length; i++) {
     if (restrictedEdits[i] >= selection[0] && restrictedEdits[i] <= selection[1]) {
       tiNewZone.setSelectionRange(selection[0] + 1, selection[0] + 1);
       return;
     }
   }
   if (selection[0] >= CHARCOUNT) return;
   char c = (char) event.getCharacterValue().intValue();
   String value = event.getItem().getValue().toString();
   char[] cr = value.toCharArray();
   cr[selection[0]] = c;
   value = new String(cr);
   tiNewZone.setValue(value);
   tiNewZone.setSelectionRange(selection[0] + 1, selection[0] + 1);
 }
コード例 #25
0
  /**
   * Update the rows retrieved label based on the search results.
   *
   * @param dc
   */
  private void updateRowsRetrieved(DataClass[] dc) {
    if (dc.length >= 1) {

      String numEntries = dc[0].getAttribute("numEntries");
      String complete = dc[0].getAttribute("complete");

      if (complete != null && !complete.equals("COMPLETE")) {
        i_rowsRetrievedLabel.setContents(ROWS_RETRIEVED_TITLE + "<b> " + numEntries + "</b>+");
      } else {
        i_rowsRetrievedLabel.setContents(ROWS_RETRIEVED_TITLE + " <b>" + numEntries + "</b>");
      }

      String searchText = i_searchTextItem.getValueAsString();
      if (searchText == null || searchText.length() == 0) {
        i_rowsRetrievedLabel.setContents("");
      }
    } else {
      i_rowsRetrievedLabel.setContents(ROWS_RETRIEVED_TITLE + " <b>0</b>");
    }
  }
コード例 #26
0
ファイル: Setup.java プロジェクト: genievn/LD
  /** Prepares the registration form */
  private Tab setupRegistration(final ValuesManager vm) {
    Tab registrationTab = new Tab();
    registrationTab.setTitle(I18N.message("registration"));

    TextItem regName = ItemFactory.newTextItem(REG_NAME, "name", null);
    regName.setWrapTitle(false);

    TextItem regOrganization = ItemFactory.newTextItem(REG_ORGANIZATION, "organization", null);
    regOrganization.setWrapTitle(false);

    TextItem regWebsite = ItemFactory.newTextItem(REG_WEBSITE, "website", null);
    regWebsite.setWrapTitle(false);

    TextItem regEmail = ItemFactory.newEmailItem(REG_EMAIL, "email", false);
    regEmail.setWrapTitle(false);

    final DynamicForm regForm = new DynamicForm();
    regForm.setID("regForm");
    regForm.setValuesManager(vm);
    regForm.setFields(regName, regEmail, regOrganization, regWebsite);

    registrationTab.setPane(regForm);
    return registrationTab;
  }
コード例 #27
0
  private Tab fullTextSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchFullTextTab = new Tab();
    searchFullTextTab.setTitle("Full Text Search");
    final DynamicForm searchFullTextForm = new DynamicForm();
    searchFullTextForm.setID("searchFullTextForm");
    searchFullTextForm.setNumCols(3);
    searchFullTxt.setName("searchFullTxt");
    searchFullTxt.setTitle("Full Text Search");
    searchFullTxt.setWidth(250);
    searchFullTxt.setRequired(true);
    //		RegExpValidator regExpValidator = new RegExpValidator();
    //		regExpValidator.setExpression("^[\\w\\d\\_\\.]{1,}$");
    //		searchFullTxt.setValidateOnChange(true);
    //		searchFullTxt.setValidators(regExpValidator);
    SubmitItem searchFullTextSubmitItem = new SubmitItem("searchFullTextSubmitItem");
    searchFullTextSubmitItem.setTitle("Search");
    searchFullTextSubmitItem.setWidth(100);
    class SearchFullTextSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchFullTextSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchFullTextForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.fullTextSearch(
              searchFullTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchFullTextForm.addSubmitValuesHandler(
        new SearchFullTextSubmitValuesHandler(jackrabbitExplorer));
    searchFullTextForm.setSaveOnEnter(true);
    searchFullTxt.setStartRow(true);
    searchFullTxt.setEndRow(false);
    searchFullTextSubmitItem.setStartRow(false);
    searchFullTextSubmitItem.setEndRow(true);
    searchFullTextForm.setItems(searchFullTxt, searchFullTextSubmitItem);
    searchFullTextTab.setPane(searchFullTextForm);
    return searchFullTextTab;
  }
コード例 #28
0
  public UserDetailTabPane(DataSource userDS, final ItemListGrid userListGrid) {

    this.userListGrid = userListGrid;
    setStyleName("defaultBorder");

    userViewer = new DetailViewer();
    userViewer.setDataSource(userDS);
    userViewer.setWidth100();
    userViewer.setMargin(25);
    userViewer.setEmptyMessage("Select an user to view its details");

    editorLabel = new Label();
    editorLabel.setWidth100();
    editorLabel.setHeight100();
    editorLabel.setAlign(Alignment.CENTER);
    editorLabel.setContents("Select an user to edit, or insert a new user into");

    insertLabel = new Label();
    insertLabel.setWidth100();
    insertLabel.setHeight100();
    insertLabel.setAlign(Alignment.CENTER);
    insertLabel.setContents("Insert a new user into");

    // update form
    editorForm = new DynamicForm();
    editorForm.setWidth(650);
    editorForm.setMargin(25);
    editorForm.setNumCols(4);
    editorForm.setCellPadding(5);
    editorForm.setAutoFocus(false);
    editorForm.setDataSource(userDS);
    editorForm.setUseAllDataSourceFields(true);

    userId = new StaticTextItem("userId", "User ID");
    userName = new TextItem("userName", "User Name");
    password = new PasswordItem("password", "Password");
    enabled = new CheckboxItem("enabled", "Enabled");

    userName.setRequired(true);
    password.setRequired(true);

    ButtonItem saveButton = new ButtonItem("saveUser", "Update user info.");
    saveButton.setAlign(Alignment.CENTER);
    saveButton.setWidth(100);
    saveButton.setColSpan(4);
    saveButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            // editorForm.saveData();

            if (userId.getValue() == null) {
              return;
            }

            if (!editorForm.validate(false)) {
              return;
            }
            User user = new User();

            user.setUserId((String) userId.getValue());
            user.setUserName(userName.getValueAsString());
            user.setPassword(password.getValueAsString());
            user.setEnabled(enabled.getValueAsBoolean());

            userService.updateUser(
                user,
                new AsyncCallback<Void>() {
                  public void onFailure(Throwable caught) {
                    SC.say("Error", "Server side error occured. Contact your administrator.");
                  }

                  public void onSuccess(Void noAnswer) {
                    SC.say("Updated", "User info. is updated.");

                    userListGrid.invalidateCache();
                  }
                });
          }
        });

    editorForm.setFields(userId, userName, password, enabled, saveButton);
    editorForm.setColWidths(100, 200, 100, 200);

    // insert form
    insertForm = new DynamicForm();
    insertForm.setWidth(650);
    insertForm.setMargin(25);
    insertForm.setNumCols(4);
    insertForm.setCellPadding(5);
    insertForm.setAutoFocus(false);
    insertForm.setDataSource(userDS);
    insertForm.setUseAllDataSourceFields(true);

    userId4add = new TextItem("userId", "User ID");
    userName4add = new TextItem("userName", "User Name");
    password4add = new PasswordItem("password", "Password");
    enabled4add = new CheckboxItem("enabled", "Enabled");

    enabled4add.setValue(true);
    userId4add.setRequired(true);
    userName4add.setRequired(true);
    password4add.setRequired(true);

    ButtonItem addButton = new ButtonItem("addUser", "Add user info.");
    addButton.setAlign(Alignment.CENTER);
    addButton.setWidth(100);
    addButton.setColSpan(4);
    addButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {

            if (!insertForm.validate(false)) {
              return;
            }

            User user = new User();

            user.setUserId(userId4add.getValueAsString());
            user.setUserName(userName4add.getValueAsString());
            user.setPassword(password4add.getValueAsString());
            user.setEnabled(enabled4add.getValueAsBoolean());

            userService.addUser(
                user,
                new AsyncCallback<Void>() {
                  public void onFailure(Throwable caught) {
                    SC.say("Error", "Server side error occured. Contact your administrator.");
                  }

                  public void onSuccess(Void noAnswer) {
                    SC.say("Added", "User info. is added.");

                    userListGrid.invalidateCache();
                    insertForm.clearValues();
                  }
                });
          }
        });

    insertForm.setFields(userId4add, userName4add, password4add, enabled4add, addButton);
    insertForm.setColWidths(100, 200, 100, 200);

    // tab
    Tab viewTab = new Tab("View");
    viewTab.setIcon("silk/application_form.png");
    viewTab.setWidth(70);
    viewTab.setPane(userViewer);

    Tab editTab = new Tab("Edit");
    editTab.setIcon("demoApp/icon_edit.png");
    editTab.setWidth(70);
    editTab.setPane(editorForm);

    Tab insertTab = new Tab("Add");
    insertTab.setIcon("demoApp/icon_add.png");
    insertTab.setWidth(70);
    insertTab.setPane(insertForm);

    setTabs(viewTab, editTab, insertTab);

    addTabSelectedHandler(
        new TabSelectedHandler() {
          public void onTabSelected(TabSelectedEvent event) {
            updateDetails();
          }
        });
  }
コード例 #29
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;
  }
コード例 #30
0
    private void init(final ListGridRecord sampleRecord, final boolean add) {
      final Form form = new Form(nameItem, mudpitItem, categoryItem);
      form.setWrapItemTitles(false);
      nameItem.setValue(sampleRecord.getAttributeAsString("Name"));
      nameItem.addChangedHandler(
          new ChangedHandler() {
            public void onChanged(final ChangedEvent event) {
              checkOk();
            }
          });
      mudpitItem.setValue(sampleRecord.getAttributeAsBoolean("Mudpit"));
      categoryItem.setValue(sampleRecord.getAttributeAsString("Category"));

      final Label label = new Label(CONSTANTS.scaffoldWizardSampleSearchLabel());
      label.setWidth100();
      label.setHeight(12);

      final TreeOptions treeOptions = new TreeOptions();
      treeOptions.setInitialItems(
          locationFactory.getTropixObjectSourceRootItems(TropixObjectTreeItemExpanders.get(types)));
      treeOptions.setShowPredicate(getShowItemPredicate());
      treeOptions.setSelectionPredicate(LocationPredicates.getTropixObjectNotFolderPredicate());
      treeOptions.setSelectionType(SelectionType.MULTIPlE);
      @SuppressWarnings("unchecked")
      final Collection<TreeItem> selectedItems =
          (Collection<TreeItem>) sampleRecord.getAttributeAsObject("Selection");
      treeOptions.setExpandIds(Locations.getAncestorIds(selectedItems));
      treeOptions.setSelectedItems(selectedItems);
      final TreeComponent tree = treeComponentFactory.get(treeOptions);
      tree.addMultiSelectionListener(this);
      final TreeGrid treeGrid = tree.get();
      treeGrid.setTooltip("Hold the control key to select multiple items.");
      final VLayout layout = new VLayout();
      layout.addMember(form);
      layout.addMember(label);
      layout.addMember(treeGrid);
      layout.setSize("500px", "500px");
      okButton =
          SmartUtils.getButton(
              add ? "Add" : "Update",
              null,
              new Command() {
                public void execute() {
                  sampleRecord.setAttribute("Name", (String) nameItem.getValue());
                  sampleRecord.setAttribute("Category", (String) categoryItem.getValue());
                  sampleRecord.setAttribute("Mudpit", (Boolean) mudpitItem.getValue());
                  sampleRecord.setAttribute("Selection", selection);
                  if (add) {
                    dataSource.addData(sampleRecord);
                    records.add(sampleRecord);
                  }
                  listGrid.markForRedraw();
                  get().markForDestroy();
                  checkValid();
                }
              });
      final Button cancelButton = SmartUtils.getCancelButton(this);
      final Layout opsLayout = new CanvasWithOpsLayout<VLayout>(layout, okButton, cancelButton);
      final Window window =
          PopOutWindowBuilder.titled((add ? "Add" : "Update") + " Sample")
              .withContents(opsLayout)
              .autoSized()
              .get();
      setWidget(window);
      checkOk();
      get().draw();
    }