示例#1
0
  private void userChanged() {
    if (users == null) {
      return;
    }
    ClientUser user = null;
    if (users.getSelectedIndex() > 0) {
      final String email = users.getValue(users.getSelectedIndex());
      if (userInfo.containsKey(email)) {
        user = userInfo.get(email);
      }

      Cookies.setCookie(
          "email",
          users.getValue(users.getSelectedIndex()),
          ParamSetSelectionController.getCookieExpirationDate(),
          null,
          "/",
          false);
    }

    // Figure out whether this user can edit parameters or not
    final boolean editorEnabled = user != null && user.isParameterEditorEnabled();
    if (paramsEditor != null) {
      paramsEditor.setEditorEnabled(editorEnabled, user);
    }
    setOutputPathChangeEnabled(user != null && user.isOutputPathChangeEnabled());
  }
示例#2
0
  public void updateBosses() {
    int index = instances.getSelectedIndex();
    if (index < 0) return;

    final String inst_key = instances.getValue(index);

    GoteFarm.goteService.getInstanceBosses(
        inst_key,
        new AsyncCallback<List<JSBoss>>() {
          public void onSuccess(List<JSBoss> results) {
            bosses.clear();

            for (JSBoss ib : results) {
              bosses.addItem(ib.name, ib.key);
              if (et != null && inst_key.equals(et.instance_key)) {
                for (String eb : et.boss_keys) {
                  if (ib.key.equals(eb)) {
                    bosses.setItemSelected(bosses.getItemCount() - 1, true);
                    break;
                  }
                }
              }
            }
          }

          public void onFailure(Throwable caught) {}
        });
  }
      public void onChange(Widget sender) {
        ListBox ss = (ListBox) sender;
        final String logLevel = ss.getValue(ss.getSelectedIndex());

        class LevelChangeCallBack implements AsyncCallback {

          public void onFailure(Throwable caught) {
            Logger.error(
                "Could not set logger level for logger ["
                    + info.getFullName()
                    + "] due to["
                    + caught.getMessage()
                    + "]");
          }

          public void onSuccess(Object result) {
            if (logLevel.equals(LogTreeNode._LEVEL_OFF)) {
              node.turnOff();
            } else {
              node.turnOn();
            }
          }
        }

        ServerConnection.logServiceAsync.setLoggerLevel(
            info.getFullName(), logLevel, new LevelChangeCallBack());
      }
 private void moveSelected(final ListBox from, final ListBox to) {
   int selected;
   while ((selected = from.getSelectedIndex()) != -1) {
     to.addItem(from.getItemText(selected), from.getValue(selected));
     from.removeItem(selected);
   }
 }
