コード例 #1
1
 public void onValueChange(ValueChangeEvent<Boolean> event) {
   if (event.getSource() == regularRolesBtn) {
     if (regularRolesBtn.getValue()) {
       showRoles(REGULAR_ROLES_TYPE);
     }
   } else if (event.getSource() == systemRolesBtn) {
     if (systemRolesBtn.getValue()) {
       showRoles(SYSTEM_ROLES_TYPE);
     }
   } else {
     if (rolesListBox.getSelectedIndex() >= 0) {
       ArrayList<String> selectedLogicalRoles = new ArrayList<String>();
       for (LogicalRoleInfo logicalRoleInfo : logicalRoles.values()) {
         if (logicalRoleInfo.checkBox.getValue()) {
           selectedLogicalRoles.add(logicalRoleInfo.roleName);
         }
       }
       String runtimeRole = rolesListBox.getItemText(rolesListBox.getSelectedIndex());
       List<String> originalRoles = masterRoleMap.get(runtimeRole);
       if (((originalRoles == null) || (originalRoles.size() == 0))
           && (selectedLogicalRoles.size() == 0)) {
         newRoleAssignments.remove(runtimeRole);
       } else if ((originalRoles != null)
           && (originalRoles.containsAll(selectedLogicalRoles))
           && selectedLogicalRoles.containsAll(originalRoles)) {
         newRoleAssignments.remove(runtimeRole);
       } else {
         newRoleAssignments.put(runtimeRole, selectedLogicalRoles);
       }
     }
   }
 }
コード例 #2
0
  private void submitMatch() {
    Match m =
        new Match(
            league.getId(),
            new Date(),
            league.getSports().get(sportBox.getSelectedIndex()),
            league.getPlayers().get(player1Box.getSelectedIndex() - 1),
            league.getPlayers().get(player2Box.getSelectedIndex() - 1));
    for (int i = 0; i < player1Score.size(); i++) {
      try {
        if (!player1Score.get(i).getText().equals("")
            && !player2Score.get(i).getText().equals("")) {
          m.addSet(
              new Set(
                  m.getSport(),
                  Integer.parseInt(player1Score.get(i).getText()),
                  Integer.parseInt(player2Score.get(i).getText())));
        }
      } catch (NumberFormatException e) {
        Window.alert("Failed to parse number: " + e.getMessage());
      }
    }
    AsyncCallback<Void> callback =
        new AsyncCallback<Void>() {
          public void onFailure(Throwable caught) {
            Window.alert("Failed to save match.");
          }

          public void onSuccess(Void arg) {
            Spelstegen.showMessage("Match sparad.", false);
            resetPanel();
          }
        };
    ServiceManager.getInstance().saveMatch(m, loggedInPlayer, league, callback);
  }
コード例 #3
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
  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());
  }
