コード例 #1
0
ファイル: CCComboBoxField.java プロジェクト: johnstok/cms
  /**
   * Constructor.
   *
   * @param name The field's name.
   * @param title The field's title.
   * @param desc The field's description.
   * @param options The options that can be selected.
   */
  public CCComboBoxField(
      final String name, final String title, final String desc, final List<Option> options) {
    super(name);

    final ComboBox<BaseModelData> cb = new ComboBox<BaseModelData>();
    cb.setTriggerAction(TriggerAction.ALL);
    cb.setFieldLabel(createLabel(name, title));
    cb.setToolTip(createTooltip(name, title, desc));
    cb.setDisplayField("title");
    cb.setValueField("value");
    cb.setEditable(false);

    final ListStore<BaseModelData> store = new ListStore<BaseModelData>();
    for (final Option o : options) {
      final BaseModelData model = new BaseModelData();

      model.set("title", o.getTitle());
      model.set("value", o.getValue());
      store.add(model);
      if (o.isDefault().booleanValue()) {
        cb.setValue(model);
      }
    }
    cb.setStore(store);

    _combobox = cb;
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  protected void handleMouseDown(ListViewEvent<M> e) {
    if (locked) return;
    M sel = listStore.getAt(e.getIndex());

    if (isSelected(sel) && !e.isControlKey()) {
      return;
    }

    if (selectionMode == SelectionMode.SINGLE) {
      if (isSelected(sel) && e.isControlKey()) {
        deselect(sel);
      } else if (!isSelected(sel)) {
        select(sel, false);
      }
    } else {
      if (e.isShiftKey() && lastSelected != null) {
        int last = listStore.indexOf(lastSelected);
        int index = e.getIndex();
        int a = (last > index) ? index : last;
        int b = (last < index) ? index : last;
        select(a, b, e.isControlKey());
        lastSelected = listStore.getAt(last);
        listView.focusItem(index);
        // view.focusRow(index);
      } else if (isSelected(sel) && e.isControlKey()) {
        doDeselect(Arrays.asList(sel), false);
      } else {
        doSelect(Arrays.asList(sel), e.isControlKey(), false);
        listView.focusItem(e.getIndex());
        // view.focusRow(e.rowIndex);
      }
    }
  }
コード例 #3
0
  private void loadTable(List<RiepilogoCostiDipendentiModel> result) {

    store.removeAll();
    store.setStoreSorter(new StoreSorter<RiepilogoCostiDipendentiModel>());
    store.setDefaultSort("nome", SortDir.ASC);
    store.add(result);
  }
コード例 #4
0
  /** {@inheritDoc} */
  @Override
  protected Component getComponent(ValueResult valueResult, boolean enabled) {
    final boolean canAdd = enabled && userCanPerformChangeType(ValueEventChangeType.ADD);

    final ContentPanel component = new ContentPanel();
    component.setHeadingText(getLabel());

    // Setting up the report store
    final List<?> reports = valueResult.getValuesObject();

    final ListStore<ReportReference> store = new ListStore<ReportReference>();
    if (reports != null) store.add((List<ReportReference>) reports);

    // Creating the toolbar
    if (canAdd) {
      component.setTopComponent(createToolbar(store));
    }

    // Creating the grid
    final FlexibleGrid<ReportReference> reportGrid =
        new FlexibleGrid<ReportReference>(store, null, createColumnModel(enabled));
    reportGrid.setAutoExpandColumn("name");
    reportGrid.setVisibleElementsCount(5);

    component.add(reportGrid);

    return component;
  }
コード例 #5
0
 private void init() {
   this.setComboBoxProperties();
   ListStore<LogicalOperator> operatorsStore = new ListStore<LogicalOperator>();
   operatorsStore.add(LogicalOperator.getOperatorsList());
   super.setStore(operatorsStore);
   //        super.setValue(super.store.getAt(0));
 }
コード例 #6
0
ファイル: ProfileView.java プロジェクト: openhie/os-cr
  private void displayRecords(UserWeb user) {

    // Name
    userName.setValue(user.getUsername());
    firstName.setValue(user.getFirstName());
    lastName.setValue(user.getLastName());

    passwordHint.setValue(user.getPasswordHint());

    // Address
    address.setValue(user.getAddress());
    city.setValue(user.getCity());
    for (State st : states.getModels()) {
      if (st.getAbbr().equals(user.getState())) state.setValue(st);
    }
    zip.setValue(user.getPostalCode());
    for (Country co : countries.getModels()) {
      if (co.getName().equals(user.getCountry())) country.setValue(co);
    }

    // Phone
    phoneNumber.setValue(user.getPhoneNumber());

    // Other
    email.setValue(user.getEmail());
    emailConfirm.setValue(user.getEmail());
    webSite.setValue(user.getWebsite());
  }
コード例 #7
0
 private ListStore<Model> newStore() {
   final ListStore<Model> store = new ListStore<Model>();
   store.add(new Model(PortalInheritableFlag.INHERIT));
   store.add(new Model(PortalInheritableFlag.ON));
   store.add(new Model(PortalInheritableFlag.OFF));
   return store;
 }
コード例 #8
0
  public ListStore<ModelData> getGroupComboStore() {

    if (sourceGrid != null) return getGroupComboStore(sourceGrid);
    if (sourceStore != null) return getGroupComboStore(sourceStore);

    ListStore<ModelData> groupStore = new ListStore<ModelData>();

    ModelData model;

    model = new BaseModelData();
    model.set("value", "productCode");
    model.set("description", "Product");
    groupStore.add(model);

    model = new BaseModelData();
    model.set("value", "serviceCode");
    model.set("description", "Service");
    groupStore.add(model);

    model = new BaseModelData();
    model.set("value", "institution.institutionName");
    model.set("description", "Institution");
    groupStore.add(model);

    model = new BaseModelData();
    model.set("value", "institution.state");
    model.set("description", "State");
    groupStore.add(model);

    return groupStore;
  }
コード例 #9
0
  private Widget createBillTypeField(BillTypeManager billTypeManager) {
    List<BillType> billTypes = billTypeManager.getBillTypes();

    Collections.sort(
        billTypes,
        new Comparator<BillType>() {
          @Override
          public int compare(BillType billType1, BillType billType2) {
            return billType1.getName().compareToIgnoreCase(billType2.getName());
          }
        });

    List<BillTypeModel> billTypeModels = new ArrayList<BillTypeModel>();

    for (BillType billType : billTypes) {
      BillTypeModel billTypeModel = new BillTypeModel(billType);
      billTypeModels.add(billTypeModel);
    }

    ListStore<BillTypeModel> billTypeListBox = new ListStore<BillTypeModel>();
    billTypeListBox.add(billTypeModels);

    billTypeComboBox = new ComboBox<BillTypeModel>();
    billTypeComboBox.setFieldLabel("Bill Type");
    billTypeComboBox.setDisplayField("name");
    billTypeComboBox.setTriggerAction(TriggerAction.ALL);
    billTypeComboBox.setStore(billTypeListBox);
    billTypeComboBox.setAllowBlank(false);
    billTypeComboBox.setForceSelection(true);

    return billTypeComboBox;
  }
コード例 #10
0
  @SuppressWarnings("unchecked")
  @Override
  protected void handleEvent(AppEvent event) {
    if (event.getType() == AppEvents.AuditEventEntryView) {

      searchCriteria = null;
      currentEntity = Registry.get(Constants.ENTITY_ATTRIBUTE_MODEL);

      initUI();

      if (Registry.get(Constants.AUDIT_EVENT_TYPE_CODES) != null) {
        List<AuditEventTypeWeb> auditEventTypes =
            (List<AuditEventTypeWeb>) Registry.get(Constants.AUDIT_EVENT_TYPE_CODES);
        /*
         * for (AuditEventTypeWeb type : auditEventTypes) { Info.display("Information", "Event Types: "+
         * type.getAuditEventTypeCd() + ", " + type.getAuditEventTypeName()); }
         */
        eventTypesStore.removeAll();
        eventTypesStore.add(auditEventTypes);
      }

    } else if (event.getType() == AppEvents.Logout) {

      Dispatcher.get().dispatch(AppEvents.Logout);

    } else if (event.getType() == AppEvents.AuditEventReceived) {

      // Info.display("Information", "EventReceived");
      store.removeAll();

      AuditEventEntryListWeb events = (AuditEventEntryListWeb) event.getData();
      if (events.getAuditEventEntries() != null) {
        store.add(events.getAuditEventEntries());
      }

      grid.getSelectionModel().select(0, true);
      grid.getSelectionModel().deselect(0);

      status.hide();
      searchButton.unmask();

    } else if (event.getType() == AppEvents.EntityByIdRequest) {

      RecordWeb record = (RecordWeb) event.getData();

      if (record != null) {
        identifierStore.removeAll();

        buildRefRecordInfoDialog();
        refRecordInfoDialog.show();

        displayEntityRecord(attributeFieldMap, record);
        displayEntityIdentifier(record);
      }

    } else if (event.getType() == AppEvents.Error) {
      String message = event.getData();
      MessageBox.alert("Information", "Failure: " + message, null);
    }
  }
コード例 #11
0
ファイル: LiveGridView.java プロジェクト: Elisabitao/gxt-rtl
 @Override
 protected void onRemove(ListStore<ModelData> ds, ModelData m, int index, boolean isUpdate) {
   super.onRemove(ds, m, index, isUpdate);
   if (!isUpdate && liveStore.hasRecord(m)) {
     liveStore.getRecord(m).reject(false);
   }
 }
コード例 #12
0
 @Override
 public void refresh(RefreshableEvent event) {
   if (event.getEventType() == RefreshableEvent.Type.DISTRICT_SUMMARIES) {
     ListStore<DistrictComparisonSummary> store1 = grid.getStore();
     if (store1.getCount() > 0) {
       store1.removeAll();
     }
     List<DistrictComparisons> summaries =
         getSummaries((List<DistrictComparisons>) event.getData(), parentView.loggedUser);
     for (DistrictComparisons d : summaries) {
       final String district = d.getDistrict();
       final String subcounty = d.getSubcounty();
       final String boreholes = d.getBoreholes();
       final String shallowWells = d.getShallowWells();
       final String publicTaps = d.getPublicTaps();
       final String protectedSprings = d.getProtectedSprings();
       int total =
           Integer.parseInt(boreholes)
               + Integer.parseInt(shallowWells)
               + Integer.parseInt(publicTaps)
               + Integer.parseInt(protectedSprings);
       DistrictComparisonSummary summary =
           new DistrictComparisonSummary(
               district,
               subcounty,
               boreholes,
               shallowWells,
               publicTaps,
               protectedSprings,
               String.valueOf(total));
       store1.add(summary);
     }
   }
 }
コード例 #13
0
 /**
  * Populates runs
  *
  * @param models
  * @param enabled : is combobox enabled
  */
 @Override
 public void setModels(List<RunModel> models, boolean enabled) {
   if (models.size() > 0) {
     storeName.add(models);
     cbName.setValue(storeName.getAt(0));
   }
   cbName.setEnabled(enabled);
 }
コード例 #14
0
  public void onValueChange(ValueChangeEvent<List<GrisuFileObject>> arg0) {

    for (GrisuFileObject file : arg0.getValue()) {

      if (!inputFileStore.contains(file)) {
        inputFileStore.add(file);
      }
    }
  }
コード例 #15
0
  private ComboBox<AttributeDetail> createNameAttributeCombo() {
    this.nameAttributeCombo = new ComboBox<AttributeDetail>();
    nameAttributeCombo.setEditable(false);
    nameAttributeCombo.setTypeAhead(true);
    nameAttributeCombo.setTriggerAction(ComboBox.TriggerAction.ALL);
    nameAttributeCombo.setWidth(110);

    this.nameAttributeCombo.addSelectionChangedListener(
        new SelectionChangedListener<AttributeDetail>() {

          @Override
          public void selectionChanged(SelectionChangedEvent<AttributeDetail> se) {
            if (clickHandlerRegistration != null) {
              clickHandlerRegistration.removeHandler();
            }
            AttributeDetail attributeDetail = se.getSelectedItem();
            if (attributeDetail == null) {
              operatorCombo.disable();
            } else {
              AttributeCustomFields customFields =
                  AttributeCustomFieldsMap.getAttributeCustomFields(attributeDetail.getType());
              operatorCombo.clear();
              operatorCombo.removeAll();
              for (OperatorType operatorType : customFields.getOperatorList()) {
                operatorCombo.add(operatorType.toString());
              }
              operatorCombo.enable();
              conditionAttributeField.clear();
              conditionAttributeField.setValidator(customFields.getValidator());
              conditionAttributeField.setToolTip("Datatype: " + attributeDetail.getType());
              if (attributeDetail.getType().equals("dateTime")) {
                conditionAttributeField.addHandler(
                    new ClickHandler() {

                      @Override
                      public void onClick(ClickEvent event) {
                        timeInputWidget.show();
                      }
                    },
                    ClickEvent.getType());
              }
            }
          }
        });
    ListStore nameAttributeStore = new ListStore<AttributeDetail>();
    nameAttributeStore.add(attributes);
    nameAttributeCombo.setStore(nameAttributeStore);
    nameAttributeCombo.setDisplayField(AttributeDetail.AttributeDetailKeyValue.NAME.name());
    //        nameAttributeCombo.setSimpleValue("XXX");

    return nameAttributeCombo;
  }
コード例 #16
0
ファイル: CCComboBoxField.java プロジェクト: johnstok/cms
  /** {@inheritDoc} */
  @Override
  public void setValue(final Paragraph para) {

    final ComboBox<BaseModelData> cb = _combobox;
    final String value = para.getText();

    final ListStore<BaseModelData> store = cb.getStore();
    for (final BaseModelData model : store.getModels()) {
      if (model.get("value").equals(value)) {
        cb.setValue(model);
      }
    }
  }
コード例 #17
0
  public ListStore<ModelData> getGroupComboStore(Grid<BeanModel> sourceGrid) {

    if (sourceGrid.getColumnModel().getColumnCount() > 0) {
      ListStore<ModelData> groupStore = new ListStore<ModelData>();
      ModelData model;
      for (int i = 0; i < sourceGrid.getColumnModel().getColumnCount(); i++) {
        model = new BaseModelData();
        model.set("value", sourceGrid.getColumnModel().getColumn(i).getId());
        model.set("description", sourceGrid.getColumnModel().getColumn(i).getHeader());
        groupStore.add(model);
      }
      return groupStore;
    } else return getGroupComboStore();
  }
コード例 #18
0
  @Test
  public void loaderPopulatesStore() {

    ignoreView();

    expectDispatch(new GetSchema(), schema);
    replay(dispatcher);

    createPresenter();
    ListStore<UserDatabaseDTO> store = presenter.getStore();

    assertThat("store.getCount()", store.getCount(), is(equalTo(3)));

    verify(dispatcher);
  }
コード例 #19
0
 protected void selectNext(boolean keepexisting) {
   if (hasNext()) {
     int idx = listStore.indexOf(lastSelected) + 1;
     select(idx, keepexisting);
     listView.focusItem(idx);
   }
 }
コード例 #20
0
  private Widget createStoreField() {
    ListStore<StoreModel> storeNameListStore = new ListStore<StoreModel>();

    for (String store : stores) {
      storeNameListStore.add(new StoreModel(store));
    }

    storeComboBox = new ComboBox<StoreModel>();
    storeComboBox.setFieldLabel("Store");
    storeComboBox.setDisplayField("name");
    storeComboBox.setTriggerAction(TriggerAction.ALL);
    storeComboBox.setStore(storeNameListStore);
    storeComboBox.setAllowBlank(false);

    return storeComboBox;
  }
コード例 #21
0
 @Override
 public boolean okayToReturn() {
   if (store != null && localStore) {
     store.removeAll();
   }
   return true;
 }
コード例 #22
0
  public void caricaDati() {
    // Initialize the service proxy.
    if (dstoreSvc == null) {
      dstoreSvc = GWT.create(AziendaService.class);
    }

    AsyncCallback<ArrayList> callback =
        new AsyncCallback<ArrayList>() {

          @Override
          public void onFailure(Throwable caught) {
            status.setStatus("Problemi di comunicazione col server", baseStyle);
          }

          @Override
          public void onSuccess(ArrayList result) {
            aziende = result;
            BeanModelFactory factory = BeanModelLookup.get().getFactory(Azienda.class);
            if (result != null) {
              Iterator it = result.iterator();
              while (it.hasNext()) {
                Object azienda = it.next();
                BeanModel aziendaModel = factory.createModel(azienda);
                store.add(aziendaModel);
              }
            }
            status.setStatus("Dati caricati con successo", baseStyle);
          }
        };
    // Make the call to the stock price service.
    status.setBusy("Caricamento dati in corso...");
    aziende.clear();
    store.removeAll();
    dstoreSvc.carica(callback);
  }
コード例 #23
0
 private void refreshAvailableGroups(List<Group> groups) {
   for (Group group : groups) {
     if (!user.getGroups().contains(group)) {
       fromGroupStore.add(new GroupData(group));
     }
   }
 }
コード例 #24
0
 protected void selectPrevious(boolean keepexisting) {
   if (hasPrevious()) {
     int idx = listStore.indexOf(lastSelected) - 1;
     select(idx, keepexisting);
     listView.focusItem(idx);
   }
 }
コード例 #25
0
 private void refreshAvailableUsers(List<User> users) {
   for (User user : users) {
     if (!group.getUsers().contains(user)) {
       fromUserStore.add(new UserData(user));
     }
   }
 }
コード例 #26
0
  public Map<String, String> calculateJobProperties() throws JobCreationException {

    Map<String, String> properties = new HashMap<String, String>();

    // jobname
    String jobname = getJobnameTextField().getValue();
    properties.put(Constants.JOBNAME_KEY, jobname);

    // commandline
    String commandline = getCommandLineTextArea().getValue().trim();
    properties.put(Constants.COMMANDLINE_KEY, commandline);

    // application
    Set<String> apps = new HashSet<String>();
    for (String app : currentApplications) {
      apps.add(app.toLowerCase());
    }
    if (apps.size() > 1) {
      throw new JobCreationException(
          "More than one applications found for specified executable. This is not supported (at least not at the moment. Please contact [email protected] if you experience this problem.");
    }
    properties.put(Constants.APPLICATIONNAME_KEY, apps.iterator().next());

    // version
    String version = getVersionComboBox().getSimpleValue();
    properties.put(Constants.APPLICATIONVERSION_KEY, version);

    // walltime
    Integer walltime =
        (getDaysComboBox().getSimpleValue() * 60 * 24)
            + (getHoursComboBox().getSimpleValue() * 60)
            + getMinutesComboBox().getSimpleValue();
    properties.put(Constants.WALLTIME_IN_MINUTES_KEY, walltime.toString());

    // cpus
    Integer cpus = getCpusComboBox().getSimpleValue();
    properties.put(Constants.NO_CPUS_KEY, cpus.toString());

    // fqan
    String fqan = getVoComboBox().getSimpleValue();
    properties.put(Constants.FQAN_KEY, fqan);

    // send email
    Boolean sendEmail = getCheckBox().getValue();
    if (sendEmail) {
      properties.put(Constants.EMAIL_ON_FINISH_KEY, "true");
      String emailAddress = getEmailTextField().getValue();
      properties.put(Constants.EMAIL_ADDRESS_KEY, emailAddress);
    }

    // input files
    StringBuffer inputFiles = new StringBuffer();
    for (GrisuFileObject file : inputFileStore.getModels()) {
      inputFiles.append(file.getUrl() + ",");
    }
    properties.put(Constants.INPUT_FILE_URLS_KEY, inputFiles.toString());

    return properties;
  }
コード例 #27
0
 private void displayEntityIdentifier(RecordWeb record) {
   if (record.getIdentifiers() == null) {
     return;
   }
   for (IdentifierWeb identifier : record.getIdentifiers()) {
     identifierStore.add(identifier);
   }
 }
コード例 #28
0
  public ListStore<ModelData> getValueComboStore() {
    ListStore<ModelData> valueStore = new ListStore<ModelData>();

    ModelData model;

    model = new BaseModelData();
    model.set("value", "dollarValue");
    model.set("description", "Dollar Values");
    valueStore.add(model);

    model = new BaseModelData();
    model.set("value", "count");
    model.set("description", "Services");
    valueStore.add(model);

    return valueStore;
  }
コード例 #29
0
  private void setFields() {
    nameTextBox.setValue(group.getName());
    for (User user : group.getUsers()) {
      toUserStore.add(new UserData(user));
    }

    loadAvailableUsers();
  }
コード例 #30
0
ファイル: LiveGridView.java プロジェクト: Elisabitao/gxt-rtl
 protected boolean isCached(int index) {
   if ((liveStore.getCount() == 0 && totalCount > 0)
       || (index < liveStoreOffset)
       || (index > (liveStoreOffset + getCacheSize() - getVisibleRowCount()))) {
     return false;
   }
   return true;
 }