@SuppressWarnings("unchecked")
	public void handleFieldEvent(Object source, DocumentEvent evt) {
		
		if(evt!=null){
			this.notifyChange(evt);
			return;
		}else{
			/*
			evt = new DocumentEvent(){ //placeholder for null
				public Document mySource = null;
				@Override
				public ElementChange getChange(Element arg0) {
					return null;
				}
				@Override
				public Document getDocument() {
					return mySource;
				}
				@Override
				public int getLength() {
					return 0;
				}
				@Override
				public int getOffset() {
					return 0;
				}
				@Override
				public EventType getType() {
					return null;
				}};
				*/
		}
		
		//boolean DEBUG = true;
		if(this.setTxtMode==source) {
			if(DEBUG)System.err.println("MotionEditor:handleFieldEvent: setText");
			switchMode(D_Document.TXT_BODY_FORMAT);
			this.notifyChange(evt);
			if(DEBUG) System.out.println("MotionEditor:handleFieldEvent: done");
		}
		if(this.setHTMMode==source) {
			if(DEBUG)System.err.println("MotionEditor:handleFieldEvent: setHTM");
			switchMode(D_Document.HTM_BODY_FORMAT);
			this.notifyChange(evt);
			if(DEBUG) System.out.println("MotionEditor:handleFieldEvent: done");
		}
		if(this.sync_changes==source) {
			if(DEBUG)System.err.println("MotionEditor:handleFieldEvent: sync");
			editor.updateDoc(data);
			this.notifyChange(evt);
			if(DEBUG) System.out.println("MotionEditor:handleFieldEvent: done");
		}
		if(this.load_field==source) {
			if(DEBUG)System.err.println("ControlPane:actionImport: import file");
			int returnVal = MotionEditor.fd.showOpenDialog(this);
			if(DEBUG)System.err.println("ControlPane:actionImport: Got: selected");
	        if (returnVal == JFileChooser.APPROVE_OPTION) {
	        	if(DEBUG)System.err.println("ControlPane:actionImport: Got: ok");
	            File file = MotionEditor.fd.getSelectedFile();
	            if(!file.exists()){
	            	Application_GUI.warning(_("The file does not exists: "+file),_("Importing Address")); return;
	            }
	            String ext = Util.getExtension(file);
	            if(ext!=null) ext = ext.toLowerCase();
	            try {
	            	boolean _DEBUG = true;
					if("pdf".equals(ext)) {
	            		if(DEBUG)System.err.println("ControlPane:actionImport: Got: pdf");
	            		try {
	            			// File f = new File("/home/msilaghi/CS_seminar_flyer.pdf");
	            			InputStream in = new FileInputStream(file); // "/home/msilaghi/CS_seminar_flyer.pdf");
	            			if(file.length() > DocumentEditor.MAX_PDF) {
	            				if(_DEBUG) System.out.println("OrgEditor: getText: bin size="+file.length()+" vs "+DocumentEditor.MAX_PDF);
	            				Application_GUI.warning(_("File too large! Current Limit:"+" "+file.length()+"/"+DocumentEditor.MAX_PDF),
	            						_("Document too large for import!"));
	            				in.close();
	            				return;
	            			}
	            			byte bin[] = new byte[(int)file.length()];
	            			int off = 0;
	            			do{
	            				int cnt = in.read(bin, off, bin.length-off);
	            				if(cnt == -1) {
	            					if(_DEBUG) System.out.println("OrgEditor: getText: crt="+cnt+" off="+off+"/"+bin.length);
	            					break;
	            				}
	            				off +=cnt;
            					if(_DEBUG) System.out.println("OrgEditor: getText: crt="+cnt+" off="+off+"/"+bin.length);
	            			}while(off < bin.length);
	            			in.close();
	            			if(DEBUG) System.out.println("DocumentEditor: handle: bin size="+bin.length);
	            			String data = Util.stringSignatureFromByte(bin);
	            			if(DEBUG) System.out.println("DocumentEditor: handle: txt size="+data.length());
	            			
	            			setMode(D_Document.PDF_BODY_FORMAT, data);
	            			
							this.notifyChange(evt);
	            		} catch (FileNotFoundException e) {
	            			e.printStackTrace();
	            		} catch (IOException e) {
	            			e.printStackTrace();
	            		}
	            	}else
	            		if(("html".equals(ext)) || ("htm".equals(ext))){
	            			if(_DEBUG)System.err.println("ControlPane:actionImport: Got: html: implement!");
	            			try{
	            				BufferedReader bri = new BufferedReader(new FileReader(file));
								String data = Util.readAll(bri);
								
								setMode(D_Document.HTM_BODY_FORMAT, data);
								
								this.notifyChange(evt);
	            			}catch(Exception e){
	            				e.printStackTrace();
	            			}
	            		}else
	            			if(("txt".equals(ext))){
	            				try{
		            				BufferedReader bri = new BufferedReader(new FileReader(file));
									String data = Util.readAll(bri);
									
									setMode(D_Document.TXT_BODY_FORMAT, data);
									
									this.notifyChange(evt);
		            			}catch(Exception e){
		            				e.printStackTrace();
		            			}
	            			}else
	            				if(_DEBUG)System.err.println("ControlPane:actionImport: Got: "+ext+": implement!");
	            }catch(Exception e){
	            	e.printStackTrace();
	            }
	        }
		}
	}