コード例 #4
0
ファイル: SearchPopup.java プロジェクト: HackLinux/openkm
  /** 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);
    }
  }
コード例 #5
0
 @EventHandler("updateButton")
 public void updateTaskButton(ClickEvent e) {
   presenter.updateTask(
       Long.parseLong(taskIdText.getText()),
       taskNameText.getText(),
       taskDescriptionTextArea.getText(),
       userText.getText(),
       subTaskStrategyListBox.getItemText(subTaskStrategyListBox.getSelectedIndex()),
       dueDate.getValue(),
       taskPriorityListBox.getSelectedIndex());
 }
コード例 #6
0
ファイル: EventEditor.java プロジェクト: jrray/gotefarm
  public void onChange(ChangeEvent event) {
    Object sender = event.getSource();

    if (sender == instances) {
      updateBosses();
    } else if (sender == roles) {
      addRole(roles.getItemText(roles.getSelectedIndex()));
    } else if (sender == badges) {
      addBadge(badges.getItemText(badges.getSelectedIndex()));
    }
  }
コード例 #7
0
ファイル: AddRouteWorkList.java プロジェクト: XiangjunFu/IONM
 @UiHandler("remove")
 public void onRemoveClick(ClickEvent event) {
   int selectedIndexA = previewA.getSelectedIndex();
   int selectedIndexZ = previewZ.getSelectedIndex();
   if (selectedIndexA == selectedIndexZ) {
     previewA.removeItem(selectedIndexA);
     previewZ.removeItem(selectedIndexZ);
   } else {
     Window.alert("请确保所选中记录为同一行...");
   }
 }
コード例 #8
0
ファイル: EventEditor.java プロジェクト: jrray/gotefarm
  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) {}
        });
  }
コード例 #9
0
 public String getSelectedTariff() {
   int selected = tariffListBox.getSelectedIndex();
   String temp = tariffListBox.getItemText(selected);
   temp = temp.substring((temp.indexOf("-") + 1), temp.length() - 2);
   System.out.println("temp= " + temp);
   return temp;
 }
コード例 #10
0
 public void onChange(ChangeEvent event) {
   Object source = event.getSource();
   if (source == sortMode) {
     int i = sortMode.getSelectedIndex();
     app.getSettings().getAlgebra().setTreeMode(supportedModes.get(i).ordinal());
   }
 }
コード例 #11
0
      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());
      }
コード例 #12
0
 private void copySelected(final ListBox from, final ListBox to) {
   int selected;
   while ((selected = from.getSelectedIndex()) != -1) {
     to.addItem(from.getItemText(selected));
     from.removeItem(selected);
   }
 }
コード例 #13
0
  private void updateWorkspace() {
    String name =
        availableWorkspacesListBox.getItemText(availableWorkspacesListBox.getSelectedIndex());

    List<String> selectedModulesList = new ArrayList<String>(selectedModulesListBox.getItemCount());
    for (int i = 0; i < selectedModulesListBox.getItemCount(); i++) {
      selectedModulesList.add(selectedModulesListBox.getItemText(i));
    }
    List<String> availableModuleList =
        new ArrayList<String>(availableModulesListBox.getItemCount());
    for (int i = 0; i < availableModulesListBox.getItemCount(); i++) {
      availableModuleList.add(availableModulesListBox.getItemText(i));
    }
    availableModuleList.removeAll(selectedModulesList);
    LoadingPopup.showMessage(constants.LoadingStatuses());

    repositoryService.updateWorkspace(
        name,
        selectedModulesList.toArray(new String[selectedModulesList.size()]),
        availableModuleList.toArray(new String[availableModuleList.size()]),
        new GenericCallback<java.lang.Void>() {
          public void onSuccess(Void v) {
            Window.alert(constants.WorkspaceUpdated());
            refreshWorkspaceList();
          }
        });
  }
コード例 #14
0
  @Test
  public void checkSelected() {
    ListBox listBox = getListBox();

    listBox.setSelectedIndex(1);
    Assert.assertEquals("item 1", listBox.getItemText(listBox.getSelectedIndex()));
  }
コード例 #15
0
  public void onClick(ClickEvent event) {
    Widget source = (Widget) event.getSource();
    if (source == btnSubmit) {
      if (currentUser != null) {
        txtLogin.setValue(currentUser.getUsername());
        txtProject.setValue(lbProjects.getItemText(lbProjects.getSelectedIndex()));
        form.submit();
      }
    }
    if (source == hlBack) {
      if (currentUser.getUsertype().equalsIgnoreCase("user")) {
        History.newItem("userJobList");
      } else {
        if (tab == 0) {

          History.newItem("adminJobList");
        } else {
          History.newItem("jobList");
        }
        // AdminPage adminPage = new AdminPage(tab);
        // RootPanel.get("content").add(adminPage);
      }
      /*UserHistory userHistory = new UserHistory();
      userHistory.history();*/
    }
  }
