コード例 #1
0
ファイル: ProgramCanvas.java プロジェクト: RWTH-OS/MP-MPICH
  /** Return the state upon which the given x and y coordinates are placed */
  private StateInterval findState(int x, int y) {
    int dIndex = y / eachDispHt;

    if (((Integer) dtypeV.elementAt(dIndex)).intValue() != CONST.TIMELINES) return null;

    int index = findIndex(y % eachDispHt);

    y = y % eachDispHt;

    if (index != -1) {
      StateGroup currProc = (StateGroup) (all_states.visible.elementAt(index));
      if (currProc.dispStatus) {
        Enumeration e = currProc.elements();
        while (e.hasMoreElements()) {
          StateInterval currState = (StateInterval) e.nextElement();
          // Determining using position (less accurate)
          if (currState.info.stateDef.checkbox.isSelected()
              && (getEvtXCord(currState.info.begT - currImg.begT) <= cursorPos)
              && (cursorPos <= getEvtXCord(currState.info.endT - currImg.begT))
              && checkLevel(currState, y)) return currState;
        }
      }
    }
    return null;
  }
コード例 #2
0
ファイル: ProgramCanvas.java プロジェクト: RWTH-OS/MP-MPICH
 /**
  * This method returns the maximum value in pixels that the time line can be moved to the left
  * before reaching the (begTime) time position p = the process whose time line is to be moved
  */
 int getMaxDiff(StateGroup group) {
   if (group.size() > 0) {
     StateInterval state = (StateInterval) group.firstElement();
     // return getEvtXCord (state.info.begT - 0.0);
     return getEvtXCord(state.info.begT - FrameBegTime);
   }
   return 0;
 }
コード例 #3
0
ファイル: ProgramCanvas.java プロジェクト: RWTH-OS/MP-MPICH
  //  private void adjustPosition()
  public void adjustPosition() {
    StateGroup group;
    StateInterval state;
    double duration;
    double max_duration = 0;

    Enumeration groups = all_states.visible.elements();
    while (groups.hasMoreElements()) {
      group = (StateGroup) groups.nextElement();
      if (group.size() > 0) {
        state = (StateInterval) group.lastElement();
        duration = state.info.endT - FrameBegTime;
        if (duration > max_duration) max_duration = duration;
      }
    }

    boolean end = false;

    if (max_duration < tMaxT || max_duration > tMaxT) {
      if (max_duration < tMaxT) end = true;
      double diff = tMaxT - max_duration;
      tMaxT = max_duration;
      maxT -= diff;
      updateH();
      parent.setHoriz();
      centralizeH();
    }

    if (end) {
      if ((parent.hbar.getValue() + parent.hbar.getVisibleAmount()) >= parent.hbar.getMaximum()) {
        parent.hbar.setValue(maxH - widthCan);
        adjustImgH(parent.hbar.getValue());
        parent.vport.setViewPosition(new Point(panePosX, 0));
        debug.println("adjustPosition() : ");
        debug.println("\t" + "parent.hbar.setValue(" + (maxH - widthCan) + ")");
        debug.println("\t" + "parent.vport.setViewPosition(" + panePosX + ", 0)");
      }
    }
  }