示例#5
0
  /** executeSearch */
  private void executeSearch() {
    if (name.getText().length() >= 3) {
      String category = "";

      if (typeList.getSelectedIndex() > 0) {
        category = typeList.getValue(typeList.getSelectedIndex());
      }

      String query = name.getText();
      Dropbox.get().status.setSearch();
      dropboxService.search(
          query,
          category,
          new AsyncCallback<List<GWTDropboxEntry>>() {
            @Override
            public void onSuccess(List<GWTDropboxEntry> result) {
              importButton.setEnabled(false);
              table.removeAllRows();
              data = new HashMap<String, GWTDropboxEntry>();

              for (GWTDropboxEntry gwtDropboxEntry : result) {
                int row = table.getRowCount();

                if (gwtDropboxEntry.isDir()) {
                  if (gwtDropboxEntry.isChildren()) {
                    table.setHTML(row, 0, UtilComunicator.imageItemHTML("img/menuitem_childs.gif"));
                  } else {
                    table.setHTML(row, 0, UtilComunicator.imageItemHTML("img/menuitem_empty.gif"));
                  }

                } else {
                  table.setHTML(
                      row, 0, UtilComunicator.mimeImageHTML(gwtDropboxEntry.getMimeType()));
                }

                table.setHTML(row, 1, gwtDropboxEntry.getPath());
                table.setHTML(row, 2, gwtDropboxEntry.getRev());
                table.getCellFormatter().setWidth(row, 0, "20");
                table.getCellFormatter().setWidth(row, 1, "100%");
                table.getCellFormatter().setHorizontalAlignment(row, 0, HasAlignment.ALIGN_CENTER);
                table.getCellFormatter().setHorizontalAlignment(row, 1, HasAlignment.ALIGN_LEFT);
                table.getCellFormatter().setVisible(row, 2, false);
                data.put(gwtDropboxEntry.getRev(), gwtDropboxEntry);
              }

              Dropbox.get().status.unsetSearch();
            }

            @Override
            public void onFailure(Throwable caught) {
              GeneralComunicator.showError("search", caught);
              Dropbox.get().status.unsetSearch();
            }
          });
    } else {
      table.removeAllRows();
      importButton.setEnabled(false);
    }
  }
  public void onClick(ClickEvent event) {

    BodegaValue bodega = tablaBodegas.darDatoSeleccionado();
    String scampoMotivoCierre = campoMotivoCierre.getValue(campoMotivoCierre.getSelectedIndex());
    Integer textoMotivoCierre =
        !scampoMotivoCierre.isEmpty()
            ? Integer.parseInt(campoMotivoCierre.getValue(campoMotivoCierre.getSelectedIndex()))
            : null;

    if (bodega == null) {
      Window.alert("Debe seleccionar una bodega de la tabla");
    } else if (textoMotivoCierre == null) {
      Window.alert("Debe seleccionar el motivo de cierre");
    } else {
      servlet.cerrarBodega(bodega.id, textoMotivoCierre, this);
    }
  }
示例#7
0
 @UiHandler("positionColumnY")
 public void onChangePositionColumnY(ChangeEvent event) {
   selectedPositionColumnY = positionColumnX.getValue(positionColumnY.getSelectedIndex());
   contents.selectedPositionColumnY = selectedPositionColumnY;
   expressionQtlTrackY.setPositionColumn(selectedPositionColumnY);
   // force refresh
   onChangeChromosome(null);
 }
 /**
  * Select a given item in the drop-down
  *
  * @param operator The DRL operator, not the HumanReadable form
  */
 public void selectItem(String operator) {
   String currentOperator = box.getValue(box.getSelectedIndex());
   if (currentOperator.equals(operator)) {
     return;
   }
   for (int i = 0; i < box.getItemCount(); i++) {
     String op = box.getValue(i);
     if (op.equals(operator)) {
       box.setSelectedIndex(i);
       break;
     }
   }
   String selected = box.getValue(box.getSelectedIndex());
   String selectedText = box.getItemText(box.getSelectedIndex());
   OperatorSelection selection = new OperatorSelection(selected, selectedText);
   operatorChanged(selection);
 }
 private void setValueType(VariableDto variableDto) {
   for (int i = 0; i < valueType.getItemCount(); i++) {
     valueType.setItemSelected(i, valueType.getValue(i).equals(variableDto.getValueType()));
   }
   if (valueType.getSelectedIndex() == -1) {
     valueType.setSelectedIndex(0);
   }
 }
 @Override
 public Map<String, String> getItems() {
   Map<String, String> items = new HashMap<String, String>();
   for (int index = 0; index < listBox.getItemCount(); index++) {
     items.put(listBox.getItemText(index), listBox.getValue(index));
   }
   return items;
 }
示例#11
0
 public Object getValue() {
   Object value = null;
   if (widget.isMultipleSelect()) {
     List selecteds = new ArrayList();
     for (int i = 0; i < widget.getItemCount(); i++) {
       if (widget.isItemSelected(i)) {
         selecteds.add(widget.getValue(i));
       }
     }
     value = selecteds;
   } else {
     if (widget.getSelectedIndex() > -1) {
       value = widget.getValue(widget.getSelectedIndex());
     }
   }
   return value;
 }
示例#12
0
 private String getRoleKey(String name) {
   for (int i = 0; i < roles.getItemCount(); ++i) {
     if (roles.getItemText(i).equals(name)) {
       return roles.getValue(i);
     }
   }
   return null;
 }
