Example #1
0
 /**
  * After XMLEncoding the handler has gone. Here we explicitly use
  * JTextComponent.installDefaultTransferHandlerIfNecessary() to put one (back) in.
  *
  * @param comps
  */
 public static void fixCopyPasteBug(JComponent comps[]) {
   for (int i = 0; i < comps.length; i++) {
     JComponent comp = comps[i];
     List recursedControls = ComponentUtils.getAllControls(comp);
     for (Iterator iterator = recursedControls.iterator(); iterator.hasNext(); ) {
       Component component = (Component) iterator.next();
       if (component instanceof JComponent) {
         ComponentUtils.fixCopyPasteBug((JComponent) component);
       }
     }
   }
 }
  private TrialEqualsByProperties() {
    createLoaderForThread(true);
    sbI1 = (SdzBagI) Utils.loadXMLFromResource(filename1, this, false);
    sbI2 = (SdzBagI) Utils.loadXMLFromResource(filename2, this, false);
    Err.pr("sbI1: " + sbI1);
    Err.pr("sbI2: " + sbI2);

    JComponent[] panels1 = sbI1.getPanes();
    JComponent[] panels2 = sbI2.getPanes();
    if (panels1.length != panels2.length) {
      Err.error("Expected the size of the panels to be the same");
    }

    WidgetClassifier wc = new WidgetClassifier();
    ReasonNotEquals.turnOn(true);
    for (int i = 0; i < panels1.length; i++) {
      JComponent component1 = panels1[i];
      JComponent component2 = panels2[i];
      if (ComponentUtils.equalsByProperties(component1, component2, wc)) {
        Err.pr("Found to be equal");
      } else {
        Err.pr("Found to be NOT equal: " + ReasonNotEquals.formatReasons());
        break;
      }
    }
    ReasonNotEquals.turnOn(false);
  }