コード例 #16
0
  private boolean validateDueDate() {
    dueDateWarningLabel.setText("");

    int dateCondition = dueDateCondition.getSelectedIndex();

    if (dateCondition == BoardsFilter.DATE_CONDITION_UNSET) {
      return true;
    }

    boolean fromFilled = filterObject.parseDate(dueDateFromBox.getText()) != null;
    boolean toFilled = filterObject.parseDate(dueDateToBox.getText()) != null;

    if ((dateCondition == BoardsFilter.DATE_CONDITION_LESS
            || dateCondition == BoardsFilter.DATE_CONDITION_MORE
            || dateCondition == BoardsFilter.DATE_CONDITION_EQALS)
        && !fromFilled) {
      dueDateWarningLabel.setText("Please fill the date");
      return false;
    }

    if (dateCondition == BoardsFilter.DATE_CONDITION_BETWEEN && (!fromFilled || !toFilled)) {
      dueDateWarningLabel.setText("Please fill the date");
      return false;
    }

    return true;
  }
コード例 #17
0
 private int getSelectedIndex(ListBox listBox) {
   int selectedIndex = listBox.getSelectedIndex();
   if (selectedIndex == -1) {
     selectedIndex = 0;
   }
   return selectedIndex;
 }
コード例 #18
0
 /**
  * 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);
 }
コード例 #19
0
  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);
    }
  }
コード例 #20
0
 private void fireEventForFolderSelection(
     final Map<String, String> batchClassesNameMap, final HandlerManager eventBus) {
   String itemText =
       batchClassSelectionListBox.getItemText(batchClassSelectionListBox.getSelectedIndex());
   if (eventBus != null) {
     eventBus.fireEvent(new BatchClassChangeEvent(itemText, batchClassesNameMap.get(itemText)));
   }
 }
コード例 #21
0
 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);
   }
 }
コード例 #22
0
 @UiHandler("positionColumnY")
 public void onChangePositionColumnY(ChangeEvent event) {
   selectedPositionColumnY = positionColumnX.getValue(positionColumnY.getSelectedIndex());
   contents.selectedPositionColumnY = selectedPositionColumnY;
   expressionQtlTrackY.setPositionColumn(selectedPositionColumnY);
   // force refresh
   onChangeChromosome(null);
 }
コード例 #23
0
ファイル: ListBoxInput.java プロジェクト: nabcos/nexus
 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;
 }
コード例 #24
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);
 }
コード例 #25
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;
 }
コード例 #26
0
 @UiHandler("lstAvailableBindings")
 void lstAvailableBindingsOnChange(ChangeEvent event) {
   int index = lstAvailableBindings.getSelectedIndex();
   if (index > 0) {
     ((PortableObjectParameterDefinition) ppd).setBinding(lstAvailableBindings.getItemText(index));
   } else {
     ((PortableObjectParameterDefinition) ppd).setBinding("");
   }
 }
コード例 #27
0
 public String removeSelected() {
   int idx = listBox.getSelectedIndex();
   String value = listBox.getItemText(idx);
   listBox.removeItem(idx);
   if (listBox.getItemCount() > 0) {
     listBox.setSelectedIndex(0);
   }
   return value;
 }
コード例 #28
0
 /** 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();
     }
   }
 }
コード例 #29
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);
  }
コード例 #30
0
 /* (non-Javadoc)
  * @see com.google.gwt.user.client.ui.ClickHandler#onClick(com.google.gwt.user.client.ui.Widget)
  */
 @Override
 public void onClick(ClickEvent p_event) {
   if (getTrigger() == null) {
     return;
   }
   if (p_event.getSource() == m_btnNewCondition) {
     AnCondition condition =
         ConditionClass.valueOf(
                 m_lstConditionsClass.getItemText(m_lstConditionsClass.getSelectedIndex()))
             .newCondition();
     getTrigger().getConditions().add(condition);
     refreshConditions();
   } else if (p_event.getSource() == m_btnNewAction) {
     AnAction action =
         ActionClass.valueOf(m_lstActionsClass.getItemText(m_lstActionsClass.getSelectedIndex()))
             .newAction();
     getTrigger().getActions().add(action);
     refreshActions();
   }
 }