XMLWordPrintable

    Details

    • Type: Sub-document
    • Status: Closed
    • Severity: Medium
    • Resolution: Fixed
    • Affects Version/s: 3.0.0 GA, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0 GA, 3.1.1, 3.1.2, 3.1.3, 3.2.0 GA
    • Component/s: None
    • Labels:
      None
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.

      Description

      Hi,

      I have made some enhancements on the TransGraph.java class which
      allows me to enable/disable multiple hops at once.

      I am posting changes in this issue, because I haven't found any documentation where to commit code snippets.

      Here are the code changes of the org.pentaho.di.ui.spoon.trans.TransGraph class:

      /**

      • Added
      • This procedure handels the multi hop enabling/disabling
      • @param List of points which are connected through the hops
        **/
        public void enableAllHops(Point[] points)
        {
        StepMeta[] selection = transMeta.getSelectedSteps();
        // Shift from Array to Linear List
        List<StepMeta> list = new ArrayList<StepMeta>();
        for(StepMeta sm : selection)
        list.add(sm);

      for (Point p : points)
      {
      StepMeta smFrom = transMeta.getStep(p.x, p.y, iconsize);
      StepMeta smTo = null;
      int i;

      for (i = 0; i < transMeta.nrTransHops(); i++)
      {
      TransHopMeta hi = transMeta.getTransHop;
      if (hi.getFromStep().equals(smFrom))
      {
      smTo = hi.getToStep();
      if (!list.contains(smTo)) continue;

      TransHopMeta thm = transMeta.findTransHop(smFrom,smTo,true);
      if (thm != null)
      {
      TransHopMeta before = (TransHopMeta) thm.clone();
      thm.setEnabled(!thm.isEnabled());
      TransHopMeta after = (TransHopMeta) thm.clone();
      spoon.addUndoChange(transMeta, new TransHopMeta[]

      { before }, new TransHopMeta[] { after }, new int[] { transMeta .indexOfTransHop(hi) });
      }
      }
      }
      }
      }

      /**
      * Changed Procedure
      * Checks whether more than one hop is selected or not
      * If so, call procedure enableAllHops(Point[] points)
      */
      public void enableHop() {

      Point[] points = transMeta.getSelectedStepLocations();
      if (points != null && points.length > 1)
      { enableAllHops(points); spoon.refreshGraph(); spoon.refreshTree(); }
      else
      {
      selrect = null;
      TransHopMeta hi = getCurrentHop();
      TransHopMeta before = (TransHopMeta) hi.clone();
      hi.setEnabled(!hi.isEnabled());
      if (transMeta.hasLoop(hi.getToStep())) { hi.setEnabled(!hi.isEnabled()); MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING); mb.setMessage(Messages.getString("TransGraph.Dialog.LoopAfterHopEnabled.Message")); //$NON-NLS-1$ mb.setText(Messages.getString("TransGraph.Dialog.LoopAfterHopEnabled.Title")); //$NON-NLS-1$ mb.open(); } else {
      TransHopMeta after = (TransHopMeta) hi.clone();
      spoon.addUndoChange(transMeta, new TransHopMeta[] { before }

      , new TransHopMeta[]

      { after }

      , new int[]

      { transMeta .indexOfTransHop(hi) }

      );
      spoon.refreshGraph();
      spoon.refreshTree();
      }
      }
      }

      I missed such feature for a long time so I decided to implemented by myself.
      I hope you can use this code.

      Best Regards
      Mirko

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jtcornelius Jake Cornelius (Inactive)
                Reporter:
                mschuh Mirko Schuh
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: