Esempio n. 1
0
  // masuda$
  // ChartEventListener
  @Override
  public void propertyChange(PropertyChangeEvent pce) {

    if (tableModel == null) {
      return;
    }

    ChartEventModel evt = (ChartEventModel) pce.getNewValue();

    int sRow = -1;
    long ptPk = evt.getPtPk();
    List<PatientModel> list = tableModel.getDataProvider();

    // minagawa^
    // ChartEventModel.EVENT eventType = evt.getEventType();
    int eventType = evt.getEventType();
    // minagawa$

    switch (eventType) {
      case ChartEventModel.PVT_STATE:
        for (int row = 0; row < list.size(); ++row) {
          PatientModel pm = list.get(row);
          if (ptPk == pm.getId()) {
            sRow = row;
            pm.setOwnerUUID(evt.getOwnerUUID());
            break;
          }
        }
        break;
      case ChartEventModel.PM_MERGE:
        for (int row = 0; row < list.size(); ++row) {
          PatientModel pm = list.get(row);
          if (ptPk == pm.getId()) {
            sRow = row;
            // pm = msg.getPatientModel();
            list.set(row, evt.getPatientModel());
            break;
          }
        }
        break;
      case ChartEventModel.PVT_MERGE:
        for (int row = 0; row < list.size(); ++row) {
          PatientModel pm = list.get(row);
          if (ptPk == pm.getId()) {
            sRow = row;
            // pm = msg.getPatientVisitModel().getPatientModel();
            list.set(row, evt.getPatientVisitModel().getPatientModel());
            break;
          }
        }
        break;
      default:
        break;
    }

    if (sRow != -1) {
      tableModel.fireTableRowsUpdated(sRow, sRow);
    }
  }
 public void update(TileScript me, int index) {
   data.set(index, me);
   fireContentsChanged(this, index, index);
 }
 /**
  * If setting indicates, move all overloaded methods (of the same name) adjacent with the first
  * encountered. Sort in the configured order (original order, or by number of parameters).
  */
 public static void handleOverloadedMethods(
     List<ClassContentsEntry> contents, RearrangerSettings settings) {
   if (!settings.isKeepOverloadedMethodsTogether()) return;
   /**
    * first, detect overloaded methods and move them to the first method's list of overloaded
    * methods. Make two passes, first for extracted methods, then for non-extracted methods. This
    * will organize any overloaded methods for extracted methods with them (as opposed to whichever
    * was seen first.)
    */
   cullOverloadedMethods(contents, true);
   LOG.debug("entered handleOverloadedMethods(): move overloaded methods together");
   cullOverloadedMethods(contents, false);
   List<ClassContentsEntry> copy = new ArrayList<ClassContentsEntry>(contents);
   for (ClassContentsEntry rangeEntry : copy) {
     if (rangeEntry instanceof RelatableEntry) {
       MethodEntry current = (MethodEntry) rangeEntry;
       if (current.myOverloadedMethods.size() > 0) {
         List<MethodEntry> newList =
             new ArrayList<MethodEntry>(current.myOverloadedMethods.size() + 1);
         newList.add(current);
         /**
          * we are looking at the head of a list of overloaded methods. We need to sort the list if
          * necessary and, if the head of the list has changed, replace it in the contents array.
          */
         switch (settings.getOverloadedOrder()) {
           case RearrangerSettings.OVERLOADED_ORDER_RETAIN_ORIGINAL:
             // list is already in original order, except perhaps that the top-most extracted
             // method
             // comes first (if there is one).
             newList.addAll(current.myOverloadedMethods);
             break;
           case RearrangerSettings.OVERLOADED_ORDER_ASCENDING_PARAMETERS:
           case RearrangerSettings.OVERLOADED_ORDER_DESCENDING_PARAMETERS:
             for (MethodEntry entry : current.myOverloadedMethods) {
               boolean inserted = false;
               for (int index = 0; index < newList.size(); index++) {
                 MethodEntry me = newList.get(index);
                 if (settings.getOverloadedOrder()
                         == RearrangerSettings.OVERLOADED_ORDER_ASCENDING_PARAMETERS
                     ? me.getnParameters() > entry.getnParameters()
                     : me.getnParameters() < entry.getnParameters()) {
                   newList.add(index, entry);
                   inserted = true;
                   break;
                 }
               }
               if (!inserted) {
                 newList.add(entry);
               }
             }
             break;
         }
         current.myOverloadedMethods.clear();
         /**
          * if the head of the arraylist is not the same as "current", then the sort operation
          * moved another method to the head of the list. Replace that in the contents array. Then
          * assign a new ordered list.
          */
         int index = contents.indexOf(current);
         if (newList.get(0) != current) {
           contents.set(index, ((MethodEntry) newList.get(0)));
         }
         /** insert the remaining overloaded methods after the current entry. */
         newList.remove(0);
         for (int j = 0; j < newList.size(); j++) {
           contents.add(index + j + 1, ((MethodEntry) newList.get(j)));
         }
       }
     }
   }
 }