Package net.sf.redmine_mylyn.internal.ui.editor.helper

Examples of net.sf.redmine_mylyn.internal.ui.editor.helper.AttributePartLayoutHelper


    composite.setLayout(new GridLayout(2, false));
    GridData gd = new GridData();
    gd.horizontalSpan = 4;
    composite.setLayoutData(gd);

    AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(composite, toolkit, true);

   
    AbstractAttributeEditor editor = createAttributeEditor(getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED));
    if (editor!=null) {
      editor.createLabelControl(composite, toolkit);
      editor.createControl(composite, toolkit);
      layoutHelper.setLayoutData(editor);
      getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
    }
   
    editor = createAttributeEditor(getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_REPORTER));
    if (editor!=null) {
      editor.createLabelControl(composite, toolkit);
      editor.createControl(composite, toolkit);
      layoutHelper.setLayoutData(editor);
      getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
    }
   
    TaskAttribute attribute = getTaskData().getRoot().getMappedAttribute(RedmineAttribute.WATCHERS.getTaskKey());
    if (attribute!=null && (editor = createAttributeEditor(attribute))!=null && editor instanceof RedmineWatchersEditor ) {
     
      attribute = attribute.getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
      if (attribute != null) {
       
        RedminePersonEditor personEditor = new RedminePersonEditor(getModel(), attribute) {
          @Override
          public void setValue(String value) {
            value = RedmineUtil.findUserLogin(value);
            if(value!=null && !value.isEmpty()) {
              IRepositoryPerson person = getModel().getTaskRepository().createPerson(value);
              watchersEditor.addWatcher(person);
              text.setText("");
            }
          };
         
          @Override
          public String getValue() {
            return "";
          };
         
        };
       
        personEditor.createLabelControl(composite, toolkit);
        personEditor.createControl(composite, toolkit);
        personEditor.setDecorationEnabled(false);
        layoutHelper.setLayoutData(personEditor);
        getTaskEditorPage().getAttributeEditorToolkit().adapt(personEditor);
      }


      editor.createLabelControl(composite, toolkit);
      editor.createControl(composite, toolkit);
      layoutHelper.setLayoutData(editor);
      getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
      watchersEditor = (RedmineWatchersEditor)editor;
    }
   
    toolkit.paintBordersFor(composite);
View Full Code Here


    AttributeEditorToolkit editorToolkit = getTaskEditorPage().getAttributeEditorToolkit();
    TaskAttribute root = getTaskData().getRoot();
    AbstractAttributeEditor attributeEditor;
    TaskAttribute attribute;
    AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(composite, toolkit, true);

    attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_HOURS.getTaskKey());
    if (attribute != null) {
      //TODO WORKAROUND - remove later
      if (!attribute.getMetaData().getType().equals(IRedmineConstants.EDITOR_TYPE_DURATION)) {
        attribute.getMetaData().setType(IRedmineConstants.EDITOR_TYPE_DURATION);
      }
      attributeList.add(attribute.getId());
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(composite, toolkit);
      attributeEditor.createControl(composite, toolkit);
      attributeEditor.setDecorationEnabled(false);
      layoutHelper.setLayoutData(attributeEditor);
      editorToolkit.adapt(attributeEditor);
     
      attributeEditor.getControl();
    }
   

    attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_ACTIVITY.getTaskKey());
    if (attribute != null) {
      attributeList.add(attribute.getId());
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(composite, toolkit);
      attributeEditor.createControl(composite, toolkit);
      attributeEditor.setDecorationEnabled(false);
      layoutHelper.setLayoutData(attributeEditor);
      editorToolkit.adapt(attributeEditor);
    }
   
    attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_COMMENTS.getTaskKey());
    if (attribute != null) {
      attributeList.add(attribute.getId());
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(composite, toolkit);
      attributeEditor.createControl(composite, toolkit);
      attributeEditor.setDecorationEnabled(false);
      layoutHelper.setLayoutData(attributeEditor);
      editorToolkit.adapt(attributeEditor);
    }

    for (TaskAttribute childAttribute : root.getAttributes().values()) {
      if(childAttribute.getId().startsWith(IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_EX)) {
        attributeList.add(childAttribute.getId());
        attributeEditor = createAttributeEditor(childAttribute);
        attributeEditor.createLabelControl(composite, toolkit);
        attributeEditor.createControl(composite, toolkit);
        attributeEditor.setDecorationEnabled(false);
        layoutHelper.setLayoutData(attributeEditor);
        editorToolkit.adapt(attributeEditor);
      }
    }
   
    for (TaskAttribute childAttribute : root.getAttributes().values()) {
      if(childAttribute.getId().startsWith(IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_CF)) {
        attributeList.add(childAttribute.getId());
        attributeEditor = createAttributeEditor(childAttribute);
        attributeEditor.createLabelControl(composite, toolkit);
        attributeEditor.createControl(composite, toolkit);
        attributeEditor.setDecorationEnabled(false);
        layoutHelper.setLayoutData(attributeEditor);
        editorToolkit.adapt(attributeEditor);
      }
    }
   
    toolkit.paintBordersFor(composite);
View Full Code Here

    }
   
    getEditorComposite().layout();
     
    //create and add new CustomFields
    AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(parent, getManagedForm().getToolkit());
   
    for (CustomField cf : customFields.values()) {
      TaskAttribute cfAttribute = rootAttribute.getAttribute(IRedmineConstants.TASK_KEY_PREFIX_ISSUE_CF + cf.getId());
      if (cfAttribute!=null) {
        AbstractAttributeEditor cfEditor = getAttributeEditorFactory().createEditor(cfAttribute.getMetaData().getType(), cfAttribute);

        cfEditor.createLabelControl(parent, getManagedForm().getToolkit());
        cfEditor.createControl(parent, getManagedForm().getToolkit());
        layoutHelper.setLayoutData(cfEditor);
       
        getAttributeEditorToolkit().adapt(cfEditor);
        attributeEditors.put(cfAttribute, cfEditor);
      }
    }
View Full Code Here

    private void expandTimeEntry(FormToolkit toolkit, Composite composite, boolean expanded) {
//      buttonComposite.setVisible(expanded);
      if (expanded) {
        AttributeEditorToolkit editorToolkit = getTaskEditorPage().getAttributeEditorToolkit();

        AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(composite, toolkit, true);
       
        List<TaskAttribute> attributes = new ArrayList<TaskAttribute>();
        attributes.add(RedmineTaskTimeEntryMapper.getCommentsAttribute(attribute));
        attributes.addAll(RedmineTaskTimeEntryMapper.getCustomAttributes(attribute));
       
        for (TaskAttribute taskAttribute : attributes) {
          AbstractAttributeEditor editor = createAttributeEditor(taskAttribute);
          if (editor != null) {
            editor.createLabelControl(composite, toolkit);
            editor.createControl(composite, toolkit);
           
           
//            editor.getControl().addMouseListener(new MouseAdapter() {
//              @Override
//              public void mouseDown(MouseEvent e) {
//                getTaskEditorPage().selectionChanged(taskComment);
//              }
//            });

            layoutHelper.setLayoutData(editor);
            editorToolkit.adapt(editor);
           
           
          }
         
View Full Code Here

TOP

Related Classes of net.sf.redmine_mylyn.internal.ui.editor.helper.AttributePartLayoutHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.