예제 #1
0
 public void setStateDeleted() {
   switch (panelState) {
     case LOADED:
       System.err.println("Deleting loaded panel");
       setPanelState(DELETED);
       break;
     case UPDATED:
       System.err.println("Deleting updated panel");
       setPanelState(DELETED);
       break;
     case INSERTED:
       System.err.println("Deleting inserted panel. No action.");
       setPanelState(INITIALIZED);
       break;
     case INITIALIZED:
     case NO_STATE:
       System.err.println("Ignoring delete for current panel.");
       break;
   }
 }
예제 #2
0
 public void setInitMessage(Message msg) {
   /*
    * switch (getPanelState()) { case INITIALIZED:
    * System.err.println("Reinitializing panel"); break; case INSERTED:
    * System.err.println("OK: Initializing newly inserted panel"); break;
    * case LOADED: System.err.println("Reinitializing loaded panel");
    * break; case UPDATED:
    * System.err.println("Reinitializing updated panel, discarding changes"
    * ); break; }
    */
   setPanelState(INITIALIZED);
   initMessage = msg;
   // init(initMessage);
 }
예제 #3
0
 public void setStateUpdated() {
   switch (panelState) {
     case LOADED:
       setPanelState(UPDATED);
       break;
     case INSERTED:
       System.err.println("Setting inserted panel to updated. Ignoring.");
       break;
     case UPDATED:
       break;
     default:
       System.err.println("Attempting to set to updated from illegal state. Ignoring");
       // panelState = UPDATED;
   }
 }
예제 #4
0
  public void setStateInserted() {

    switch (panelState) {
      case INSERTED:
        System.err.println("Setting inserted panel to inserted. Ignoring.");
        break;
      case INITIALIZED:
        setPanelState(INSERTED);
        break;
      default:
        System.err.println(
            "Attempting to set to inserted from illegal state. Ignoring. State: "
                + getPanelState());
        // panelState = UPDATED;
    }
  }
예제 #5
0
 public void setLoadMessage(Message msg) {
   // switch (getPanelState()) {
   // case NO_STATE:
   // System.err.println("WARNING: Loading panel without initializing first");
   // break;
   // case INSERTED:
   // System.err.println("WARNING: Loading newly inserted panel");
   // break;
   // case LOADED:
   // System.err.println("Reloading panel");
   // break;
   // case UPDATED:
   // System.err.println("Reverting updated panel");
   // break;
   // }
   setPanelState(LOADED);
   loadMessage = msg;
   // load(loadMessage);
 }
예제 #6
0
 public void commit() {
   hasExceptions = false;
   switch (panelState) {
     case INITIALIZED:
       System.err.println("Store: Discarding initialized panel");
       break;
     case INSERTED:
       insert();
       break;
     case LOADED:
       System.err.println("Ignoring unchanged panel");
       break;
     case NO_STATE:
       System.err.println("Warning: Updating panel without state");
       break;
     case UPDATED:
       store();
       break;
     case DELETED:
       delete();
       break;
   }
   ArrayList<Component> al = getAllPanels();
   if (al.size() > 0) {
     // System.err.println("End of commit panel. Now committing subpanels.");
     for (int i = 0; i < al.size(); i++) {
       BasePanel aw = (BasePanel) al.get(i);
       aw.commit();
     }
     // System.err.println("Committed subpanels.");
   }
   if (!hasExceptions()) {
     setPanelState(LOADED);
   } else {
     System.err.println("This panel had errors: " + this);
   }
 }
예제 #7
0
 public void setStateInitialized() {
   setPanelState(INITIALIZED);
 }