@Override
  public void singleClickAction(MouseEvent e, int rowIndex, int colIndex) {
    if (getColumnClass(colIndex) != ObjectId.class) {
      return;
    }

    ObjectId id = (ObjectId) getValueAt(rowIndex, colIndex);
    if ((id == null) || (id.getId() == null)) {
      return;
    }

    try {
      getClientModel().loadObject(id.getId());
      setTab(0);
    } catch (Exception ex) {
      ClientHelper.showError(this, ex);
    }
  }
예제 #2
0
  public void objectLoaded(ClientModelEvent event) {
    CmisObject object = getClientModel().getCurrentObject();

    if (object == null) {
      nameField.setText("");
      idField.setText("");
      typeField.setText("");
      basetypeField.setText("");
      versionLabelField.setText("");
      pwcField.setText("");
      paths.removeAll();
      contentUrlField.setText("");
      allowableActionsList.removeAll();
      refreshButton.setEnabled(false);
      checkButton.setEnabled(false);
      scriptPanel.setVisible(false);
    } else {
      try {
        nameField.setText(object.getName());
        idField.setText(object.getId());
        typeField.setText(object.getType().getId());
        basetypeField.setText(object.getBaseTypeId().toString());
        if (object instanceof Document) {
          Document doc = (Document) object;

          try {
            versionLabelField.setText(doc.getVersionLabel());
          } catch (Exception e) {
            versionLabelField.setText("???");
          }

          if (doc.isVersionSeriesCheckedOut() == null) {
            pwcField.setText("");
          } else if (doc.isVersionSeriesCheckedOut().booleanValue()) {
            pwcField.setText(doc.getVersionSeriesCheckedOutId());
          } else {
            pwcField.setText("(not checked out)");
          }
        } else {
          pwcField.setText("");
          versionLabelField.setText("");
        }

        if (object instanceof FileableCmisObject) {
          if (object instanceof Folder) {
            paths.setList(Collections.singletonList(((Folder) object).getPath()));
          } else {
            paths.setList(Collections.singletonList(""));
            final FileableCmisObject pathObject = (FileableCmisObject) object;
            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    try {
                      List<String> pathsList = pathObject.getPaths();
                      if ((pathsList == null) || (pathsList.size() == 0)) {
                        paths.setList(Collections.singletonList("(unfiled)"));
                      } else {
                        paths.setList(pathsList);
                      }
                    } catch (Exception e) {
                      paths.setList(Collections.singletonList("(???)"));
                      // ClientHelper.showError(null, e);
                    }
                    ObjectPanel.this.revalidate();
                  }
                });
          }
        } else {
          paths.setList(Collections.singletonList("(not filable)"));
        }

        String docUrl = getDocumentURL(object, getClientModel().getClientSession().getSession());
        if (docUrl != null) {
          contentUrlField.setText(docUrl);
        } else {
          contentUrlField.setText("(not available)");
        }

        if (object.getAllowableActions() != null) {
          allowableActionsList.setList(object.getAllowableActions().getAllowableActions());
        } else {
          allowableActionsList.setList(Collections.singletonList("(missing)"));
        }

        refreshButton.setEnabled(true);
        checkButton.setEnabled(true);

        if (object instanceof Document) {
          String name = object.getName().toLowerCase(Locale.ENGLISH);
          int x = name.lastIndexOf('.');
          if ((x > -1) && (scriptExtensions.contains(name.substring(x + 1)))) {
            scriptPanel.setVisible(true);
            scriptOutput.setVisible(false);
          } else {
            scriptPanel.setVisible(false);
          }
        }
      } catch (Exception e) {
        ClientHelper.showError(this, e);
      }
    }

    revalidate();
  }