示例#13
0
 private String getBadgeKey(String name) {
   for (int i = 0; i < badges.getItemCount(); ++i) {
     if (badges.getItemText(i).equals(name)) {
       return badges.getValue(i);
     }
   }
   return null;
 }
  /**
   * Set selected by value.
   *
   * @param selectedValue the selected value.
   */
  private void setSelectedByValue(final String selectedValue) {
    for (int i = 0; i < streamOptions.getItemCount(); i++) {
      if (streamOptions.getValue(i).equals(selectedValue)) {
        streamOptions.setSelectedIndex(i);
      }
    }

    scopes.setVisible(hasStreamScopes(selectedValue));
  }
示例#15
0
文件: Term.java 项目: scbd/vocbench
 public boolean passCheckInput() {
   boolean pass = false;
   if (lang.getValue((lang.getSelectedIndex())).equals("") || term.getText().equals("")) {
     pass = false;
   } else {
     pass = true;
   }
   return pass;
 }
示例#16
0
 private void search() {
   resultsPanel.clear();
   final Label l = new Label("Search Results:");
   l.setStyleName("title");
   resultsPanel.add(l);
   int selectedCategory = categoriesList.getSelectedIndex();
   int sc = Integer.valueOf(categoriesList.getValue(selectedCategory));
   getService().findClientsByCriteria(searchBox.getText(), sc, updateSearchResultsCallback);
 }
示例#17
0
 public void setValue(Object value) {
   if (value instanceof Collection && widget.isMultipleSelect()) {
     for (Iterator i = ((Collection) value).iterator(); i.hasNext(); ) {
       for (int j = 0; j < widget.getItemCount(); j++) {
         if (widget.getValue(j).equals(i.next())) {
           widget.setItemSelected(j, true);
         }
       }
     }
   } else {
     for (int i = 0; i < widget.getItemCount(); i++) {
       if (widget.getValue(i).equals(value)) {
         widget.setItemSelected(i, true);
         break;
       }
     }
   }
 }
 /** Executed when a selection has been made. Refreshes the underlying RuleModeller widget */
 protected void selectSomething() {
   int sel = choices.getSelectedIndex();
   if (sel != -1) {
     Command cmd = cmds.get(choices.getValue(sel));
     if (cmd != null) {
       cmd.execute();
       ruleModeller.refreshWidget();
     }
   }
 }
示例#19
0
  private void changeLang(int type) {

    String sql = "";

    switch (type) {
      case 1:
        sql =
            "Update experiment set mtoutsrc = '"
                + srcLangList.getValue(srcLangList.getSelectedIndex())
                + "' where id = "
                + expId;
        mtoSrc = srcLangList.getValue(srcLangList.getSelectedIndex());
        break;
      case 2:
        sql =
            "Update experiment set mtouttrg = '"
                + trgLangList.getValue(trgLangList.getSelectedIndex())
                + "' where id = "
                + expId;
        mtoTrg = trgLangList.getValue(trgLangList.getSelectedIndex());
        break;

      default:
        break;
    }

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String> callback =
        new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String result) {
            reloadSettings();
          }
        };

    databaseAccessSvc.storeData(sql, callback);
  }
示例#20
0
 private void selectUser(final String userEmail) {
   if (userEmail != null) {
     for (int i = 0; i < users.getItemCount(); i++) {
       if (users.getValue(i).equalsIgnoreCase(userEmail)) {
         users.setSelectedIndex(i);
         break;
       }
     }
   }
   userChanged();
 }
示例#21
0
 @UiHandler("sourceList")
 void onChangeSourceList(ChangeEvent e) {
   Place currentPlace = placeController.getWhere();
   if (currentPlace instanceof PlaceWithSources) {
     PlaceWithSources<?> place = (PlaceWithSources<?>) currentPlace;
     int selectedIndex = sourceList.getSelectedIndex();
     // we were on the example page, we create a new place from the previous one and go to this new
     // place
     placeController.goTo(
         place.createPlace(sourceList.getValue(selectedIndex), selectedIndex > 0));
   }
 }
