コード例 #1
0
  private void fillBean() {
    if (connection != null) {
      if (getRepository() != null) {
        connection.setRepositoryId(getRepository().getId());

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

        Map<String, LabelText> map = dynamicControls.get(getRepository());
        for (String fieldKey : map.keySet()) {
          connFields.put(fieldKey, map.get(fieldKey).getText());
        }

        Map<String, LabelledCombo> map2 = dynamicChoices.get(getRepository());
        for (String fieldKey : map2.keySet()) {
          for (DynamicChoiceBean dynamicChoiceBean : getRepository().getChoices()) {
            if (dynamicChoiceBean.getId().equals(fieldKey)) {
              int selectionIndex = map2.get(fieldKey).getCombo().getSelectionIndex();
              connFields.put(fieldKey, dynamicChoiceBean.getChoiceValue(selectionIndex));
            }
          }
        }

        connection.setDynamicFields(connFields);
      }
      connection.setName(nameText.getText());
      connection.setDescription(descriptionText.getText());
      connection.setUser(userText.getText());
      connection.setPassword(passwordText.getText());

      connectionsListComposite.refresh(connection);
    }
  }
コード例 #2
0
 private void saveConnectionBean(String email) {
   ConnectionUserPerReader perReader = ConnectionUserPerReader.getInstance();
   List<ConnectionBean> cons = perReader.forceReadConnections();
   if (cons.isEmpty()) { // if have exited some connections, don't add default connection.
     cons = new ArrayList<ConnectionBean>();
     ConnectionBean bean = ConnectionBean.getDefaultConnectionBean();
     bean.setUser(email);
     cons.add(bean);
     perReader.saveConnections(cons);
   }
 }