/** Performs the update. */
  private boolean doUpdate() {
    try {
      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      Map<String, Object> properties = new HashMap<String, Object>();
      for (PropertyInputPanel propertyPanel : propertyPanels) {
        if (propertyPanel.includeInUpdate()) {
          properties.put(propertyPanel.getId(), propertyPanel.getValue());
        }
      }

      if (properties.isEmpty()) {
        return false;
      }

      ObjectId newId = object.updateProperties(properties, false);

      if ((newId != null) && newId.getId().equals(model.getCurrentObject().getId())) {
        try {
          model.reloadObject();
          model.reloadFolder();
        } catch (Exception ex) {
          ClientHelper.showError(null, ex);
        }
      }

      return true;
    } catch (Exception ex) {
      ClientHelper.showError(this, ex);
      return false;
    } finally {
      setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
  }
Ejemplo n.º 2
0
  private void showLoginForm() {
    loginDialog.showDialog();
    if (!loginDialog.isCanceled()) {
      ClientSession clientSession = loginDialog.getClientSession();

      model.setClientSession(clientSession);

      try {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        model.loadFolder(clientSession.getStartFolderId(), false);
        model.loadObject(clientSession.getStartFolderId());

        toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(true);
        toolbarButton[BUTTON_TYPES].setEnabled(true);
        toolbarButton[BUTTON_QUERY].setEnabled(model.supportsQuery());
        toolbarButton[BUTTON_CHANGELOG].setEnabled(model.supportsChangeLog());
        toolbarButton[BUTTON_CONSOLE].setEnabled(true);
        toolbarButton[BUTTON_TCK].setEnabled(true);
        toolbarButton[BUTTON_CREATE].setEnabled(true);

        itemMenuItem.setEnabled(model.supportsItems());
        relationshipMenuItem.setEnabled(model.supportsRelationships());
        policyMenuItem.setEnabled(model.supportsPolicies());

        String user = clientSession.getSessionParameters().get(SessionParameter.USER);
        if (user != null) {
          user = "******" + user + ")";
        } else {
          user = "";
        }

        setTitle(
            WINDOW_TITLE + user + " - " + clientSession.getSession().getRepositoryInfo().getName());
      } catch (Exception ex) {
        toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
        toolbarButton[BUTTON_TYPES].setEnabled(false);
        toolbarButton[BUTTON_QUERY].setEnabled(false);
        toolbarButton[BUTTON_CHANGELOG].setEnabled(false);
        toolbarButton[BUTTON_CONSOLE].setEnabled(false);
        toolbarButton[BUTTON_TCK].setEnabled(false);
        toolbarButton[BUTTON_CREATE].setEnabled(false);

        ClientHelper.showError(null, ex);

        setTitle(WINDOW_TITLE);
      } finally {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      }
    }
  }
Ejemplo n.º 3
0
  public ObjectPanel(ClientModel model) {
    super(model);

    model.addObjectListener(this);

    // get all installed script engines
    scriptExtensions = new HashSet<String>();
    ScriptEngineManager mgr = new ScriptEngineManager();
    for (ScriptEngineFactory sef : mgr.getEngineFactories()) {
      scriptExtensions.addAll(sef.getExtensions());
    }

    createGUI();
  }