示例#22
0
 public List<Integer> getSelectedApplicationIds() {
   if (applications.getItemCount() == 0) {
     return group.getApplicationIds();
   }
   List<Integer> result = new ArrayList<Integer>(applications.getItemCount());
   for (int index = 0; index < applications.getItemCount(); index++) {
     if (applications.isItemSelected(index)) {
       int id = Integer.parseInt(applications.getValue(index));
       result.add(id);
     }
   }
   return result;
 }
 @Override
 public VariableDto getVariableDto(String script) {
   VariableDto variableDto = VariableDto.create();
   variableDto.setName(variableName.getValue());
   variableDto.setIsRepeatable(repeatableCheckbox.getValue());
   if (repeatableCheckbox.getValue()) variableDto.setOccurrenceGroup(occurrenceGroup.getValue());
   variableDto.setValueType(valueType.getValue(valueType.getSelectedIndex()));
   variableDto.setEntityType(entityType);
   variableDto.setMimeType(mimeType.getValue());
   variableDto.setUnit(unit.getValue());
   VariableDtos.setScript(variableDto, script);
   return variableDto;
 }
示例#24
0
 void resetApplications(List<Application> apps) {
   if (apps != null && !apps.isEmpty()) {
     applications.clear();
     for (Application a : apps) {
       applications.addItem(a.toDisplay(), a.getId() + "");
     }
     for (int index = 0; index < applications.getItemCount(); index++) {
       int id = Integer.parseInt(applications.getValue(index));
       applications.setItemSelected(index, group.getApplicationIds().contains(id));
     }
   }
   adjustListBox(box.getValue());
 }
示例#25
0
 public String getPostData() {
   StringBuffer postData = new StringBuffer();
   postData.append("&superusername="******"&superpassword="******"&superpasswordconfirm=");
   postData.append(URL.encodeQueryString(passwordConfirmTextBox.getValue()));
   postData.append("&superemail=");
   postData.append(URL.encodeQueryString(emailTextBox.getValue()));
   postData.append("&idprovider=");
   postData.append(URL.encodeQueryString(idProvider.getValue(idProvider.getSelectedIndex())));
   return postData.toString();
 }
示例#26
0
 public List<Integer> getSelectedRegionIds() {
   GWT.log("get selected region ids");
   if (regions.getItemCount() == 0) {
     return group.getApplicationIds();
   }
   List<Integer> result = new ArrayList<Integer>(regions.getItemCount());
   for (int index = 0; index < regions.getItemCount(); index++) {
     if (regions.isItemSelected(index)) {
       int id = Integer.parseInt(regions.getValue(index));
       result.add(id);
     }
   }
   GWT.log("get selected region ids" + result);
   return result;
 }
  /**
   * Gets the value.
   *
   * @return the value.
   */
  public Serializable getValue() {
    String value = streamOptions.getValue(streamOptions.getSelectedIndex());

    JSONObject jsonObject = StreamJsonRequestFactory.getEmptyRequest();

    if (value.equals(StreamJsonRequestFactory.FOLLOWED_BY_KEY)) {
      jsonObject = StreamJsonRequestFactory.setSourceAsFollowing(jsonObject);
    } else if (value.equals(StreamJsonRequestFactory.SAVED_KEY)) {
      jsonObject = StreamJsonRequestFactory.setSourceAsSaved(jsonObject);
    } else if (value.equals(StreamJsonRequestFactory.PARENT_ORG_KEY)) {
      jsonObject = StreamJsonRequestFactory.setSourceAsParentOrg(jsonObject);
    } else if (value.equals(StreamJsonRequestFactory.JOINED_GROUPS_KEY)) {
      jsonObject = StreamJsonRequestFactory.setSourceAsJoinedGroups(jsonObject);
    } else if (value.equals(StreamJsonRequestFactory.RECIPIENT_KEY)) {
      StreamJsonRequestFactory.initRecipient(jsonObject);

      for (StreamScope scope : (LinkedList<StreamScope>) scopes.getValue()) {
        jsonObject =
            StreamJsonRequestFactory.addRecipient(
                EntityType.valueOf(scope.getScopeType().toString()),
                scope.getUniqueKey(),
                jsonObject);
      }
    } else if (value.equals(StreamJsonRequestFactory.LIKER_KEY)) {
      StreamJsonRequestFactory.initLikers(jsonObject);

      for (StreamScope scope : (LinkedList<StreamScope>) scopes.getValue()) {
        jsonObject =
            StreamJsonRequestFactory.addLiker(
                EntityType.valueOf(scope.getScopeType().toString()),
                scope.getUniqueKey(),
                jsonObject);
      }
    } else if (value.equals(StreamJsonRequestFactory.AUTHOR_KEY)) {
      StreamJsonRequestFactory.initAuthors(jsonObject);

      for (StreamScope scope : (LinkedList<StreamScope>) scopes.getValue()) {
        jsonObject =
            StreamJsonRequestFactory.addAuthor(
                EntityType.valueOf(scope.getScopeType().toString()),
                scope.getUniqueKey(),
                jsonObject);
      }
    }

    return jsonObject.toString();
  }
