00001 00066 package com.arcle.rmt.superwaba.vc; 00067 00068 import waba.ui.Window; 00069 import waba.ui.MessageBox; 00070 00071 import com.arcle.rmt.superwaba.framework.Controller; 00072 import com.arcle.rmt.superwaba.framework.Model; 00073 import com.arcle.rmt.superwaba.framework.View; 00074 import com.arcle.rmt.superwaba.model.Document; 00075 import com.arcle.rmt.superwaba.model.DocumentManager; 00076 import com.arcle.rmt.superwaba.vc.DocumentWindow; 00077 00084 public class DocumentWindowController extends ControllerBase { 00085 00086 public DocumentWindowController(Document doc) { 00087 _document = doc; 00088 } 00089 00090 00091 //----------------------------------------------------------------------- 00092 // Controller implementations 00093 00094 public void viewInitialized(View v) { 00095 DocumentWindow dw = (DocumentWindow) v; 00096 super.viewInitialized(dw); 00097 dw.repaintNow(); 00098 } 00099 00100 //----------------------------------------------------------------------- 00101 // Command Handlers 00102 00103 00107 public void cmdCloseWindow() { 00108 DocumentWindow view = (DocumentWindow) getView(); 00109 view.unpop(); 00110 00111 } 00112 00117 public void cmdDeleteDocument() { 00118 DocumentWindow view = (DocumentWindow) getView(); 00119 MessageBox mb = createDeleteMessageBox(); 00120 view.popupBlockingModal(mb); 00121 if (mb.getPressedButtonIndex() == 0) { 00122 view.unpop(); 00123 getDocument().setDeleted(); 00124 } 00125 } 00126 00127 //----------------------------------------------------------------------- 00128 // Factory methods 00129 00133 protected MessageBox createDeleteMessageBox() { 00134 return new MessageBox( 00135 "Delete Document", 00136 "Delete the current document?|This cannot be undone.", 00137 new String[] { 00138 "Yes", 00139 "No" 00140 } 00141 ); 00142 } 00143 00144 00145 00146 //----------------------------------------------------------------------- 00147 // Accessor Methods 00148 00152 public Document getDocument() { 00153 return _document; 00154 } 00155 00156 //----------------------------------------------------------------------- 00157 // Member Variables 00158 00159 00163 private Document _document = null; 00164 }