Changeset 282
- Timestamp:
- 08/27/08 09:18:49 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 28 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r278 r282 234 234 */ 235 235 public static void LoadMethods(Class c) { 236 assert (c != null);237 236 assert (c != null); 237 238 238 // list of methods to test 239 239 Method[] toLoad = c.getMethods(); … … 306 306 String mname = getName(command); 307 307 command = command.substring(mname.length()).trim(); 308 // If no params are provided get them from a text item on the cursor309 if (command.length() == 0 && launcher instanceof Text){308 // If no params are provided get them from a text item on the cursor 309 if (command.length() == 0 && launcher instanceof Text) { 310 310 command = launcher.getText(); 311 311 } … … 366 366 } 367 367 } 368 // If the actions was not found... then it is run as an agent368 // If the actions was not found... then it is run as an agent 369 369 assert (possibles.size() > 0); 370 370 throw new RuntimeException("Incorrect parameters for " + mname); … … 412 412 // determine correct parameters for constructor 413 413 for (Constructor c : constructors) { 414 if (parameters.length() > 0 415 && c.getParameterTypes().length == 1) { 414 Class[] paramTypes = c.getParameterTypes(); 415 int paramCount = paramTypes.length; 416 if (paramCount > 0) { 417 params = new Object[paramCount]; 418 String[] paramStrings = parameters.split("\\s+"); 419 if (paramCount != paramStrings.length) 420 continue; 421 for (int i = 0; i < paramCount; i++) { 422 if (paramTypes[i].equals(int.class) 423 || paramTypes[i].equals(Integer.class)) { 424 try { 425 params[i] = Integer.parseInt(paramStrings[i]); 426 } catch (Exception e) { 427 continue; 428 } 429 } else if (paramTypes[i].equals(double.class) 430 || paramTypes[i].equals(Double.class)) { 431 try { 432 params[i] = Double.parseDouble(paramStrings[i]); 433 } catch (Exception e) { 434 continue; 435 } 436 } else if (paramTypes[i].equals(String.class)) { 437 params[i] = paramStrings[i]; 438 } else { 439 continue; 440 } 441 } 416 442 con = c; 417 params = new String[1];418 params[0] = parameters;419 443 break; 420 444 } else if (c.getParameterTypes().length == 0 && con == null) { … … 543 567 544 568 // if the first class in the list is a frame or item, it is the source 545 // or launcher569 // or launcher 546 570 // length must be at least one if we are still running 547 571 if (paramTypes[ind] == Frame.class) { … … 550 574 } 551 575 552 // Check if the second item is an item576 // Check if the second item is an item 553 577 if (paramCount > ind && Item.class.isAssignableFrom(paramTypes[ind])) { 554 578 objects[ind] = launcher; 555 579 ind++; 556 }// If there is stuff on the cursor use it for the rest of the params557 else if (launcher != null && launcher.isFloating()) {580 }// If there is stuff on the cursor use it for the rest of the params 581 else if (launcher != null && launcher.isFloating()) { 558 582 values = launcher.getText(); 559 583 } … … 702 726 } 703 727 704 public static Object PerformActionCatchErrors(Frame current, Item launcher, String command) { 705 try{ 728 public static Object PerformActionCatchErrors(Frame current, Item launcher, 729 String command) { 730 try { 706 731 return PerformAction(current, launcher, command); 707 } catch(Exception e) {732 } catch (Exception e) { 708 733 MessageBay.errorMessage(e.getMessage()); 709 734 } -
trunk/src/org/expeditee/actions/MailActions.java
r247 r282 5 5 import org.expeditee.agents.mail.MailSession; 6 6 import org.expeditee.gui.DisplayIO; 7 import org.expeditee.gui.Frame; 8 import org.expeditee.gui.FrameKeyboardActions; 7 9 import org.expeditee.gui.FrameMouseActions; 10 import org.expeditee.items.Item; 11 import org.expeditee.items.Text; 8 12 9 13 public class MailActions { … … 27 31 28 32 public static String getNewMailString() { 29 String mail = MailSession.getInstance().getMailString(Flag.RECENT, true); 33 String mail = MailSession.getInstance() 34 .getMailString(Flag.RECENT, true); 30 35 if (mail.length() == 0) { 31 36 return "No new mail"; … … 41 46 return mail; 42 47 } 43 48 44 49 public static void getUnreadMail() { 45 MailSession.getInstance().getMail(Flag.SEEN, false, DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition()); 50 MailSession.getInstance().getMail(Flag.SEEN, false, 51 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition()); 46 52 } 47 53 48 54 public static void getAllMail() { 49 MailSession.getInstance().getMail(null, null, DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition()); 55 MailSession.getInstance().getMail(null, null, 56 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition()); 50 57 } 51 58 52 59 public static void getNewMail() { 53 MailSession.getInstance().getMail(Flag.RECENT, true, DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition()); 60 MailSession.getInstance().getMail(Flag.RECENT, true, 61 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition()); 54 62 } 55 63 … … 83 91 } 84 92 93 public static void reply(Frame frame, Item reply) { 94 String fromAddress = frame.getAnnotationValue("from"); 95 if (fromAddress == null) { 96 return; 97 } 98 String fromName = frame.getAnnotationValue("fromName"); 99 100 reply.setActions(null); 101 FrameMouseActions.tdfc(reply); 102 103 Frame replyFrame = DisplayIO.getCurrentFrame(); 104 replyFrame.setTitle("RE: " + frame.getTitle()); 105 FrameKeyboardActions.Drop(null, false); 106 Text original = replyFrame.createNewText("@original"); 107 original.setPosition(FrameMouseActions.getPosition()); 108 original.setLink(frame.getName()); 109 FrameKeyboardActions.Drop(original, false); 110 111 Text to = replyFrame.createNewText("@to: " + fromAddress); 112 to.setPosition(FrameMouseActions.getPosition()); 113 to.addAction("MailFrame"); 114 FrameKeyboardActions.Drop(to, false); 115 if (fromName != null) { 116 Text toName = replyFrame.createNewText("@toName: " + fromName); 117 toName.setPosition(FrameMouseActions.getPosition()); 118 FrameKeyboardActions.Drop(toName, false); 119 } 120 } 121 85 122 } -
trunk/src/org/expeditee/actions/Misc.java
r278 r282 107 107 * 108 108 */ 109 public static void DeleteFrame() { 110 Frame toDelete = DisplayIO.getCurrentFrame(); 109 public static void DeleteFrame(Frame toDelete) { 111 110 String deletedFrame = toDelete.getName(); 112 111 String deletedFrameNameLowercase = deletedFrame.toLowerCase(); … … 770 769 public static void importFiles(Item item) { 771 770 List<File> files = new LinkedList<File>(); 772 for (String s : item.getText().split("\ n")) {773 File file = new File(s );771 for (String s : item.getText().split("\\s+")) { 772 File file = new File(s.trim()); 774 773 if (file.exists()) { 775 774 files.add(file); … … 784 783 785 784 public static void importFile(Item item) { 786 File file = new File(item.getText() );785 File file = new File(item.getText().trim()); 787 786 if (file.exists()) { 788 787 try { … … 810 809 double curAngle = 0; 811 810 double size = 50F; 812 if (item instanceof Dot&& item.getLines().size() > 0) {811 if (item.isLineEnd() && item.getLines().size() > 0) { 813 812 item = item.getLines().get(0); 814 813 } -
trunk/src/org/expeditee/agents/MailTree.java
r278 r282 8 8 import org.expeditee.gui.AttributeValuePair; 9 9 import org.expeditee.gui.Frame; 10 import org.expeditee.gui.FrameIO; 10 11 import org.expeditee.gui.FreeItems; 11 12 import org.expeditee.items.Item; 12 13 import org.expeditee.items.Text; 13 14 14 public class Mail Frame extends DefaultAgent {15 public class MailTree extends DefaultAgent { 15 16 16 17 @Override 17 18 public boolean initialise(Frame frame, Item item) { 18 19 return super.initialise(frame, item); 20 } 21 22 private String getFrameText(Frame frame, String prefix) { 23 StringBuffer sb = new StringBuffer(); 24 // Get the text to mail 25 for (Text t : frame.getBodyTextItems(false)) { 26 if (t.hasLink()) { 27 Frame linkedFrame = FrameIO.LoadFrame(t.getAbsoluteLink()); 28 if (linkedFrame == null) 29 continue; 30 31 String frameTitle = linkedFrame.getTitle(); 32 sb.append(prefix).append(frameTitle).append('\n') 33 .append(prefix); 34 for (int i = 0; i < frameTitle.length(); i++) { 35 sb.append('-'); 36 } 37 sb.append("\n\n"); 38 sb.append(getFrameText(linkedFrame, prefix)); 39 } else { 40 sb.append(prefix).append(t.getText()).append("\n\n"); 41 } 42 } 43 44 Text original = frame.getAnnotation("original"); 45 if (original != null) { 46 Frame linkedFrame = FrameIO.LoadFrame(original.getAbsoluteLink()); 47 if (linkedFrame != null) { 48 sb.append("\n\n").append("Original Message").append( 49 "----------------").append("\n\n"); 50 sb.append(getFrameText(linkedFrame, ">")); 51 } 52 } 53 54 return sb.toString(); 19 55 } 20 56 … … 30 66 protected Frame process(Frame frame) { 31 67 String subject = frame.getTitle(); 32 List<Text> text = frame.getBodyTextItems(false); 33 StringBuilder body = new StringBuilder(); 34 for (Text t : text) { 35 body.append(t.getText()).append("\n\n"); 36 } 68 69 // Get the text to mail 70 String body = getFrameText(frame, ""); 71 37 72 String to = frame.getAnnotationValue("to"); 38 73 String cc = frame.getAnnotationValue("cc"); … … 115 150 // Allow the user to do other stuff while the message gets sent 116 151 _running = false; 117 MailSession.sendTextMessage(to, cc, bcc, subject, body .toString());152 MailSession.sendTextMessage(to, cc, bcc, subject, body, null); 118 153 119 154 return null; -
trunk/src/org/expeditee/agents/PdfFrameset.java
r228 r282 1 1 package org.expeditee.agents; 2 2 3 import java.awt.Dimension; 4 import java.io.FileNotFoundException; 5 import java.io.FileOutputStream; 3 import java.io.IOException; 6 4 7 5 import org.expeditee.gui.Frame; 8 import org.expeditee.gui.FrameGraphics; 9 import org.expeditee.gui.FrameIO; 10 import org.expeditee.gui.UserSettings; 6 import org.expeditee.gui.MessageBay; 7 import org.expeditee.io.PdfFramesetWriter; 11 8 12 import com.lowagie.text.Document;13 import com.lowagie.text.DocumentException;14 import com.lowagie.text.Rectangle;15 import com.lowagie.text.pdf.PdfContentByte;16 import com.lowagie.text.pdf.PdfWriter;17 9 18 10 public class PdfFrameset extends DefaultAgent { 19 private long _firstFrame = 1; 11 private PdfFramesetWriter _pdfWriter; 12 13 private int _firstFrame = 1; 20 14 21 private long_maxFrame = Integer.MAX_VALUE;15 private int _maxFrame = Integer.MAX_VALUE; 22 16 23 public PdfFrameset( long firstFrame, longmaxFrame) {17 public PdfFrameset(int firstFrame, int maxFrame) { 24 18 super(); 25 19 _firstFrame = firstFrame; … … 35 29 @Override 36 30 protected Frame process(Frame frame) { 37 String framesetName = frame.getFramesetName(); 38 String fileName = FrameIO.EXPORTS_DIR + framesetName + ".pdf"; 39 int count = FrameIO.getLastNumber(framesetName); 40 41 Dimension d = FrameGraphics.getMaxSize(); 42 Document _pdfDocument = new Document(new Rectangle(d.width, d.height)); 31 _pdfWriter = new PdfFramesetWriter(_firstFrame, _maxFrame); 43 32 44 PdfContentByte cb = null;45 33 try { 46 PdfWriter writer = PdfWriter.getInstance(_pdfDocument, 47 new FileOutputStream(fileName)); 48 _pdfDocument.open(); 49 _pdfDocument.addCreationDate(); 50 _pdfDocument.addAuthor(UserSettings.Username); 51 _pdfDocument.addCreator("Expeditee"); 52 cb = writer.getDirectContent(); 53 54 } catch (FileNotFoundException e) { 55 e.printStackTrace(); 56 return null; 57 } catch (DocumentException e) { 58 e.printStackTrace(); 59 return null; 34 _pdfWriter.writeFrame(frame); 35 } catch (IOException e) { 36 MessageBay.errorMessage("PdfFrameset error: " + e.getMessage()); 37 //e.printStackTrace(); 60 38 } 61 62 for (long i = _firstFrame; i <= _maxFrame && i <= count; i++) { 63 if (_stop) { 64 break; 65 } 66 String frameName = framesetName + i; 67 Frame toPaint = FrameIO.LoadFrame(frameName); 68 if (toPaint != null) { 69 overwriteMessage("Converting " + frameName); 70 java.awt.Graphics2D g2 = cb.createGraphics(FrameGraphics 71 .getMaxSize().width, FrameGraphics.getMaxSize().height); 72 FrameGraphics.paintFrame(toPaint, null, false, false, g2); 73 g2.dispose(); 74 // Move to the next page? 75 _pdfDocument.setPageCount(_pdfDocument.getPageNumber() + 1); 76 } 77 } 78 try { 79 _pdfDocument.close(); 80 } catch (Exception e) { 81 overwriteMessage("Error writing PDF document"); 82 } 39 83 40 return null; 84 41 } 42 43 @Override 44 public void stop(){ 45 _pdfWriter.stop(); 46 } 85 47 } -
trunk/src/org/expeditee/agents/mail/MailSession.java
r254 r282 224 224 225 225 public static boolean sendTextMessage(String to, String cc, String bcc, 226 String subject, String body ) {226 String subject, String body, Object attachments) { 227 227 228 228 if (_theMailSession == null) { … … 236 236 } 237 237 238 return _theMailSession.sendText(to, cc, bcc, subject, body );238 return _theMailSession.sendText(to, cc, bcc, subject, body, attachments); 239 239 } 240 240 241 241 private synchronized boolean sendText(String to, String cc, String bcc, 242 String subject, String body ) {242 String subject, String body, Object attachments) { 243 243 if (!_transport.isConnected()) { 244 244 MessageBay … … 263 263 // -- Create a new message -- 264 264 Message msg = new MimeMessage(_session); 265 265 266 266 // -- Set the FROM and TO fields -- 267 267 msg.setFrom(new InternetAddress(_address)); … … 409 409 if (flag == null 410 410 || msgs[msgNum].getFlags().contains(flag) == isPresent) { 411 Item newItem = readMessage(msgs[msgNum], msgNum, frame, point); 411 Item newItem = readMessage(msgs[msgNum], msgNum, frame, 412 point); 412 413 if (newItem != null) { 413 414 mailItems.add(newItem); … … 423 424 } 424 425 425 private Item readMessage(final Message message, int messageNo, Frame frame, Point point) { 426 String subject; 427 try { 428 subject = message.getSubject(); 429 } catch (MessagingException e) { 430 MessageBay.errorMessage("GetMail error: " + e.getMessage()); 431 return null; 432 } 433 434 final Text source = FrameDNDTransferHandler 435 .importString(subject, point); 436 // Create a frameCreator 437 final FrameCreator frames = new FrameCreator(frame.getFramesetName(), 438 frame.path, messageNo + ". " + subject, false); 426 private Item readMessage(final Message message, final int messageNo, 427 final Frame frame, final Point point) { 428 429 final Text source = FrameDNDTransferHandler.importString( 430 "Loading message " + messageNo, point); 439 431 440 432 new Thread() { 441 433 public void run() { 442 434 try { 435 String subject = message.getSubject(); 436 source.setText(messageNo + ". " + subject); 437 // Create a frameCreator 438 final FrameCreator frames = new FrameCreator(frame 439 .getFramesetName(), frame.path, subject, false); 440 443 441 // Get the header information 444 442 String from = ((InternetAddress) message.getFrom()[0]) 445 443 .getPersonal(); 446 if( from != null){ 447 frames.addText("@fromName: " + from, null, null, null, false); 444 if (from != null) { 445 frames.addText("@fromName: " + from, null, null, null, 446 false); 448 447 } 449 448 from = ((InternetAddress) message.getFrom()[0]) 450 .getAddress(); 451 frames.addText("@fromAddress: " + from, null, null, null, false); 449 .getAddress(); 450 Text fromAddressItem = frames.addText("@from: " + from, 451 null, null, null, false); 452 453 Text reply = frames.addText("@reply" + from, null, null, 454 null, false); 455 reply.setPosition(10 + fromAddressItem.getX() 456 + fromAddressItem.getBoundsWidth(), fromAddressItem 457 .getY()); 452 458 453 459 // -- Get the message part (i.e. the message itself) -- … … 461 467 } 462 468 // -- Get the content type -- 463 String contentType = messagePart.getContentType().toLowerCase(); 469 String contentType = messagePart.getContentType() 470 .toLowerCase(); 464 471 // -- If the content is plain text, we can print it -- 465 472 // System.out.println("CONTENT:" + contentType); … … 479 486 frames.save(); 480 487 source.setLink(frames.getName()); 488 } catch (MessagingException e) { 489 MessageBay.errorMessage("GetMail error: " + e.getMessage()); 481 490 } catch (Exception e) { 482 MessageBay.errorMessage("GetMail error: " + e.getMessage()); 491 MessageBay.errorMessage("Error reading mail: " 492 + e.getMessage()); 483 493 } 484 494 } -
trunk/src/org/expeditee/gui/AttributeUtils.java
r247 r282 351 351 o = i; 352 352 } else if (o instanceof Float) { 353 // -1 indicates default value 354 if (((Float) o) < 0.0001) 353 if (((Float) o) < -0.0001) 355 354 continue; 355 //Null indicates default 356 356 o = Math.round((Float) o); 357 357 } else if (o instanceof Double) { … … 398 398 sb.append(values[i]).append(' '); 399 399 } 400 sb.deleteCharAt( attributes.length() - 1);400 sb.deleteCharAt(sb.length() - 1); 401 401 o = sb.toString(); 402 402 } else if (o instanceof Boolean) { -
trunk/src/org/expeditee/gui/Browser.java
r262 r282 207 207 // Must be loaded after setupGraphics if images are on the frame 208 208 // Turn off XRay mode and load the first frame 209 FrameGraphics.setMode(FrameGraphics.MODE_NORMAL, false); 209 210 FrameUtils.loadFirstFrame(profile); 210 FrameGraphics.setMode(FrameGraphics.MODE_NORMAL, false);211 211 DisplayIO.UpdateTitle(); 212 212 -
trunk/src/org/expeditee/gui/DisplayIO.java
r278 r282 69 69 * The title to display in the Title bar. 70 70 */ 71 public static final String TITLE = "Exp 08Aug2008A";71 public static final String TITLE = "Exp27Aug2008A"; 72 72 73 73 private DisplayIO() { -
trunk/src/org/expeditee/gui/Frame.java
r278 r282 696 696 InteractiveWidget iw = ((WidgetCorner) item).getWidgetSource(); 697 697 if (!this._iWidgets.contains(iw)) { // A set would have been 698 // best 699 _iWidgets.add(iw); 698 if(FrameMouseActions.isControlDown()) 699 _iWidgets.add(iw); 700 else 701 _iWidgets.add(0, iw); 700 702 } 701 703 } -
trunk/src/org/expeditee/gui/FrameCreator.java
r278 r282 23 23 24 24 private Item _Mprev; 25 26 private Item _Mfirst; 25 27 26 28 // Next and previous links for the current frame … … 29 31 private Item _prev; 30 32 31 private Frame _first ;33 private Frame _firstFrame; 32 34 33 35 public FrameCreator(String frameTitle) { … … 55 57 * @return the newly created button. 56 58 */ 57 public Item createButton(String text, Float x, Float y, Float right,59 public static Item createButton(String text, Float x, Float y, Float right, 58 60 Float bottom) { 59 Itembutton = new Text(text);61 Text button = new Text(text); 60 62 button.setBackgroundColor(Color.LIGHT_GRAY); 61 63 button.setBorderColor(Color.DARK_GRAY); … … 66 68 button.setX(x); 67 69 if (right != null) 68 button.setAnchorRight( 15F);70 button.setAnchorRight(right); 69 71 if (y != null) 70 72 button.setY(y); 71 73 74 button.updatePolygon(); 75 72 76 return button; 73 77 } … … 75 79 public FrameCreator(String name, String path, String frameTitle, 76 80 boolean recreate) { 77 _Mnext = createButton("@Next", null, null, 15F, 15F); 78 _Mprev = createButton("@Previous", 30F, null, null, 15F); 79 81 82 _Mnext = createButton("@Next", null, null, 10F, 15F); 83 84 _Mprev = createButton("@Previous", null, null, _Mnext.getBoundsWidth() + _Mnext.getAnchorRight() + 20F, 15F); 85 86 _Mfirst = createButton("@First", null, null, _Mprev.getBoundsWidth() + _Mprev.getAnchorRight() + 20F, 15F); 87 80 88 Frame toUse = null; 81 89 try { … … 88 96 89 97 resetGlobals(toUse); 90 _first = toUse;98 _firstFrame = toUse; 91 99 // set positions of next\prev frame links 92 100 // _Mnext.setPosition(FrameGraphics.getMaxSize().width - 100, … … 96 104 97 105 public String getName() { 98 return _first .getName();106 return _firstFrame.getName(); 99 107 } 100 108 … … 110 118 111 119 // add link to previous frame 112 _prev = _Mprev.copy(); 113 _prev.setID(newFrame.getNextItemID()); 114 _prev.setLink(_current.getName()); 115 newFrame.addItem(_prev); 120 _prev = addPreviousButton(newFrame, _current.getName()); 116 121 117 122 // add link to new frame 118 _next = _Mnext.copy(); 119 _next.setID(_current.getNextItemID()); 120 _next.setLink(newFrame.getName()); 121 _current.addItem(_next); 123 _next = addNextButton(_current,newFrame.getName()); 124 125 // add link to new frame 126 addFirstButton(newFrame,_firstFrame.getName()); 127 122 128 FrameIO.SaveFrame(_current, false); 123 129 … … 193 199 } 194 200 195 public voidaddText(String toAdd, Color c, String link, String action,201 public Text addText(String toAdd, Color c, String link, String action, 196 202 boolean bSave) { 197 203 Text text = _current.createNewText(); … … 202 208 203 209 addItem(text, bSave); 210 211 return text; 204 212 } 205 213 … … 221 229 222 230 public Frame getFirstFrame() { 223 return _first; 231 return _firstFrame; 232 } 233 234 public Item addNextButton(Frame current, String link) { 235 return addButton(_Mnext, current, link); 236 } 237 238 public Item addPreviousButton(Frame current, String link) { 239 return addButton(_Mprev, current, link); 240 } 241 242 public Item addFirstButton(Frame current, String link) { 243 return addButton(_Mfirst, current, link); 244 } 245 246 public Item addButton(Item template, Frame current, String link) { 247 // add link to new frame 248 Item previousButton = template.copy(); 249 previousButton.setID(current.getNextItemID()); 250 previousButton.setLink(link); 251 current.addItem(previousButton); 252 253 return previousButton; 224 254 } 225 255 } -
trunk/src/org/expeditee/gui/FrameGraphics.java
r281 r282 349 349 // Note that these are the anchored widgets 350 350 ListIterator<InteractiveWidget> widgetItor = paintWidgets.listIterator(paintWidgets.size()); 351 while (widgetItor.hasPrevious()) { // Paint first-in-last-serve ordering - like swing 351 while (widgetItor.hasPrevious()) { 352 //Paint first-in-last-serve ordering - like swing 353 //If it is done the other way around then widgets are covered up by the box that is supposed to be underneath 352 354 InteractiveWidget iw = widgetItor.previous(); 353 355 if (clip == null -
trunk/src/org/expeditee/gui/FrameIO.java
r247 r282 121 121 MessageBay.supressMessages(true); 122 122 // loading automatically caches the frame is caching is turned on 123 LoadUnknownPath(framename );123 LoadUnknownPath(framename, false); 124 124 MessageBay.supressMessages(false); 125 125 } … … 143 143 144 144 public static Frame LoadFrame(String frameName) { 145 return LoadFrame(frameName, false); 146 } 147 148 public static Frame LoadFrame(String frameName, boolean ignoreAnnotations) { 145 149 if (!isValidFrameName(frameName)) 146 150 return null; … … 157 161 Logger.Log(Logger.SYSTEM, Logger.LOAD, "Loading " + frameName 158 162 + " from disk."); 159 return LoadUnknownPath(frameName );160 } 161 162 private static Frame LoadUnknownPath(String framename ) {163 return LoadUnknownPath(frameName, ignoreAnnotations); 164 } 165 166 private static Frame LoadUnknownPath(String framename, boolean ignoreAnnotations) { 163 167 Frame loaded = null; 164 168 … … 166 170 loaded = LoadFrame(path, framename); 167 171 if (loaded != null) { 168 FrameUtils.Parse(loaded, true );172 FrameUtils.Parse(loaded, true, ignoreAnnotations); 169 173 break; 170 174 } -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r278 r282 38 38 private static Text _toRemove = null; 39 39 40 private static Collection<Item> _enclosedItems = null; 41 42 public static void resetEnclosedItems() { 43 _enclosedItems = null; 44 } 45 40 46 public synchronized void keyTyped(KeyEvent e) { 41 47 if (Simple.isProgramRunning()) { … … 324 330 public void keyPressed(KeyEvent e) { 325 331 int keyCode = e.getKeyCode(); 332 333 if(keyCode != KeyEvent.VK_F1 && keyCode != KeyEvent.VK_F2){ 334 resetEnclosedItems(); 335 } 336 326 337 SessionStats.AddFrameEvent("k" + KeyEvent.getKeyText(keyCode)); 327 338 … … 516 527 } 517 528 518 /** 519 * Currently ignored. 520 */ 529 521 530 public void keyReleased(KeyEvent e) { 522 531 if (e.getKeyCode() == KeyEvent.VK_CONTROL) { … … 761 770 Item lastItem = null; 762 771 763 boolean drop = currentFrame.hasAnnotation(" more");772 boolean drop = currentFrame.hasAnnotation("next"); 764 773 // separate the clipboard content into items based on 765 774 // blank lines … … 1118 1127 * indicate the cursor is in free space. 1119 1128 */ 1120 p rivatestatic void Drop(Item toDropFrom, boolean bPasting) {1129 public static void Drop(Item toDropFrom, boolean bPasting) { 1121 1130 try { 1122 1131 FrameUtils.setLastEdited(null); … … 1191 1200 Frame current = DisplayIO.getCurrentFrame(); 1192 1201 Item itemTemplate = current.getItemTemplate(); 1193 int xPos = title.getX() ;1202 int xPos = title.getX() + 25; 1194 1203 int yPos = title.getY() + title.getBoundsHeight() 1195 1204 + itemTemplate.getBoundsHeight(); … … 1219 1228 || dummyItem.getY() > FrameGraphics.getMaxFrameSize() 1220 1229 .getHeight()) { 1221 // Check for the @moretag!1230 // Check for the 'next' tag! 1222 1231 Frame current = DisplayIO.getCurrentFrame(); 1223 Item i = current.getAnnotation("more"); 1224 1225 if (i != null) { 1232 Item next = current.getAnnotation("next"); 1233 Item prev = current.getAnnotation("previous"); 1234 // Check for an unlinked next tag 1235 if ((next != null && !next.hasLink()) 1236 || (prev != null && prev.hasLink())) { 1226 1237 Frame firstFrame = current; 1227 boolean mouseMoved = FrameMouseActions.tdfc(i); 1238 if (next != null) 1239 next.delete(); 1240 FrameCreator frameCreator = new FrameCreator(null); 1241 // Add the next button 1242 next = frameCreator.addNextButton(current, null); 1243 1244 // Create the new frame linked to the next tag 1245 boolean mouseMoved = FrameMouseActions.tdfc(next); 1228 1246 Frame moreFrame = DisplayIO.getCurrentFrame(); 1229 // Add the @more if we are pasting 1230 if (bPasting) { 1231 Item copy = i.copy(); 1232 copy.setLink(null); 1233 moreFrame.addItem(copy); 1247 1248 // Add previous button to the new frame 1249 frameCreator.addPreviousButton(moreFrame, firstFrame 1250 .getName()); 1251 Item first = current.getAnnotation("first"); 1252 if (first != null) { 1253 frameCreator.addFirstButton(moreFrame, first 1254 .getLink()); 1255 } else { 1256 frameCreator.addFirstButton(moreFrame, firstFrame 1257 .getName()); 1234 1258 } 1259 // Add the @next if we are pasting 1260 // if (bPasting) { 1261 // Item copy = next.copy(); 1262 // copy.setLink(null); 1263 // moreFrame.addItem(copy); 1264 // } 1235 1265 1236 1266 moreFrame.setTitle(firstFrame.getTitleItem().getText()); 1237 1267 // need to move the mouse to the top of the frame if 1238 // there 1239 // wasnt an @start on it 1268 // there wasnt an @start on it 1240 1269 if (!mouseMoved) { 1241 1270 Item moreTitle = moreFrame.getTitleItem(); … … 1489 1518 // change copying to copy only the stuff completely enclosed 1490 1519 if (insideEnclosure) { 1491 for (Item i : FrameUtils.getCurrentItems(toSet)) { 1492 if (i.hasPermission(Permission.full) && !toSize.contains(i)) 1493 toSize.addAll(i.getAllConnected()); 1494 } 1520 if (_enclosedItems == null) { 1521 for (Item i : FrameUtils.getCurrentItems(toSet)) { 1522 if (i.hasPermission(Permission.full) 1523 && !toSize.contains(i)) 1524 toSize.addAll(i.getAllConnected()); 1525 } 1526 _enclosedItems = toSize; 1527 } else { 1528 toSize = _enclosedItems; 1529 } 1530 1495 1531 }// Enclosed circle centers are resized with the center as origin 1496 1532 // Just add the circle center to the list of items to size … … 1570 1606 if (i instanceof Text && i.getSize() != oldSize) { 1571 1607 i.translate(origin, resizeRatio); 1608 if (i.isLineEnd()) { 1609 i.setPosition(i.getPosition()); 1610 } 1572 1611 } 1573 1612 } -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r278 r282 1548 1548 1549 1549 private static boolean _controlDown; 1550 1551 public static boolean isControlDown() { 1552 return _controlDown; 1553 } 1550 1554 1551 1555 public static void setLastRobotMove(float x, float y) { … … 1573 1577 1574 1578 private void mouseMoved(MouseEvent e, boolean shiftStateChanged) { 1579 FrameKeyboardActions.resetEnclosedItems(); 1575 1580 // System.out.println(e.getX() + "," + e.getY() + " " + e.getWhen()); 1576 1581 if (LastRobotX != null) { … … 2220 2225 ItemUtils.EnclosedCheck(parent.getItems()); 2221 2226 if (toDelete.hasOverlay()) { 2222 FrameUtils.Parse(parent, false );2227 FrameUtils.Parse(parent, false, false); 2223 2228 FrameGraphics.requestRefresh(false); 2224 2229 } … … 2294 2299 itemList.clear(); 2295 2300 if (bReparse) 2296 FrameUtils.Parse(currentFrame, false );2301 FrameUtils.Parse(currentFrame, false, false); 2297 2302 2298 2303 } … … 2631 2636 } 2632 2637 if (bReparse) 2633 FrameUtils.Parse(DisplayIO.getCurrentFrame(), false );2638 FrameUtils.Parse(DisplayIO.getCurrentFrame(), false, false); 2634 2639 2635 2640 FrameGraphics.Repaint(); … … 2724 2729 } 2725 2730 if (bReparse) 2726 FrameUtils.Parse(DisplayIO.getCurrentFrame(), false );2731 FrameUtils.Parse(DisplayIO.getCurrentFrame(), false, false); 2727 2732 FrameGraphics.Repaint(); 2728 2733 } -
trunk/src/org/expeditee/gui/FrameUtils.java
r247 r282 734 734 */ 735 735 public static void Parse(Frame toParse, boolean firstParse) { 736 Parse(toParse, firstParse, false); 737 } 738 739 /** 740 * 741 * @param toParse 742 * @param firstParse 743 * @param ignoreAnnotations 744 * used to prevent infinate loops such as when performing TDFC 745 * with an ao tag linked to a frame with an frameImage of a frame 746 * which also has an ao tag on it. 747 */ 748 public static void Parse(Frame toParse, boolean firstParse, 749 boolean ignoreAnnotations) { 736 750 // TODO check why we are getting toParse == null... when profile frame 737 751 // is being created and change the lines below … … 833 847 } 834 848 // check for new OVERLAY items 835 else if ( ItemUtils.startsWithTag(i,849 else if (!ignoreAnnotations && ItemUtils.startsWithTag(i, 836 850 ItemUtils.TAG_OVERLAY) 837 851 && i.getLink() != null) { … … 856 870 } 857 871 // check for ACTIVE_OVERLAY items 858 else if ( ItemUtils.startsWithTag(i,872 else if (!ignoreAnnotations && ItemUtils.startsWithTag(i, 859 873 ItemUtils.TAG_ACTIVE_OVERLAY) 860 874 && i.getLink() != null) { … … 1143 1157 /** 1144 1158 * 1145 * @param currentItem 1159 * @param currentItem 1146 1160 * @return 1147 1161 */ … … 1149 1163 return getCurrentItems(getCurrentItem()); 1150 1164 } 1151 1165 1152 1166 public static Collection<Item> getCurrentItems(Item currentItem) { 1153 1167 … … 1186 1200 1187 1201 public static Collection<Item> getEnclosingLineEnds() { 1188 return getEnclosingLineEnds(new Point(DisplayIO.getMouseX(), FrameMouseActions.getY())); 1189 } 1190 1202 return getEnclosingLineEnds(new Point(DisplayIO.getMouseX(), 1203 FrameMouseActions.getY())); 1204 } 1205 1191 1206 public static Collection<Item> getEnclosingLineEnds(Point position) { 1192 1207 // update enclosed shapes … … 1451 1466 if (!FrameGraphics.isXRayMode()) { 1452 1467 if (toReparse != null) { 1453 Parse(toReparse, false );1468 Parse(toReparse, false, false); 1454 1469 } else if (toRecalculate != null) { 1455 1470 toRecalculate.recalculate(); -
trunk/src/org/expeditee/importer/TextImporter.java
r253 r282 26 26 final String fullPath = f.getAbsolutePath(); 27 27 28 final Text source = FrameDNDTransferHandler.importString(f.get Name(),28 final Text source = FrameDNDTransferHandler.importString(f.getPath(), 29 29 location); 30 30 -
trunk/src/org/expeditee/io/DefaultFramesetWriter.java
r226 r282 8 8 9 9 public class DefaultFramesetWriter extends DefaultFrameWriter { 10 private int_firstFrame = 1;11 private int _maxFrame = Integer.MAX_VALUE;10 private long _firstFrame = 1; 11 private long _maxFrame = Long.MAX_VALUE; 12 12 13 protected DefaultFramesetWriter(long firstFrame, long maxFrame){ 14 _firstFrame = firstFrame; 15 _maxFrame = maxFrame; 16 } 13 17 14 18 @Override -
trunk/src/org/expeditee/io/PDF2Writer.java
r226 r282 23 23 import com.lowagie.text.pdf.PdfWriter; 24 24 25 /** 26 * 27 * @author root 28 * 29 */ 25 30 public class PDF2Writer extends DefaultFrameWriter { 26 31 … … 99 104 cb.addImage(iTextImage); 100 105 } catch (DocumentException e) { 101 // TODO Auto-generated catch block102 106 e.printStackTrace(); 103 107 } -
trunk/src/org/expeditee/io/PDFWriter.java
r226 r282 18 18 import com.lowagie.text.pdf.PdfWriter; 19 19 20 /** 21 * Writes out a tree in a linear format. 22 * @author root 23 * 24 */ 20 25 public class PDFWriter extends DefaultTreeWriter { 21 26 -
trunk/src/org/expeditee/io/PdfFramesetWriter.java
r278 r282 23 23 import com.lowagie.text.pdf.PdfWriter; 24 24 25 public class PDF3Writer extends DefaultFramesetWriter { 25 /** 26 * 27 * @author root 28 * 29 */ 30 public class PdfFramesetWriter extends DefaultFramesetWriter { 26 31 27 32 private Document _pdfDocument; … … 29 34 private PdfWriter _pdfWriter; 30 35 31 public PDF3Writer() { 36 public PdfFramesetWriter(long firstFrame, long maxFrame) { 37 super(firstFrame, maxFrame); 32 38 Dimension d = FrameGraphics.getMaxSize(); 33 39 _pdfDocument = new Document(new Rectangle(d.width, d.height)); 40 } 41 42 public PdfFramesetWriter() { 43 this(1, Long.MAX_VALUE); 34 44 } 35 45 … … 60 70 protected void writeEndFrame(Frame ending) throws IOException { 61 71 super.writeEndFrame(ending); 62 // Move to the next page ?72 // Move to the next page 63 73 _pdfDocument.newPage(); 64 //int nextPage = _pdfDocument.getPageNumber() + 1;65 //_pdfDocument.setPageCount(nextPage);66 74 } 67 75 … … 100 108 protected void writePicture(Picture pic) throws IOException { 101 109 Image image = pic.getCroppedImage(); 110 if(image == null) 111 return; 102 112 try { 103 113 PdfContentByte cb = _pdfWriter.getDirectContent(); -
trunk/src/org/expeditee/items/Dot.java
r278 r282 74 74 @Override 75 75 public void setAnchorBottom(Float anchor) { 76 if (!isLineEnd()){76 if (!isLineEnd()) { 77 77 super.setAnchorBottom(anchor); 78 78 return; … … 84 84 float deltaY = FrameGraphics.getMaxFrameSize().height - anchor 85 85 - getBoundsHeight() - oldY; 86 //Check for a more efficient way to do this!! 87 //Invalidate all the items 88 for (Item i : this.getAllConnected()) { 89 i.invalidateAll(); 90 } 91 //Move the items 92 for (Item i : this.getAllConnected()) { 93 if (i.isLineEnd()){ 94 i.setAnchorBottom(null); 95 i.setXY(i.getX(), i.getY() + deltaY); 96 i.updatePolygon(); 97 i.invalidateAll(); 98 } 99 } 100 //Invalidate them again!! 101 for (Item i : this.getAllConnected()) { 102 i.invalidateAll(); 103 } 86 anchorConnected(null, deltaY); 104 87 } 105 88 this._anchorBottom = anchor; … … 107 90 invalidateFill(); 108 91 } 109 92 110 93 @Override 111 94 public void setAnchorRight(Float anchor) { 112 if (!isLineEnd()){95 if (!isLineEnd()) { 113 96 super.setAnchorRight(anchor); 114 97 return; … … 120 103 float deltaX = FrameGraphics.getMaxFrameSize().width - anchor 121 104 - getBoundsWidth() - oldX; 122 //Check for a more efficient way to do this!! 123 //Invalidate all the items 124 for (Item i : this.getAllConnected()) { 125 i.invalidateAll(); 126 } 127 //Move the items 128 for (Item i : this.getAllConnected()) { 129 if (i.isLineEnd()){ 130 i.setAnchorRight(null); 131 i.setXY(i.getX() + deltaX, i.getY()); 132 i.updatePolygon(); 133 i.invalidateAll(); 134 } 135 } 136 //Invalidate them again!! 137 for (Item i : this.getAllConnected()) { 138 i.invalidateAll(); 139 } 105 106 anchorConnected(deltaX, null); 140 107 } 141 108 this._anchorRight = anchor; -
trunk/src/org/expeditee/items/FrameImage.java
r181 r282 37 37 // parseSize(); 38 38 assert (_source.getLink() != null); 39 Frame frame = FrameIO.LoadFrame(_source.getAbsoluteLink() );39 Frame frame = FrameIO.LoadFrame(_source.getAbsoluteLink(), true); 40 40 if (frame == null) 41 41 return false; -
trunk/src/org/expeditee/items/Item.java
r278 r282 182 182 dest.setArrow(source.getArrowheadLength(), source.getArrowheadRatio()); 183 183 184 dest.setAnchorBottom(source.getAnchorBottom()); 185 dest.setAnchorRight(source.getAnchorRight()); 186 184 // Calling the methods will move the item... 185 // This messes things up when the user uses backspace to delete a text 186 // line end 187 dest._anchorBottom = source._anchorBottom; 188 dest._anchorRight = source._anchorRight; 189 187 190 dest.setFormula(source.getFormula()); 188 191 dest.setParent(source.getParent()); … … 880 883 881 884 public int getWidth() { 885 return 0; 886 } 887 888 public int getHeight() { 882 889 return 0; 883 890 } … … 1063 1070 if (sourceItem == null) { 1064 1071 sourceItem = this; 1065 } else{1066 for (Item i: sourceItem.getAllConnected()){1067 if (i instanceof Text){1072 } else { 1073 for (Item i : sourceItem.getAllConnected()) { 1074 if (i instanceof Text) { 1068 1075 sourceItem = i; 1069 1076 break; … … 1368 1375 for (Line line : _lines) { 1369 1376 Item other = line.getOppositeEnd(this); 1370 if (other.getFillColor() != c) {1377 if (other.getFillColor() != c) { 1371 1378 other.setFillColor(c); 1372 1379 } … … 1534 1541 private void invalidateCommonTraitForAll(ItemAppearence trait) { 1535 1542 invalidateCommonTrait(trait); 1536 for (Line line : getLines()) 1537 line.invalidateCommonTrait(trait); 1543 if (isLineEnd()) { 1544 boolean hasLinePattern = getLines().get(0).getLinePattern() != null; 1545 if (hasLinePattern) { 1546 for (Item i : getAllConnected()) { 1547 if (i instanceof Line) { 1548 ((Line)i).invalidateCommonTrait(trait); 1549 } 1550 } 1551 } else { 1552 for (Line line : getLines()) { 1553 line.invalidateCommonTrait(trait); 1554 } 1555 } 1556 } 1538 1557 if (_colorFill != null) { 1539 1558 invalidateFill(); // only invalidates if has fill … … 1651 1670 line.updatePolygon(); 1652 1671 } 1672 1673 // for (Item item : getAllConnected()) { 1674 // item.updatePolygon(); 1675 // } 1653 1676 1654 1677 invalidateCommonTraitForAll(ItemAppearence.PostMoved); … … 1759 1782 "Item type does not support width attribute!"); 1760 1783 } 1761 1784 1762 1785 public void setRightMargin(int i) { 1763 1786 setWidth(i - getX() - Item.MARGIN_LEFT); … … 2541 2564 this._anchorRight = anchor; 2542 2565 if (anchor != null) 2543 setX(FrameGraphics.getMaxFrameSize().width - anchor - getBoundsWidth()); 2566 setX(FrameGraphics.getMaxFrameSize().width - anchor 2567 - getBoundsWidth()); 2544 2568 } 2545 2569 … … 2551 2575 this._anchorBottom = anchor; 2552 2576 if (anchor != null) 2553 setY(FrameGraphics.getMaxFrameSize().height - anchor - getBoundsHeight());2577 setY(FrameGraphics.getMaxFrameSize().height - anchor); 2554 2578 } 2555 2579 … … 2606 2630 return null; 2607 2631 } 2632 2633 public boolean hasLink() { 2634 return _link != null; 2635 } 2636 2637 protected void anchorConnected(Float deltaX, Float deltaY) { 2638 // Check for a more efficient way to do this!! 2639 // Invalidate all the items 2640 for (Item i : this.getAllConnected()) { 2641 i.invalidateAll(); 2642 } 2643 // Move the items 2644 for (Item i : this.getAllConnected()) { 2645 if (i.isLineEnd()) { 2646 if (deltaX != null) { 2647 i.setAnchorRight(null); 2648 i.setXY(i.getX() + deltaX, i.getY()); 2649 } 2650 if (deltaY != null) { 2651 i.setAnchorBottom(null); 2652 i.setXY(i.getX(), i.getY() + deltaY); 2653 } 2654 } 2655 } 2656 // Invalidate them again!! 2657 for (Item i : this.getAllConnected()) { 2658 i.updatePolygon(); 2659 i.invalidateAll(); 2660 } 2661 } 2608 2662 } -
trunk/src/org/expeditee/items/Picture.java
r242 r282 288 288 * Gets the height with which the picture is displayed on the screen. 289 289 */ 290 @Override 290 291 public int getHeight() { 291 292 return Math.round((_end.y - _start.y) * _scale); … … 483 484 484 485 public Image getCroppedImage() { 486 if(_image == null) 487 return null; 485 488 return Toolkit.getDefaultToolkit().createImage(new FilteredImageSource( 486 489 _image.getSource(), -
trunk/src/org/expeditee/items/Text.java
r278 r282 1422 1422 } 1423 1423 1424 if (hasFormula()) { 1425 g.setColor(getPaintHighlightColor()); 1426 Stroke highlightStroke = new BasicStroke( 1427 1F, CAP, JOIN); 1428 g.setStroke(highlightStroke); 1429 1430 Point2D.Float start = getEdgePosition(0, true); 1431 Point2D.Float end = getEdgePosition(0, false); 1432 g.drawLine(Math.round(start.x), Math.round(start.y), Math 1433 .round(end.x), Math.round(end.y)); 1434 } 1435 1424 1436 if (isHighlighted()) { 1425 1437 g.setColor(getPaintHighlightColor()); … … 1644 1656 if (s.equals("@old") || s.equals("@ao") 1645 1657 || s.equals("@itemtemplate") || s.equals("@parent") 1646 || s.equals("@ more") || s.equals("@next")1647 || s.equals("@ previous") || s.equals("@i")1658 || s.equals("@next") || s.equals("@previous") 1659 || s.equals("@first") || s.equals("@i") || s.equals("@iw") 1648 1660 || s.equals("@f")) 1649 1661 return true; … … 1883 1895 e.printStackTrace(); 1884 1896 } 1885 } else {1886 try {1887 double value = pair.getDoubleValue();1888 myParser.addVariable("$" + nextVarNo++, value);1889 } catch (NumberFormatException nfe) {1890 continue;1891 } catch (Exception e) {1892 e.printStackTrace();1893 }1897 } // else { 1898 // Add anonomous vars 1899 try { 1900 double value = pair.getDoubleValue(); 1901 myParser.addVariable("$" + nextVarNo++, value); 1902 } catch (NumberFormatException nfe) { 1903 continue; 1904 } catch (Exception e) { 1905 e.printStackTrace(); 1894 1906 } 1907 // } 1895 1908 } 1896 1909 } … … 2000 2013 float deltaX = FrameGraphics.getMaxFrameSize().width - anchor 2001 2014 - getBoundsWidth() + getLeftMargin() - oldX; 2002 // Check for a more efficient way to do this!! 2003 // Invalidate all the items 2004 for (Item i : this.getAllConnected()) { 2005 i.invalidateAll(); 2006 } 2007 // Move the items 2008 for (Item i : this.getAllConnected()) { 2009 if (i.isLineEnd()) { 2010 i.setAnchorRight(null); 2011 i.setXY(i.getX() + deltaX, i.getY()); 2012 } 2013 } 2014 // Invalidate them again!! 2015 for (Item i : this.getAllConnected()) { 2016 i.updatePolygon(); 2017 i.invalidateAll(); 2018 } 2015 anchorConnected(deltaX, null); 2019 2016 } 2020 2017 this._anchorRight = anchor; … … 2022 2019 invalidateFill(); 2023 2020 } 2024 2021 2025 2022 @Override 2026 2023 public void setAnchorBottom(Float anchor) { 2027 if (!isLineEnd()){2024 if (!isLineEnd()) { 2028 2025 super.setAnchorBottom(anchor); 2029 2026 return; … … 2034 2031 if (anchor != null) { 2035 2032 float deltaY = FrameGraphics.getMaxFrameSize().height - anchor 2036 - getBoundsHeight() - oldY; 2037 //Check for a more efficient way to do this!! 2038 //Invalidate all the items 2039 for (Item i : this.getAllConnected()) { 2040 i.invalidateAll(); 2041 } 2042 //Move the items 2043 for (Item i : this.getAllConnected()) { 2044 if (i.isLineEnd()){ 2045 i.setAnchorBottom(null); 2046 i.setXY(i.getX(), i.getY() + deltaY); 2047 i.updatePolygon(); 2048 i.invalidateAll(); 2049 } 2050 } 2051 //Invalidate them again!! 2052 for (Item i : this.getAllConnected()) { 2053 i.invalidateAll(); 2054 } 2033 - oldY; 2034 anchorConnected(null, deltaY); 2055 2035 } 2056 2036 this._anchorBottom = anchor; -
trunk/src/org/expeditee/items/XRayable.java
r278 r282 6 6 import java.util.LinkedList; 7 7 import java.util.List; 8 9 import org.expeditee.gui.FrameGraphics; 8 10 9 11 public abstract class XRayable extends Item { … … 115 117 public float getThickness() { 116 118 return _source.getThickness(); 119 } 120 121 @Override 122 public Float getAnchorBottom() { 123 return _source.getAnchorBottom(); 124 } 125 126 @Override 127 public Float getAnchorRight() { 128 return _source.getAnchorRight(); 117 129 } 118 130 … … 205 217 public void setAnchorBottom(Float anchor) { 206 218 _source.setAnchorBottom(anchor); 219 if (anchor != null) 220 _source.setY(FrameGraphics.getMaxFrameSize().height - getHeight() - anchor); 207 221 } 208 222 -
trunk/src/org/expeditee/items/widgets/InteractiveWidget.java
r279 r282 19 19 import javax.swing.SwingUtilities; 20 20 21 import org.expeditee.gui.AttributeUtils; 21 22 import org.expeditee.gui.Browser; 22 23 import org.expeditee.gui.DisplayIO; … … 133 134 text = text.trim(); 134 135 136 // Check starts with the widget tag and seporator 137 if (!text.startsWith(TAG + ":")) 138 throw new IllegalArgumentException("Source text must begin with \"" 139 + TAG + ":\""); 140 141 text = text.substring(TAG.length() + 1).trim(); 142 135 143 int index = 0; 136 if (text.length() > TAG.length() + 1) {137 index = text.indexOf(':' , TAG.length() + 1); // used for144 if (text.length() > 0) { 145 index = text.indexOf(':'); // used for 138 146 // signifying start 139 // of 140 } 141 142 // arguments 147 // of arguments 148 } 149 143 150 if (index == 0) 144 151 throw new IllegalArgumentException("Source text must begin with \"" … … 148 155 0, index).split(" "); 149 156 150 // Check starts with the widget tag and seporator151 if (tokens.length == 0 || !tokens[0].equals(TAG + ":"))152 throw new IllegalArgumentException("Source text must begin with \""153 + TAG + ":\"");154 155 157 float width = -1, height = -1; 156 158 157 if (tokens.length < 2)159 if (tokens.length < 1) 158 160 throw new IllegalArgumentException( 159 161 "Missing widget class name in source text"); … … 161 163 try { 162 164 163 if (tokens.length >= 3) { // parse optional width164 width = Integer.parseInt(tokens[ 2]);165 if (tokens.length >= 2) { // parse optional width 166 width = Integer.parseInt(tokens[1]); 165 167 width = (width <= 0) ? width = -1 : width; 166 168 } 167 169 168 if (tokens.length >= 4) { // parse optional height169 height = Integer.parseInt(tokens[ 3]);170 if (tokens.length >= 3) { // parse optional height 171 height = Integer.parseInt(tokens[2]); 170 172 height = (height <= 0) ? height = -1 : height; 171 173 } … … 176 178 } 177 179 178 if (tokens.length > 4)180 if (tokens.length > 3) 179 181 throw new IllegalArgumentException( 180 182 "to many arguments given before \":\" in source text"); 181 183 182 String classname = tokens[ 1];184 String classname = tokens[0]; 183 185 if (classname.charAt(0) == '$') 184 186 classname = "org.expeditee.items.widgets." + classname.substring(1); … … 704 706 705 707 public void setPosition(int x, int y) { 706 if (x == getX() && y == getY()) return; 708 if (x == getX() && y == getY()) 709 return; 707 710 708 711 boolean vfloating[] = new boolean[] { _d1.isFloating(), … … 925 928 .getCurrentMouseEvent()) 926 929 return; // already dealt with this event 927 930 928 931 _lastParentStateChangedEvent = e; 929 _lastParentStateChangedMouseEvent = MouseEventRouter.getCurrentMouseEvent(); 932 _lastParentStateChangedMouseEvent = MouseEventRouter 933 .getCurrentMouseEvent(); 930 934 931 935 switch (e.getEventType()) { … … 1072 1076 /** 1073 1077 * 1074 * @return 1075 * The current bounds for this widget. Never null. 1078 * @return The current bounds for this widget. Never null. 1076 1079 */ 1077 1080 public Rectangle getBounds() { … … 1155 1158 if (_textRepresentation.getLink() != null 1156 1159 || _textRepresentation.hasAction()) { 1157 // System.out.println("Painted link");1160 // System.out.println("Painted link"); 1158 1161 _textRepresentation.paintLinkGraphic(g, getLinkX(), getLinkY()); 1159 1162 … … 1493 1496 1494 1497 if (newData != null) { 1495 if (data != null) data.add(newData); 1498 if (data != null) 1499 data.add(newData); 1496 1500 else { 1497 1501 data = new LinkedList<String>(); 1498 1502 data.add(newData); 1499 1503 getCurrentRepresentation().setData(data); 1500 1501 } 1502 } 1504 1505 } 1506 } 1503 1507 } 1504 1508 … … 1507 1511 * 1508 1512 * @param link 1509 * 1510 * 1513 * The new frame link. Can be null (for no link) 1514 * 1511 1515 */ 1512 1516 public void setLink(String link) { … … 1518 1522 invalidateLink(); 1519 1523 } 1520 1521 public void setBackgroundColor(Color c) {1524 1525 public void setBackgroundColor(Color c) { 1522 1526 getSource().setBackgroundColor(c); 1523 1527 } 1524 1525 /** 1526 * @return 1527 * The link for this widget. Null if none. 1528 1529 /** 1530 * @return The link for this widget. Null if none. 1528 1531 */ 1529 1532 public String getLink() { 1530 1533 return _textRepresentation.getLink(); 1531 1534 } 1532 1533 1534 /**1535 * <b>Note:</b> That if the widget has no parent (e.g. the widget is a free-item) then1536 * the absolute link returned will be for the frameset of thecurrent frame.1537 * 1538 * @return 1539 * The absolute link for this item. Null if there is no link, or if1540 * there is no parent for this widget and the current frame isunavailable.1541 * 1535 1536 /** 1537 * <b>Note:</b> That if the widget has no parent (e.g. the widget is a 1538 * free-item) then the absolute link returned will be for the frameset of 1539 * the current frame. 1540 * 1541 * @return The absolute link for this item. Null if there is no link, or if 1542 * there is no parent for this widget and the current frame is 1543 * unavailable. 1544 * 1542 1545 */ 1543 1546 public String getAbsoluteLink() { 1544 1545 // Note: 1547 1548 // Note: cannot return the source absolute link since it does not have 1546 1549 // a parent ... thus must manually format link 1547 1550 1548 1551 String link = getLink(); 1549 1550 if (link == null || link.length() == 0) return null; 1551 1552 if (FrameIO.isPositiveInteger(link)) { // relative - convert to absolute 1553 1552 1553 if (link == null || link.length() == 0) 1554 return null; 1555 1556 if (FrameIO.isPositiveInteger(link)) { // relative - convert to 1557 // absolute 1558 1554 1559 // Get the frameset of this item 1555 1560 Frame parent = getParentFrame(); 1556 if (parent == null) parent = DisplayIO.getCurrentFrame(); 1557 if (parent == null) return null; 1558 1561 if (parent == null) 1562 parent = DisplayIO.getCurrentFrame(); 1563 if (parent == null) 1564 return null; 1565 1559 1566 String framesetName = parent.getFramesetName(); 1560 1561 if (framesetName == null) return null; 1562 1567 1568 if (framesetName == null) 1569 return null; 1570 1563 1571 return framesetName + link; 1564 1572 1565 1573 } else if (FrameIO.isValidFrameName(link)) { // already absolute 1566 1574 return link; 1567 1575 } 1568 1576 1569 1577 return null; 1570 1578 } … … 1600 1608 _textRepresentation.setColor(c); 1601 1609 } 1602 1610 1603 1611 public void setSourceBorderColor(Color c) { 1604 1612 _textRepresentation.setBorderColor(c); 1605 1613 } 1606 1614 1607 1615 public void setSourceFillColor(Color c) { 1608 1616 _textRepresentation.setFillColor(c); 1609 1617 } 1610 1618 1611 1619 public void setSourceThickness(float newThickness, boolean setConnected) { 1612 1620 _textRepresentation.setThickness(newThickness, setConnected); … … 1616 1624 _textRepresentation.setData(data); 1617 1625 } 1618 1626 1619 1627 protected Point getOrigin() { 1620 1628 return _d1.getPosition(); // BROOK: This flips around ... the origin can be any point 1621 1629 } 1622 1630 1623 1631 protected Item getFirstCorner() { 1624 1632 return _d1; -
trunk/src/org/expeditee/simple/SVariable.java
r4 r282 7 7 * 8 8 */ 9 public abstract class SVariable<T > {9 public abstract class SVariable<T extends Object> { 10 10 public static final String prefix = "$"; 11 11 -
trunk/src/org/expeditee/simple/Variables.java
r270 r282 63 63 } 64 64 //TODO:figure out how to fix the ANT build error 65 toSet.setValue(toGetValueFrom);65 ((SVariable)toSet).setValue(toGetValueFrom); 66 66 } 67 67
Note:
See TracChangeset
for help on using the changeset viewer.