Пример #1
0
 private void setModifiedFlag(IContextManager contextManager) {
   if (contextManager != null && contextManager instanceof JobContextManager) {
     JobContextManager manager = (JobContextManager) contextManager;
     // record the modified operation.
     manager.setModified(true);
   }
 }
 private void updateRelation() {
   // set updated flag.
   if (param != null) {
     IContextManager manager = modelManager.getContextManager();
     if (manager != null && manager instanceof JobContextManager) {
       JobContextManager jobContextManager = (JobContextManager) manager;
       // not added new
       if (!modelManager.isRepositoryContext()
           || modelManager.isRepositoryContext()
               && jobContextManager.isOriginalParameter(param.getName())) {
         jobContextManager.setModified(true);
         manager.fireContextsChangedEvent();
       }
     }
   }
 }
 private void updateRelation(String _oldName, String _newName) {
   // set updated flag.
   if (param != null) {
     IContextManager manager = modelManager.getContextManager();
     if (manager != null && manager instanceof JobContextManager) {
       JobContextManager jobContextManager = (JobContextManager) manager;
       // not added new
       if (!modelManager.isRepositoryContext()
           || modelManager.isRepositoryContext()
               && jobContextManager.isOriginalParameter(param.getName())) {
         jobContextManager.setModified(true);
         manager.fireContextsChangedEvent();
       }
     }
   }
   // update nodes in the job
   if (modelManager instanceof ContextComposite) {
     ((ContextComposite) modelManager).switchSettingsView(_oldName, _newName);
   }
 }
  private void setPropertyValue(
      IContextModelManager manager,
      Object dataElement,
      String contextParaName,
      int columnIndex,
      Object newValue) {
    String currentColumnName = getColumnProperty(columnIndex);
    if (this.groupModel.isPartOfAGroup(columnIndex)) {
      String columnGroupName = this.groupModel.getColumnGroupByIndex(columnIndex).getName();
      IContextManager contextManger = manager.getContextManager();
      if (contextManger != null) {
        // change the property of context such as prompt,promptyNeeded,value etc.
        List<Object> list = new ArrayList<Object>();
        list.add(dataElement);

        IContextParameter para = null;
        para = getRealParameter(contextManger, columnGroupName, dataElement);
        if (para == null) {
          return;
        }
        Command cmd =
            new SetContextGroupParameterCommand(manager, para, currentColumnName, newValue);
        runCommand(cmd, manager);
        if (currentColumnName.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
          manager.refresh();
        }
      }
    } else {
      if (currentColumnName.equals(ContextTableConstants.COLUMN_TYPE_PROPERTY)) {
        ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
        IContextParameter contextPara = parent.getContextParameter();
        if (contextPara.getType() == ((String) newValue)) {
          return;
        }
        String newType = getRealType((String) newValue);
        contextPara.setType(newType);

        Command cmd = new SetContextTypeCommand(manager, contextPara, newType);
        runCommand(cmd, manager);
      } else if (currentColumnName.equals(ContextTableConstants.COLUMN_NAME_PROPERTY)) {
        ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
        IContextParameter contextPara = parent.getContextParameter();
        String sourceId = contextPara.getSource();
        String newParaName = (String) newValue;

        if (manager.getContextManager() instanceof JobContextManager) {
          // in case joblet rename will propagate to the job,just record it
          JobContextManager contextManager = (JobContextManager) manager.getContextManager();
          contextManager.addNewName(newParaName, contextPara.getName());
          contextManager.setModified(true);
        }
        Command cmd = new SetContextNameCommand(manager, contextPara, newParaName, sourceId);
        runCommand(cmd, manager);
      } else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
        ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
        IContextParameter contextPara = parent.getContextParameter();
        if (contextPara.getComment() == ((String) newValue)) {
          return;
        }
        Command cmd = new setContextCommentCommand(manager, contextPara, (String) newValue);
        runCommand(cmd, manager);
      }
    }
  }
 private void setModifiedFlag(IContextManager contextManager) {
   if (contextManager != null && contextManager instanceof JobContextManager) {
     JobContextManager manager = (JobContextManager) contextManager;
     manager.setModified(true);
   }
 }