示例#28
0
  @UiHandler({"save"})
  void onSaveClick(ClickEvent event) {

    Portal.CLOUD.attachVolume(
        volume.getId(),
        serverId.getValue(serverId.getSelectedIndex()),
        new AsyncCallback<Volume>() {

          @Override
          public void onSuccess(Volume result) {
            Portal.MODAL.hide();
            listener.onAttach(result);
          }

          @Override
          public void onFailure(Throwable caught) {}
        });
  }
      /*
       * (non-Javadoc)
       *
       * @see com.google.gwt.user.client.ui.ChangeListener#onChange(com.google .gwt.user.client.ui.Widget)
       */
      public void onChange(Widget sender) {

        final ListBox ss = (ListBox) sender;
        final String value = ss.getValue(ss.getSelectedIndex());
        final boolean sendValue;
        if (value.equals(_TRUE)) sendValue = (true);
        else sendValue = (false);

        class UseParentHandlerCallback implements AsyncCallback {

          /*
           * (non-Javadoc)
           *
           * @see com.google.gwt.user.client.rpc.AsyncCallback#onFailure (java.lang.Throwable)
           */
          public void onFailure(Throwable caught) {

            Logger.error(
                "Could not set \"UseParentHandler\" flag for logger ["
                    + info.getFullName()
                    + "] due to["
                    + caught.getMessage()
                    + "]");
            if (sendValue) {
              ss.setItemSelected(1, true);
            } else {
              ss.setItemSelected(0, true);
            }
          }

          /*
           * (non-Javadoc)
           *
           * @see com.google.gwt.user.client.rpc.AsyncCallback#onSuccess (java.lang.Object)
           */
          public void onSuccess(Object result) {}
        }

        ServerConnection.logServiceAsync.setUseParentHandlers(
            info.getFullName(), sendValue, new UseParentHandlerCallback());
      }
  @UiHandler("valider_affectation")
  void onValider_affectationClick(ClickEvent event) {

    Affectation af = new Affectation();

    af.setDateFin(date_fin.getValue());
    af.setDateDebut(date_debut.getValue());
    Terminal t = new Terminal();
    AdresseIp a = new AdresseIp();
    // af.adresseIp.setIdAdresse(Integer.parseInt(valider_affectation.getTitle()));
    a.setIdplage(id_plage);
    a.setChamp1(Integer.parseInt(adresse_selectione.getText()));
    a.setChamp2(Integer.parseInt(adresse_selectione2.getText()));
    a.setChamp3(Integer.parseInt(adresse_selectione3.getText()));
    a.setChamp4(Integer.parseInt(adresse_selectione5.getText()));
    a.setIdAdresse(Integer.parseInt(valider_affectation.getTitle()));
    t.setIdTerminal(Integer.parseInt(mes_terminaux.getValue(mes_terminaux.getSelectedIndex())));
    af.setTerminal(t);
    af.setAdresseIp(a);

    greetingService.ajouter_affectation(
        af,
        new AsyncCallback() {

          @Override
          public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onSuccess(Object result) {
            Window.alert("l affectation s est deroule avec succes");
          }
        });

    RootPanel.get().clear();
    adresses_dispo p_a = new adresses_dispo();
    RootPanel.get().add(p_a);
  }