/* A basic implementation of the JFrame class. */ package application.draw; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.Insets; import java.awt.MediaTracker; import java.awt.Point; import java.io.BufferedReader; import java.io.File; import java.io.StringReader; import java.util.Vector; import javax.swing.*; import application.texteditor.TextEditFrame; import java.net.*; import java.awt.Robot; import java.awt.Rectangle; import java.awt.image.BufferedImage; import controlledparts.*; import application.texteditor.*; import connector.*; import connector.PukiwikiApplet; /** * This code was generated using CloudGarden's Jigloo * SWT/Swing GUI Builder, which is free for non-commercial * use. If Jigloo is being used commercially (ie, by a corporation, * company or business for any purpose whatever) then you * should purchase a license for each developer using Jigloo. * Please visit www.cloudgarden.com for details. * Use of Jigloo implies acceptance of these licensing terms. * ************************************* * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED * for this machine, so Jigloo or this code cannot be used legally * for any corporate or commercial purpose. * ************************************* */ // DrawFrame for DSR/Solar-CATS public class DrawFrame extends ControlledFrame implements DialogListener, FrameWithControlledButton, FrameWithControlledFigCanvas, // FrameWithControlledPane, FrameWithControlledSlider, FrameWithControlledTextAreas, PukiwikiJavaApplication { public void setTextOnTheText(int id, int pos, String s) { ControlledTextArea t=(ControlledTextArea)(this.textAreas.elementAt(id)); t.setTextAt(pos, s); } public void changeStateOnTheSlider(int id, int value) { // This method is derived from interface FrameWithControlledSlider // to do: code goes here this.editdispatch.setDepth(value); this.depthIndicator.setValueX(value); } public void enterMouseOnTheSlider(int id) { // This method is derived from interface FrameWithControlledSlider // to do: code goes here this.depthIndicator.focus(); } public void exitMouseOnTheSlider(int id) { // This method is derived from interface FrameWithControlledSlider // to do: code goes here this.depthIndicator.unFocus(); } Vector states; DrawPlayState drawPlayState; public DrawEditState drawEditState; public Color getBackground() { // This method is derived from interface FrameWithControlledSlider // to do: code goes here return null; } public int getTimeNow() { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here return super.getTimeNow(); } public boolean isControlledByLocalUser() { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here return super.isControlledByLocalUser(); } public void dragMouseOnTheFigCanvas(int id, int x, int y) { canvas.dragMouse(x,y); } public Vector canvases; public void downKeyOnTheFigCanvas(int id, int key) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here canvas.downKey(key); } public void downMouseOnTheFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here canvas.downMouse(x,y); } public void enterMouseOnTheFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here canvas.enterMouse(x,y); } public void exitMouseOnTheFigCanvas(int id) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here canvas.exitMouse(); } public void keyDownedAtFigCanvas(int id, int key) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // this.canvas.keyDown(key); } public void mouseDownedAtFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // canvas.mouseDown(x,y); } public void mouseDraggedAtFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // canvas.mouseDragged(x,y); } public void mouseEnteredAtFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // canvas.mouseEntered(x,y); } public void mouseExitedAtFigCanvas(int id) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // canvas.mouseExited(); } public void mouseMovedAtFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // canvas.mouseMove(x,y); } public void mouseUpAtFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here // this.canvas.mouseUp(x,y); } public void moveMouseOnTheFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here this.canvas.moveMouse(x,y); } public void upMouseOnTheFigCanvas(int id, int x, int y) { // This method is derived from interface FrameWithControlledFigCanvas // to do: code goes here canvas.releaseMouse(x,y); } /* public boolean isShowingRmouse() { if(communicationNode==null) return false; return this.communicationNode.rmouseIsActivated; } */ public void enterMouseOnTheText(int id, int x, int y) { // ControlledTextArea t=(ControlledTextArea)(texts.elementAt(id)); // t.rmouseIsShown=true; // this.urlField.moveMouse(x,y); // t.rmouse.setVisible(true); // t.moveMouse(x,y); this.urlField.enterMouse(x,y); } public void exitMouseOnTheText(int id, int x, int y) { this.urlField.exitMouse(); } public void moveMouseOnTheText(int id, int x, int y) { this.urlField.moveMouse(x,y); } public void mouseMoveAtTextArea(int id, int x, int y) { } public void mouseEnteredAtTheText(int id, int x, int y) { } public void mouseExitAtTheText(int id, int x, int y) { } public void clearAll() { textEditFrame=new TextEditFrame(); textEditFrame.setBounds(this.getInsets().left+100, this.getInsets().right+100, 500,400); textEditFrame.setIsApplet(this.isApplet()); textEditFrame.clearAll(); /* if(this.communicationNode!=null){ textEditFrame.setIcons(this.communicationNode.getIconPlace()); textEditFrame.fileFrame.setSeparator(this.communicationNode.getSeparator()); } */ JFileChooser chooser=null; if(!this.isApplet()){ chooser=new JFileChooser(); System.out.println("this is not applet"); try{ textEditFrame.fileFrame.setFileChooser(chooser); } catch(Exception e){ System.out.println("at clearAll..."+e.toString()); } } // this.colorSelectFrame.setCommunicationNode(this.communicationNode); this.colorSelectFrame.setWords(); if(fileFrame!=null){ // this.loadFileFrame.setCommunicationNode(this.communicationNode); this.fileFrame.setWords(); } this.editdispatch.clear(); // this.drawEditState.setState(eClearButton.getID()); // editFunField.setText(eClearButton.getText()); // editdispatch.clear(); this.figSelectFrame.setState(figSelectFrame.lineButton.getID()); // figSelectorButton.setText(figSelectFrame.lineButton.getText()); // figSelectorButton.setIcon(figSelectFrame.lineButton.getIcon()); // figSelectorButton.repaint(); editdispatch.newFig(figSelectorButton.getText()); this.colorSelectFrame.setState(colorSelectFrame.blackButton.getID()); // colorSelectButton.setBackground(colorSelectFrame.blackButton.getBackground()); // colorSelectButton.setBorder1(colorSelectFrame.bevelBorder1); // colorSelectButton.setBorder2(colorSelectFrame.etchedBorder1); // colorSelectButton.repaint(); // editdispatch.changeColor(); this.widthSelectFrame.setState(widthSelectFrame.width1.getID()); // lineWidthSelectButton.setText(widthSelectFrame.width1.getText()); // lineWidthSelectButton.setIcon(widthSelectFrame.width1.getIcon()); // lineWidthSelectButton.repaint(); // editdispatch.changeWidth(); this.fontSizeSelectFrame.setState(fontSizeSelectFrame.size12.getID()); // fontSizeSelectButton.setFont(fontSizeSelectFrame.size12.getFont()); // fontSizeSelectButton.setText(fontSizeSelectFrame.size12.getText()); // fontSizeSelectButton.setIcon(fontSizeSelectFrame.size8.getIcon()); // fontSizeSelectButton.repaint(); // editdispatch.changeFontSize(); this.urlField.setText(""); this.drawPlayState.setState(this.editButton.getID()); // canvas.setPlayMode(false); // this.editButton.setText("editting"); if((fileFrame!=null)){ if(fileFrame.fileDialog!=null){ this.fileFrame.fileDialog.clickButton( fileFrame.fileDialog.clearButton.getID()); this.loadFileFrame.fileDialog.clickButton( loadFileFrame.fileDialog.clearButton.getID()); } } this.textEditFrame.clickButton( textEditFrame.clearButton.getID()); // this.eClearButton.setToolTipText(this.getLclTxt("clear")); this.eModifyButton.setToolTipText(this.getLclTxt("modify")); this.eCutButton.setToolTipText(this.getLclTxt("cut")); this.eSetButton.setToolTipText(this.getLclTxt("set")); this.eSetButton.setText(this.getLclTxt("set")); this.eSelectButton.setToolTipText(this.getLclTxt("select")); this.eMoveButton.setToolTipText(this.getLclTxt("move")); this.eCutButton.setToolTipText(this.getLclTxt("cut")); this.eRotateButton.setToolTipText(this.getLclTxt("rotate_and_expand")); this.eCopyButton.setToolTipText(this.getLclTxt("copy")); this.editButton.setToolTipText(this.getLclTxt("editting")); this.startPlayButton.setToolTipText(this.getLclTxt("play")); } public String parseCommand(String s, String appliName,ControlledFrame a){ if(s.indexOf("addfig ")==0){ String x=s.substring("addfig ".length()); BufferedReader dinstream=null; try{ dinstream=new BufferedReader( new StringReader(x) ); } catch(Exception e){ System.out.println("exception:"+e); } if(dinstream==null) return "error"; InputQueue iq=new InputQueue(dinstream); this.canvas.fs.stop(); ParseFig pf=new ParseFig(iq,this.canvas,null); pf.setApplication(appliName,a); if(x.indexOf("figures(")==0){ // if(!pf.parseFigures()) return "error"; this.editdispatch.fs.add(pf.figs); // this.editdispatch.fs=pf.figs; this.canvas.fs.add(pf.figs); this.repaint(); this.canvas.fs.start(); } else{ if(!pf.parseFig()) return "error"; this.editdispatch.fs.add(pf.afig); // this.editdispatch.fs=pf.figs; this.canvas.fs.add(pf.afig); this.repaint(); this.canvas.fs.start(); } return ""; } if(s.indexOf("btn.click(")==0){ String x=s.substring("btn.click(".length()); String ix=x.substring(0,x.indexOf(")")); int ii=(new Integer(ix)).intValue(); this.clickButton(ii); return ""; } if(s.indexOf("moveFig(")==0){ // moveFig(x,y) int sign=1; String sx=s.substring("moveFig(".length()); String sxx=sx.substring(0,sx.indexOf(",")); if(sxx.indexOf("-")==0){ sign=-1; sxx=sxx.substring("-".length()); } int ix=(new Integer(sxx)).intValue(); ix=sign*ix; String sy=sx.substring(",".length()+1); String syy=sy.substring(0,sy.indexOf(")")); sign=1; if(syy.indexOf("-")==0){ sign=-1; syy=syy.substring("-".length()); } int iy=(new Integer(syy)).intValue(); iy=sign*iy; this.editdispatch.moveFig(ix,iy); this.repaint(); return ""; } return ""; } public String parseCommand(String s) { return this.parseCommand(s, null,null); /* if(s.indexOf("addfig ")==0){ String x=s.substring("addfig ".length()); BufferedReader dinstream=null; try{ dinstream=new BufferedReader( new StringReader(x) ); } catch(Exception e){ System.out.println("exception:"+e); } if(dinstream==null) return "error"; InputQueue iq=new InputQueue(dinstream); this.canvas.fs.stop(); ParseFig pf=new ParseFig(iq,this.canvas,null); if(x.indexOf("figures(")==0){ // if(!pf.parseFigures()) return "error"; this.editdispatch.fs.add(pf.figs); // this.editdispatch.fs=pf.figs; this.canvas.fs.add(pf.figs); this.repaint(); this.canvas.fs.start(); } else{ if(!pf.parseFig()) return "error"; this.editdispatch.fs.add(pf.afig); // this.editdispatch.fs=pf.figs; this.canvas.fs.add(pf.afig); this.repaint(); this.canvas.fs.start(); } return ""; } if(s.indexOf("btn.click(")==0){ String x=s.substring("btn.click(".length()); String ix=x.substring(0,x.indexOf(")")); int ii=(new Integer(ix)).intValue(); this.clickButton(ii); return ""; } if(s.indexOf("moveFig(")==0){ // moveFig(x,y) int sign=1; String sx=s.substring("moveFig(".length()); String sxx=sx.substring(0,sx.indexOf(",")); if(sxx.indexOf("-")==0){ sign=-1; sxx=sxx.substring("-".length()); } int ix=(new Integer(sxx)).intValue(); ix=sign*ix; String sy=sx.substring(",".length()+1); String syy=sy.substring(0,sy.indexOf(")")); sign=1; if(syy.indexOf("-")==0){ sign=-1; syy=syy.substring("-".length()); } int iy=(new Integer(syy)).intValue(); iy=sign*iy; this.editdispatch.moveFig(ix,iy); this.repaint(); return ""; } return ""; */ } public FigCanvas canvas= new FigCanvas(); public void paint(Graphics g) { super.paint(g); } /* public void focusGained() { // This method is derived from interface FrameWithControlledFocus // to do: code goes here // if(sendEventFlag) sendEvent("focus.gain()\n"); } */ /* public void focusLost() { // This method is derived from interface FrameWithControlledFocus // to do: code goes here } */ /* public void gainFocus() { // This method is derived from interface FrameWithControlledFocus // to do: code goes here this.requestFocus(); } */ /* public void loseFocus() { // This method is derived from interface FrameWithControlledFocus // to do: code goes here } */ public Vector panes; public void pressMouseOnTheText(int id, int p, int x, int y) { this.urlField.pressMouse(p,x,y); } public void mousePressedAtTextArea(int id, int p, int x, int y) { } public void showScrollBar(int paneID, int barID) { ControlledScrollPane p=(ControlledScrollPane)(panes.elementAt(paneID)); p.showScrollBar(barID); } public void hideScrollBar(int paneID, int barID) { ControlledScrollPane p=(ControlledScrollPane)(panes.elementAt(paneID)); p.hideScrollBar(barID); } public void changeScrollbarValue(int paneID, int barID, int value) { ControlledScrollPane p=(ControlledScrollPane)(panes.elementAt(paneID)); p.setScrollBarValue(barID,value); } public void scrollBarHidden(int paneID, int barID) { // This method is derived from interface FrameWithControlledPane // to do: code goes here // if(sendEventFlag) // sendEvent("fc.sb.hidden("+paneID+","+barID+")\n"); } public void scrollBarShown(int paneID, int barID) { // This method is derived from interface FrameWithControlledPane // to do: code goes here // if(sendEventFlag) // sendEvent("fc.sb.shown("+paneID+","+barID+")\n"); } public void scrollBarValueChanged(int paneID, int barID, int v) { // This method is derived from interface FrameWithControlledPane // to do: code goes here // if(sendEventFlag) // sendEvent("fc.sb.value("+paneID+","+barID+","+v+")\n"); } // public String encodingCode; boolean thisIsShowed; public File getDefaultPath() { // This method is derived from interface DialogListener // to do: code goes here return null; } public Vector getDialogs() { // This method is derived from interface DialogListener // to do: code goes here return null; } public void sendFileDialogMessage(String m) { // This method is derived from interface DialogListener // to do: code goes here // if(this.sendEventFlag) sendEvent("file."+m); } public void whenActionButtonPressed(EditDialog d) { // This method is derived from interface DialogListener // to do: code goes here // if(this.controlMode.equals("receive")) return; String dname=d.getDialogName(); String urlHead="file:"; String separator=""+System.getProperty("file.separator"); editdispatch.setSeparator(separator); if(separator.equals("\\")) urlHead=urlHead+"///"; else urlHead=urlHead+"//"; String fileName=d.getText(); if(dname.equals("input common file name:")){ // String separator=""+System.getProperty("file.separator"); // String url=this.communicationNode.getCommonDirPath(); // url=url+separator+fileName; // editdispatch.read(url); editdispatch.read(urlHead+fileName); } else if(dname.equals("input user file name:")){ // String separator=""+System.getProperty("file.separator"); // String url=this.communicationNode.getUserDirPath(); // url=url+separator+fileName; // editdispatch.read(url); editdispatch.read(urlHead+fileName); } else if(dname.equals("output user file name:")){ String url=""; // String fileName=d.getText(); File userDataPath=new File(""); if(!userDataPath.exists()) userDataPath.mkdir(); // File thePath=new File(userDataPath.getPath(),fileName); // editdispatch.save(thePath); editdispatch.save(new File(fileName)); return; } else if(dname.equals("output common file name:")){ // if(!this.communicationNode.getControlMode().equals("teach")) return; // File commonDataPath=this.communicationNode.commonDataFigDir; // File thePath=new File(commonDataPath.getPath(),fileName); // System.out.println(thePath.getPath()); // editdispatch.save(thePath); editdispatch.save(new File(fileName)); return; } else if(dname.equals("url:")){ int p=fileName.length(); String x=""; if(fileName.charAt(p-1)=='\\'){ x=fileName.substring(0,p-1); } else if(fileName.endsWith("//")){ x=fileName.substring(0,p-2); } else{ x=fileName; } urlField.setText(x); this.readHtml(x); // String url=d.getText(); // editdispatch.baseDir=d.getFilePath(); // editdispatch.setSeparator("/"); // editdispatch.read(fileName); /* NetworkReader nr=new NetworkReader(fileName,this.communicationNode.getEncodingCode()); String readingText=nr.loadAndWait(); // editdispatch.read(url); if(readingText.equals("")) return; language.CQueue cq= new language.CQueue(); JTextArea t=new JTextArea(); language.ALisp lisp=new language.ALisp(t,null,cq,null); HtmlParser hp=new HtmlParser(readingText,lisp); */ } // } public void readHtml(String x){ NetworkReader nr=null; String code="UTF-8"; // if(this.communicationNode!=null) // code=this.communicationNode.getEncodingCode(); nr=new NetworkReader(x,code); String readingText=nr.loadAndWait(); // editdispatch.read(url); if(readingText.equals("")) return; /* language.CQueue cq= new language.CQueue(); JTextArea t=new JTextArea(); ALisp lisp=new language.ALisp(t,null,cq,null); HtmlParser hp=new HtmlParser(readingText,lisp); LispObject htmlObject=hp.getResult(); if(htmlObject==null) return; this.clearAll(); HtmlEnvironment htmlEnv=new HtmlEnvironment(this,htmlObject,x,lisp); htmlEnv.eval(); String codeX=htmlEnv.getCharSet(); if(!(codeX.toUpperCase()).equals(code)){ nr.stop(); nr=new NetworkReader(x,codeX); readingText=nr.loadAndWait(); if(readingText.equals("")) return; // cq=new language.CQueue(); // t.setText(""); // lisp=new language.ALisp(t,null,cq,null); // hp=new HtmlParser(readingText, lisp); // htmlObject=hp.getResult(); // if(htmlObject==null) return; // this.clearAll(); // htmlEnv=new HtmlEnvironment(this,htmlObject,x,lisp); // htmlEnv.eval(); } */ this.repaint(); this.mouseClickedAtButton(this.startPlayButton.getID()); } public String htmlToPage(String newURL) { /* if(this.communicationNode!=null){ } */ URL url=null; try{ url=new URL(newURL); } catch(MalformedURLException e) { // message.setText("MalformedURLException\n"); return "MalformedURLException"; } Object x=null; try{ x=url.getContent(); } catch(Exception e){ return e.toString(); } Class xclass=null; if(x!=null){ xclass=x.getClass(); } if(xclass!=null){ } else{ } return ""; } public void whenCancelButtonPressed(EditDialog d) { // This method is derived from interface DialogListener // to do: code goes here } public Vector fileDialogs; public FileFrame fileFrame; public JFileChooser fileChooser; public Vector textAreas; public void clickMouseOnTheText(int i, int p,int x, int y) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here this.urlField.clickMouse(p,x,y); } public void dragMouseOnTheText(int id, int position,int x, int y) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here this.urlField.dragMouse(position,x,y); } public void keyIsTypedAtATextArea(int i, int p, int key) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here } public void keyIsPressedAtATextArea(int i, int p, int key){ } public void mouseClickedAtTextArea(int i, int p, int x, int y) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here } public void mouseDraggedAtTextArea(int id, int position, int x, int y) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here } public void mouseReleasedAtTextArea(int id, int position, int x, int y) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here } public void releaseMouseOnTheText(int id, int position, int x, int y) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here this.urlField.releaseMouse(position,x,y); } public void typeKey(int i, int p, int key) { // This method is derived from interface FrameWithControlledTextAreas // to do: code goes here this.urlField.typeKey(p,key); } FontSizeSelectFrame fontSizeSelectFrame; public void clickButton(int i) { SelectedButton t=(SelectedButton)(editButtons.elementAt(i)); t.click(); // boolean tmp=this.communicationNode.directEvent; // this.communicationNode.directEvent=false; this.mouseClickedAtButton(i); // this.communicationNode.directEvent=tmp; } public void sliderStateChanged(int id, int v) { // if(sendEventFlag) this.editdispatch.setDepth(v); } public void sliderMouseExited(int i) { } public void sliderMouseEntered(int i) { } public void unfocusButton(int i) { SelectedButton button=(SelectedButton)(editButtons.elementAt(i)); // button.controlledButton_mouseExited(null); button.unFocus(); } public void focusButton(int i) { SelectedButton button=(SelectedButton)(editButtons.elementAt(i)); // button.controlledButton_mouseEntered(null); button.focus(); } public Vector editButtons; public void toFront() { // This method is derived from interface Spawnable // to do: code goes here } public void mouseExitedAtButton(int i) { // This method is derived from interface SelectButtonsFrame // to do: code goes here // if(sendEventFlag) // sendEvent("draw.btn.exit("+i+")\n"); } public void mouseEnteredAtButton(int i) { // This method is derived from interface SelectButtonsFrame // to do: code goes here // if(sendEventFlag) // sendEvent("draw.btn.enter("+i+")"); } MovieFrame movieFrame=null; public void mouseClickedAtButton(int i) { // This method is derived from interface SelectButtonsFrame // to do: code goes here SelectedButton t=(SelectedButton)(editButtons.elementAt(i)); t.click(); if(i==this.figSelectorButton.getID()){ if(figSelectFrame==null) return; figSelectFrame.setVisible(true); return; } // figSelectButton if(i==this.colorSelectButton.getID()){ if(colorSelectFrame==null) return; colorSelectFrame.setVisible(true); return; } // colorSelectButton if(i==this.lineWidthSelectButton.getID()){ widthSelectFrame.setVisible(true); return; } // lineWidthSelectButton if(i==this.fontSizeSelectButton.getID()){fontSizeSelectFrame.setVisible(true); return;} // fontSizeSelectButton if(i==this.eSetButton.getID()){ this.drawEditState.setState(i); return; } // eSetButton if(i==this.eClearButton.getID()){ this.editdispatch.clear(); return; } // eClearButton if(i==this.eRotateButton.getID()){ this.drawEditState.setState(i); return; } // eRotateButton if(i==this.eCopyButton.getID()){ this.drawEditState.setState(i); return; } // eCopyButton if(i==this.eModifyButton.getID()){ this.drawEditState.setState(i); return; } // eModifyButton if(i==this.eMoveButton.getID()){ this.drawEditState.setState(i); return; } // eMoveButton if(i==this.eCutButton.getID()){ this.drawEditState.setState(i); return; } // eCutButton if(i==this.eSelectButton.getID()){ this.drawEditState.setState(i); return; } // eSelectButton if(i==this.fileButton.getID()){ /* if(fileFrame==null) return; fileFrame.setCommonPath( new File(this.communicationNode.commonDataDir,"figs").toString()); fileFrame.setUserPath( this.communicationNode.userDataDir.toString()); fileFrame.setVisible(true); return; */ } // fileButton if(i==this.closeButton.getID()){ // closeButton // if(this.thisIsShowed){ // thisIsShowed=false; exitThis(); // } // return; } // if(i==14){ return; } if(i==this.startPlayButton.getID()){ this.drawPlayState.setState(i); return; } if(i==this.editButton.getID()){ this.editdispatch.changeMode("select"); this.drawPlayState.setState(i); return; } if(i==this.eSelectAllButton.getID()){ //selectAll this.drawEditState.setState(i); return; } if(i==this.getImageButton.getID()){ // if(this.isControlledByLocalUser()){ /* if(this.communicationNode.directEvent){ this.show(false); try{ Thread.sleep(200); } catch(InterruptedException e){} this.getImageFromDisplay(); this.show(true); } */ return; } if(i==this.sendMovieButton.getID()){ // if(this.isControlledByLocalUser()){ if(this.movieFrame==null){ this.movieFrame=new MovieFrame(this); } /* if(this.communicationNode.directEvent){ this.show(false); this.movieFrame.setVisible(true); this.movieFrame.start(); this.setVisible(false); } */ return; } } AFigure currentBackgroundImage; Robot robot=null; public void getImageFromDisplay(){ // this.editdispatch.clear(); /* if(!this.communicationNode.sendEventFlag) return; */ if(!this.isControlledByLocalUser()) return; // this.communicationNode.setStoppingLockTimer(true); Rectangle ro=this.getBounds(); Point p=ro.getLocation(); int xo=p.x; int yo=p.y; int width=ro.width; int height=ro.height; int dx=88; int dy=125; int xn=xo+dx; int yn=yo+dy; int wn=width-dx-20; int hn=height-dy-20; ro.setLocation(xn,yn); ro.width=wn; ro.height=hn; // this.show(false); // this.setVisible(false); try{ Thread.sleep(10); } catch(InterruptedException e){} try{ if(this.robot==null){ this.robot=new Robot(); } } catch(Exception e){ System.out.println(e.toString()); } BufferedImage bi=robot.createScreenCapture(ro); if(this.currentBackgroundImage==null|| this.imageManager.getImageOperator("draw-background-0")==null){ /* this.currentBackgroundImage=new MyImage(this.canvas,bi,"draw-background-0", // this.communicationNode.getNodeSettings()); null); */ currentBackgroundImage.newFig(); this.canvas.fs.add(currentBackgroundImage); this.canvas.fs.setStep(-10); currentBackgroundImage.depth=25; this.depthIndicator.setValue(currentBackgroundImage.depth); } else{ // NodeSettings s=this.communicationNode.getNodeSettings(); // ((MyImage)this.currentBackgroundImage).updateImage(bi,s.getInt("pictureSegmentWidth")); ((MyImage)this.currentBackgroundImage).updateImage(bi,128); } /* if(this.communicationNode.sendEventFlag){ // System.out.println("start sending image"); this.imageManager.start(); } */ // this.show(true); } public boolean isNoMoreSendingImage(){ if(this.imageManager.isRunning()){ return false; } return true; } public int getAnswer(String x){ // return this.communicationNode.getAnswer(x); return 0; } public void dispose() { // This method is derived from interface Spawnable // to do: code goes here super.dispose(); } public WidthSelectFrame widthSelectFrame; public ColorSelectFrame colorSelectFrame; public FigSelectFrame figSelectFrame; public void openTextEditor(DialogListener l) { textEditFrame.setListener(l); textEditFrame.setVisible(true); textEditFrame.setControlledFrame(this); } public void openImageInputDialog(DialogListener l) { this.loadFileFrame.setDialogName("imageDialog"); this.loadFileFrame.setListener(l); this.loadFileFrame.setSeparator(this.editdispatch.getSeparator()); this.loadFileFrame.setFileChooser(this.fileChooser); /* this.loadFileFrame.setCommonPath( new File(this.communicationNode.commonDataDir,"images").toString()); this.loadFileFrame.setUserPath( this.communicationNode.userDataDir.toString()); this.loadFileFrame.setVisible(true); */ } /* public String str2saveable(String str) { StringBuffer s=new StringBuffer(str); String sx=""; int i=0; int len=s.length(); while(i