Changeset 348
- Timestamp:
- 10/06/08 14:16:30 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Mail.java
r306 r348 79 79 } 80 80 81 public static Text getMail(int messageNo) { 81 public static Text getMail(int firstMessage, int lastMessage) { 82 // Swap message numbers if they are around the wrong way 83 if (firstMessage > lastMessage) { 84 int temp = firstMessage; 85 firstMessage = lastMessage; 86 lastMessage = temp; 87 } 88 89 MessageBay.errorMessage("Not yet supported"); 90 91 return null; 92 } 93 94 public static Collection<Text> getMail(int count) { 95 return getMail(null, null, count); 96 } 97 98 public static Text getMailByID(int messageNo) { 82 99 Text mailItem = MailSession.getInstance().getMail( 83 100 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition(), … … 85 102 // MessageBay.displayMessage(mailItems.size() + " messages read", 86 103 // Color.green); 104 if (mailItem == null) { 105 MessageBay 106 .errorMessage("Mail message does not exist: " + messageNo); 107 } 87 108 88 109 return mailItem; -
trunk/src/org/expeditee/agents/mail/MailSession.java
r311 r348 190 190 try { 191 191 MessageBay.displayMessage("New mail message!", 192 null, Color.green, true, "getMail "192 null, Color.green, true, "getMailByID " 193 193 + _folder.getMessageCount()); 194 /* 195 * TODO use messageID incase mail gets deleted 196 * externally 197 */ 194 198 } catch (MessagingException e1) { 195 199 e1.printStackTrace(); … … 444 448 msgs = _folder.getMessages(); 445 449 450 // msgs[0].get 451 446 452 int messagesRead = 0; 447 453 … … 456 462 point.y += newItem.getBoundsHeight(); 457 463 messagesRead++; 464 } else { 465 newItem = null; 458 466 } 459 467 } … … 475 483 Message[] msgs = _folder.getMessages(); 476 484 return readMessage(msgs[msgNum], msgNum + 1, frame, point); 477 } catch (MessagingException e) { 485 } catch (ArrayIndexOutOfBoundsException ae) { 486 /* 487 * Just return null... error message will be displayed in the 488 * calling method 489 */ 490 } catch (Exception e) { 478 491 e.printStackTrace(); 479 492 } … … 492 505 try { 493 506 String subject = message.getSubject(); 494 source.setText( messageNo + ". " + subject);507 source.setText(" " + messageNo + ". " + subject); 495 508 // Create a frameCreator 496 509 final FrameCreator frames = new FrameCreator(frame -
trunk/src/org/expeditee/gui/AttributeUtils.java
r307 r348 70 70 _Ignore.add("p"); 71 71 _Ignore.add("x"); 72 _Ignore.add("y"); 72 _Ignore.add("y"); 73 73 74 74 _ExtractIgnore = new LinkedList<String>(); … … 209 209 "setGradientColor", pColor)); 210 210 211 _SetMethods.put("ga", Item.class.getMethod("setGradientAngle", 212 pInt)); 213 _SetMethods.put("gradientangle", Item.class.getMethod( 214 "setGradientAngle", pInt)); 215 211 216 _SetMethods.put("fillpattern", Item.class.getMethod( 212 217 "setFillPattern", pString)); … … 263 268 _SetMethods.put("width", Text.class.getMethod("setWidth", pInt)); 264 269 _SetMethods.put("w", Text.class.getMethod("setWidth", pInt)); 265 270 266 271 _SetMethods.put("size", Item.class.getMethod("setSize", pFloat)); 267 272 _SetMethods.put("s", Item.class.getMethod("setSize", pFloat)); … … 355 360 if (((Float) o) < -0.0001) 356 361 continue; 357 // Null indicates default362 // Null indicates default 358 363 o = Math.round((Float) o); 359 364 } else if (o instanceof Double) { … … 446 451 return setAttribute(toSet, attribs, 1); 447 452 } 448 449 public static boolean setAttribute(Object toSet, Text attribs, int minAttributeLength) { 453 454 public static boolean setAttribute(Object toSet, Text attribs, 455 int minAttributeLength) { 450 456 // error checking 451 457 if (toSet == null || attribs == null) … … 454 460 if (_Ignore == null) 455 461 initLists(); 456 457 // if(attribs.isAnnotation())458 // 462 463 // if(attribs.isAnnotation()) 464 // return false; 459 465 460 466 // get the list of attribute: value pairs … … 467 473 // loop through all attribute: value pairs 468 474 for (int i = 0; i < values.size(); i++) { 469 AttributeValuePair avp = new AttributeValuePair(values.get(i), false); 475 AttributeValuePair avp = new AttributeValuePair(values.get(i), 476 false); 470 477 471 478 // If the first is not an attribute value pair then dont do 472 479 // attrubute merging 473 if (!avp.hasAttribute() || avp.getAttribute().length() < minAttributeLength) 480 if (!avp.hasAttribute() 481 || avp.getAttribute().length() < minAttributeLength) 474 482 return false; 475 483 -
trunk/src/org/expeditee/gui/Browser.java
r345 r348 14 14 import java.awt.event.WindowListener; 15 15 import java.awt.event.WindowStateListener; 16 import java.io.File; 16 17 import java.util.Collection; 18 import java.util.LinkedList; 17 19 18 20 import javax.swing.JFrame; … … 53 55 54 56 public static Browser _theBrowser = null; 55 57 56 58 private MouseEventRouter _mouseEventRouter; 57 59 … … 98 100 return getContentPane().getLocationOnScreen(); 99 101 } 100 101 /** 102 * @return 103 * The mouse event router used fot this browser. 104 * Never null after browser constructed. 102 103 /** 104 * @return The mouse event router used fot this browser. Never null after 105 * browser constructed. 105 106 */ 106 107 public MouseEventRouter getMouseEventRouter() { … … 151 152 152 153 UserSettings.Init(); 153 UserSettings. Username = FrameIO.ConvertToValidFramesetName(System154 UserSettings.ProfileName = FrameIO.ConvertToValidFramesetName(System 154 155 .getProperty("user.name")); 155 String userName = UserSettings.Username; 156 String userName = UserSettings.ProfileName; 157 UserSettings.UserName = UserSettings.ProfileName; 158 159 Frame profile = loadProfile(userName); 160 161 // Need to display errors once things have been init otherwise 162 // exceptions occur if there are more than four messages neededing to be 163 // displayed. 164 165 Frame defaultProfile = loadProfile(UserSettings.DEFAULT_PROFILE_NAME); 166 167 Collection<String> warningMessages = FrameUtils 168 .ParseProfile(defaultProfile); 169 170 warningMessages.addAll(FrameUtils.ParseProfile(profile)); 171 172 // set the layout to absolute layout for widgets 173 this.getContentPane().setLayout(new AbsoluteLayout()); 174 175 _mouseEventRouter = new MouseEventRouter(getJMenuBar(), 176 getContentPane()); 177 178 // enable the glasspane-for capturing all mouse events 179 this.setGlassPane(_mouseEventRouter); 180 181 this.getGlassPane().setVisible(true); 182 this.getContentPane().setBackground(Color.white); 183 this.getContentPane().setFocusTraversalKeysEnabled(false); 184 185 addComponentListener(this); 186 pack(); 187 188 // Reset windows to user specified size 189 // Must be done after initialising the content pane above! 190 setSizes(new Dimension(UserSettings.InitialWidth, 191 UserSettings.InitialHeight)); 192 193 /* 194 * See Java bug ID 4016934. They say that window closed events are 195 * called once the JFrame is disposed. 196 */ 197 setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 198 199 // Expeditee handles its own repainting of AWT/Swing components 200 RepaintManager.setCurrentManager(ExpediteeRepaintManager.getInstance()); 201 202 // Listen for save status to display during and after runtime 203 EntitySaveManager.getInstance().addSaveStateChangedEventListener(this); 204 205 String version = System.getProperty("java.version"); 206 207 if (version.startsWith("1.6")) { 208 // Set the drag and drop handler 209 _version6 = true; 210 setTransferHandler(FrameDNDTransferHandler.getInstance()); 211 } else { 212 System.out.println("Upgrade to Java 1.6 to enable drag and drop"); 213 } 214 215 try { 216 warningMessages.addAll(Actions.Init()); 217 218 DisplayIO.Init(this); 219 // Set visible must be just after DisplayIO.Init for the message box 220 // to 221 // be the right size 222 setVisible(true); 223 224 setupGraphics(); 225 226 // required to accept TAB key 227 setFocusTraversalKeysEnabled(false); 228 229 // Must be loaded after setupGraphics if images are on the frame 230 // Turn off XRay mode and load the first frame 231 FrameGraphics.setMode(FrameGraphics.MODE_NORMAL, false); 232 FrameUtils.loadFirstFrame(profile); 233 DisplayIO.UpdateTitle(); 234 235 /* 236 * I think this can be moved back up to the top of the Go method 237 * now... It used to crash the program trying to print error 238 * messages up the top 239 */ 240 for (String message : warningMessages) 241 MessageBay.warningMessage(message); 242 243 this.getContentPane().addKeyListener(FrameKeyboardActions.getInstance()); 244 this.addKeyListener(FrameKeyboardActions.getInstance()); 245 246 _mouseEventRouter.addExpediteeMouseListener(FrameMouseActions 247 .getInstance()); 248 _mouseEventRouter.addExpediteeMouseMotionListener(FrameMouseActions 249 .getInstance()); 250 _mouseEventRouter.addExpediteeMouseWheelListener(FrameMouseActions 251 .getInstance()); 252 253 /* 254 * Dont refresh for the profile frame otherwise error messages are 255 * shown twice 256 */ 257 if (!DisplayIO.getCurrentFrame().equals(profile)) 258 FrameKeyboardActions.Refresh(); 259 // setVisible(true); 260 } catch (Exception e) { 261 e.printStackTrace(); 262 Logger.Log(e); 263 } 264 } 265 266 /** 267 * @param userName 268 * @return 269 */ 270 private Frame loadProfile(String userName) { 156 271 Frame profile = FrameIO.LoadProfile(userName); 157 272 if (profile == null) { … … 165 280 } 166 281 } 167 168 // Need to display errors once things have been init otherwise 169 // exceptions occur if there are more than four messages neededing to be 170 // displayed. 171 Collection<String> warningMessages = FrameUtils.ParseProfile(profile); 172 173 // set the layout to absolute layout for widgets 174 this.getContentPane().setLayout(new AbsoluteLayout()); 175 176 _mouseEventRouter = new MouseEventRouter(getJMenuBar(), getContentPane()); 177 178 // enable the glasspane-for capturing all mouse events 179 this.setGlassPane(_mouseEventRouter); 180 181 this.getGlassPane().setVisible(true); 182 this.getContentPane().setBackground(Color.white); 183 this.getContentPane().setFocusTraversalKeysEnabled(false); 184 185 addComponentListener(this); 186 pack(); 187 188 // Reset windows to user specified size 189 // Must be done after initialising the content pane above! 190 setSizes(new Dimension(UserSettings.InitialWidth, 191 UserSettings.InitialHeight)); 192 193 // See java bug ID 4016934. They say that window closed events are 194 // called once the 195 // jframe is disposed. 196 setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 197 198 // Expeditee handles its own repainting of AWT/Swing components 199 RepaintManager.setCurrentManager(ExpediteeRepaintManager.getInstance()); 200 201 // Listen for save status to display during and after runtime 202 EntitySaveManager.getInstance().addSaveStateChangedEventListener(this); 203 204 String version = System.getProperty("java.version"); 205 206 if (version.startsWith("1.6")) { 207 // Set the drag and drop handler 208 _version6 = true; 209 setTransferHandler(FrameDNDTransferHandler.getInstance()); 210 } else { 211 System.out.println("Upgrade to Java 1.6 to enable drag and drop"); 212 } 213 214 try { 215 warningMessages.addAll(Actions.Init()); 216 217 DisplayIO.Init(this); 218 // Set visible must be just after DisplayIO.Init for the message box 219 // to 220 // be the right size 221 setVisible(true); 222 223 setupGraphics(); 224 225 // required to accept TAB key 226 setFocusTraversalKeysEnabled(false); 227 228 // Must be loaded after setupGraphics if images are on the frame 229 // Turn off XRay mode and load the first frame 230 FrameGraphics.setMode(FrameGraphics.MODE_NORMAL, false); 231 FrameUtils.loadFirstFrame(profile); 232 DisplayIO.UpdateTitle(); 233 234 // I think this can be moved back up to the top of the Go method 235 // now... 236 // It used to crash the program trying to print error messages up 237 // the top 238 for (String message : warningMessages) 239 MessageBay.warningMessage(message); 240 241 this.getContentPane().addKeyListener(FrameKeyboardActions.getInstance()); 242 this.addKeyListener(FrameKeyboardActions.getInstance()); 243 244 _mouseEventRouter.addExpediteeMouseListener(FrameMouseActions.getInstance()); 245 _mouseEventRouter.addExpediteeMouseMotionListener(FrameMouseActions.getInstance()); 246 _mouseEventRouter.addExpediteeMouseWheelListener(FrameMouseActions.getInstance()); 247 248 FrameKeyboardActions.Refresh(); 249 // setVisible(true); 250 } catch (Exception e) { 251 e.printStackTrace(); 252 Logger.Log(e); 253 } 282 return profile; 254 283 } 255 284 … … 455 484 MessageBay.displayMessage("System exited"); 456 485 457 //Finally remove the messages frameset 458 FrameIO.moveFrameset("messages", 459 FrameIO.MESSAGES_PATH); 486 // Finally remove the messages frameset 487 FrameIO.moveFrameset("messages", FrameIO.MESSAGES_PATH); 488 489 /* 490 * Create a new messages folder so that it doesn't throw 491 * Exceptions when two Expeditee's open at once and the 492 * second tries to save its messages 493 */ 494 File file = new File(FrameIO.MESSAGES_PATH + "messages"); 495 file.mkdirs(); 460 496 461 497 System.exit(0); -
trunk/src/org/expeditee/gui/DisplayIO.java
r336 r348 71 71 * The title to display in the Title bar. 72 72 */ 73 public static final String TITLE = "Exp 22Sep2008A";73 public static final String TITLE = "Exp03Oct2008A"; 74 74 75 75 private DisplayIO() { … … 806 806 _Robot.keyRelease(key); 807 807 // _Robot.waitForIdle(); 808 Thread.sleep( 100);808 Thread.sleep(200); 809 809 } 810 810 -
trunk/src/org/expeditee/gui/Frame.java
r336 r348 999 999 s.append(String.format("Name: %s%d%n", _frameset, _number)); 1000 1000 s.append(String.format("Version: %d%n", _version)); 1001 // s.append(String.format("Permission: %s%n", _permission.toString()));1002 // s.append(String.format("Owner: %s%n", _owner));1003 // s.append(String.format("Date Created: %s%n", _creationDate));1004 // s.append(String.format("Last Mod. User: %s%n", _modifiedUser));1005 // s.append(String.format("Last Mod. Date: %s%n", _modifiedDate));1001 // s.append(String.format("Permission: %s%n", _permission.toString())); 1002 // s.append(String.format("Owner: %s%n", _owner)); 1003 // s.append(String.format("Date Created: %s%n", _creationDate)); 1004 // s.append(String.format("Last Mod. User: %s%n", _modifiedUser)); 1005 // s.append(String.format("Last Mod. Date: %s%n", _modifiedDate)); 1006 1006 s.append(String.format("Items: %d%n", _body.size())); 1007 1007 return s.toString(); … … 1455 1455 // t.setMaxWidth(FrameGraphics.getMaxFrameSize().width); 1456 1456 // if (t.getWidth() <= 0) { 1457 t.setRightMargin(FrameGraphics.getMaxFrameSize().width); 1457 // String maxWidthString = getAnnotationValue("maxwidth"); 1458 // int width = FrameGraphics.getMaxFrameSize().width; 1459 // if (maxWidthString != null) { 1460 // try { 1461 // width = Math.min(width, Integer.parseInt(maxWidthString)); 1462 // } catch (NumberFormatException nfe) { 1463 // } 1464 // } 1465 // 1466 // t.setRightMargin(width); 1458 1467 // } 1459 1468 addItem(t); -
trunk/src/org/expeditee/gui/FrameGraphics.java
r311 r348 8 8 import java.awt.GraphicsEnvironment; 9 9 import java.awt.Image; 10 import java.awt.Polygon; 10 11 import java.awt.Rectangle; 11 12 import java.awt.RenderingHints; … … 146 147 if (DisplayIO.isTwinFramesOn()) { 147 148 Frame opposite = DisplayIO.getOppositeFrame(); 148 149 /* When running the test suite opposite may be null!*/149 150 /* When running the test suite opposite may be null! */ 150 151 if (opposite != null) { 151 opposite.setBuffer(null);152 opposite.refreshSize();152 opposite.setBuffer(null); 153 opposite.refreshSize(); 153 154 } 154 155 } … … 319 320 public static void paintFrame(Frame toPaint, Area clip, 320 321 boolean isActualFrame, boolean createVolitile, Graphics2D bg) { 321 322 322 323 // Prepare render passes 323 324 if (isActualFrame) { … … 328 329 } 329 330 } 330 331 331 332 bg.setClip(clip); 332 333 … … 671 672 int cmp = aArea.compareTo(bArea); 672 673 if (cmp == 0) { 673 // System.out.println(a.getEnclosureID() + " " + b.getID()); 674 return new Integer(a.getEnclosureID()).compareTo(b 675 .getEnclosureID()); 674 // System.out.println(a.getEnclosureID() + " " + 675 // b.getID());\ 676 //Shapes to the left go underneath 677 Polygon pA = a.getEnclosedShape(); 678 Polygon pB = b.getEnclosedShape(); 679 if(pA == null || pB == null) 680 return 0; 681 return new Integer(pA.getBounds().x) 682 .compareTo(pB.getBounds().x); 676 683 } 677 684 return cmp * -1; … … 920 927 damagedAreas.clear(); 921 928 } 922 // System.out.println("FULLSCREEN REFRESH"); // TODO: REMOVE929 // System.out.println("FULLSCREEN REFRESH"); // TODO: REMOVE 923 930 } 924 931 … … 1032 1039 */ 1033 1040 public interface FrameRenderPass { 1034 1041 1035 1042 /** 1036 1043 * 1037 1044 * @param currentClip 1038 1045 * 1039 * @return 1040 * The clip that the pass should use instead. 1041 * i.e. if there are any effects that cannot invladate prior to paint call. 1046 * @return The clip that the pass should use instead. i.e. if there are 1047 * any effects that cannot invladate prior to paint call. 1042 1048 */ 1043 1049 Area paintStarted(Area currentClip); 1044 1050 1045 1051 void paintFinalPass(Graphics g); 1046 1052 1047 1053 void paintPreLayeredPanePass(Graphics g); 1048 1054 } -
trunk/src/org/expeditee/gui/FrameIO.java
r336 r348 1 1 package org.expeditee.gui; 2 2 3 import java.io.BufferedOutputStream; 3 4 import java.io.BufferedReader; 4 5 import java.io.BufferedWriter; … … 10 11 import java.io.FileWriter; 11 12 import java.io.IOException; 13 import java.io.OutputStream; 14 import java.io.OutputStreamWriter; 15 import java.io.Writer; 12 16 import java.sql.Time; 13 17 import java.util.Collection; … … 653 657 + template.getName() + " from TDFC"); 654 658 655 template.setOwner(UserSettings.User name);659 template.setOwner(UserSettings.UserName); 656 660 template.resetDateCreated(); 657 661 for (Item i : template.getItems()) { … … 664 668 665 669 if (!DisplayIO.isTwinFramesOn()) { 666 // BROOK: This had recursion!! Changed to avoid...667 670 if ((titleItem.getX() + 1) < template.getNameItem().getX()) { 668 while (titleItem.get BoundsWidth() + titleItem.getX() > template671 while (titleItem.getSize() > Text.MINIMUM_FONT_SIZE && titleItem.getBoundsWidth() + titleItem.getX() > template 669 672 .getNameItem().getX()) { 670 673 titleItem.setSize(titleItem.getSize() - 1); 674 671 675 } 672 676 } else { … … 832 836 savedVersion = KMSReader.getVersion(fullPath); 833 837 } 838 839 // Check if the frame doesnt exist 840 // if (savedVersion < 0) { 841 // /* 842 // * This will happen if the user has two Expeditee's running at 843 // * once and closes the first. When the second one closes the 844 // * messages directory will have been deleted. 845 // */ 846 // MessageBay 847 // .errorMessage("Could not save frame that does not exist: " 848 // + toSave.getName()); 849 // return null; 850 // } 851 834 852 // Check if we are trying to save an out of date version 835 853 if (savedVersion > toSave.getVersion() … … 944 962 if (toCheck.getNumber() == 0) 945 963 return false; 946 return toCheck.getFramesetName() 947 .equalsIgnoreCase(UserSettings.Username); 964 return toCheck.getPath().equals(PROFILE_PATH); 965 //return toCheck.getFramesetName() 966 // .equalsIgnoreCase(UserSettings.ProfileName); 948 967 } 949 968 … … 954 973 public static Frame CreateNewProfile(String username) throws Exception { 955 974 Frame profile = CreateFrameset(username, PROFILE_PATH, true); 956 FrameUtils.CreateDefaultProfile( profile);975 FrameUtils.CreateDefaultProfile(username, profile); 957 976 return profile; 958 977 } … … 1445 1464 // Save the new version 1446 1465 try { 1447 FileWriter fw = new FileWriter(file); 1466 // FileWriter fw = new FileWriter(file); 1467 1468 // Open an Output Stream Writer to set encoding 1469 OutputStream fout = new FileOutputStream(file); 1470 OutputStream bout = new BufferedOutputStream(fout); 1471 Writer fw = new OutputStreamWriter(bout, "UTF-8"); 1472 1448 1473 String nextLine = null; 1449 1474 while ((nextLine = packetContents.readLine()) != null) { … … 1470 1495 public static void setSavedProperties(Frame toSave) { 1471 1496 toSave.setLastModifyDate(Logger.EasyDateFormat("ddMMMyyyy:HHmm")); 1472 toSave.setLastModifyUser(UserSettings.User name);1497 toSave.setLastModifyUser(UserSettings.UserName); 1473 1498 toSave.setVersion(toSave.getVersion() + 1); 1474 1499 Time darkTime = new Time(SessionStats.getFrameDarkTime().getTime() -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r345 r348 219 219 } else { 220 220 text.setRightMargin(FrameGraphics.getMaxFrameSize().width); 221 222 // Check for the annotation that restricts the width of text items 223 // on the frame 224 String widthString; 225 if ((widthString = text.getParentOrCurrentFrame() 226 .getAnnotationValue("maxwidth")) != null) { 227 try { 228 int width = text.getWidth(); 229 int maxWidth = Integer.parseInt(widthString); 230 if (maxWidth < width) 231 text.setWidth(maxWidth); 232 } catch (NumberFormatException nfe) { 233 } 234 } 221 235 } 222 236 } … … 912 926 break; 913 927 case KeyEvent.VK_S: 928 /* 929 * Only split when shift is down... it is too easy to accidentally 930 * hit Ctrl+S after completing a paragraph because this is the 931 * shortcut for saving a document in most word processors and text 932 * editors! 933 * 934 */ 935 if (!isShiftDown){ 936 Save(); 937 return; 938 } 914 939 Text text2 = getCurrentTextItem(); 915 940 // split the current text item … … 1009 1034 Rectangle rect = firstConnected.getEnclosedShape() 1010 1035 .getBounds(); 1011 DisplayIO.setCursorPosition(rect.x + Text.MARGIN_LEFT, 1012 Text.MARGIN_LEFT 1013 + rect.y 1014 + DisplayIO.getCurrentFrame() 1015 .getItemTemplate() 1016 .getBoundsHeight()); 1036 int newX = rect.x + Text.MARGIN_LEFT; 1037 int newY = Text.MARGIN_LEFT 1038 + rect.y 1039 + DisplayIO.getCurrentFrame().getItemTemplate() 1040 .getBoundsHeight(); 1041 moveCursorAndFreeItems(newX, newY); 1042 // TODO can resetOffset be put inside 1043 // moveCursorAndFreeItems 1044 FrameMouseActions.resetOffset(); 1017 1045 } 1018 1046 break; … … 1259 1287 1260 1288 dummyItem.setPosition(xPos, yPos); 1261 DisplayIO.setCursorPosition(xPos, yPos); 1289 // DisplayIO.setCursorPosition(xPos, yPos); 1290 1291 checkMovingCursor(dummyItem); 1262 1292 } else { 1263 1293 int yPos = column.get(0).getY() + 1; 1294 int xPos = column.get(0).getX(); 1264 1295 // Either position the new item below the title or just above 1265 1296 // the first item below the title 1266 if (toDropFrom == title && column.get(0) != title) 1267 yPos = Math.min(column.get(0).getY() - 1, title.getY() 1268 + title.getBoundsHeight() 1269 + dummyItem.getBoundsHeight()); 1270 dummyItem.setPosition(column.get(0).getX(), yPos); 1297 if (toDropFrom == title && column.get(0) != title) { 1298 // If dropping from the title position just above top item 1299 yPos = column.get(0).getY() - 1; 1300 1301 Frame current = DisplayIO.getCurrentFrame(); 1302 // Check for @start on the zero frame 1303 Frame zero = FrameIO 1304 .LoadFrame(current.getFramesetName() + '0'); 1305 Text start = zero.getAnnotation("start"); 1306 if (start != null) { 1307 yPos = Math.min(yPos, start.getY()); 1308 } 1309 } 1310 dummyItem.setPosition(xPos, yPos); 1271 1311 column.add(dummyItem); 1272 1312 FrameUtils.Align(column, false, 0); … … 1336 1376 } 1337 1377 1338 // Move the item to the cursor position 1339 if (FreeItems.itemsAttachedToCursor()) { 1340 DisplayIO.setCursorPosition(dummyItem.getX(), dummyItem 1341 .getY()); 1342 Item firstItem = FreeItems.getItemAttachedToCursor(); 1343 int deltaX = firstItem.getX() - dummyItem.getX(); 1344 int deltaY = firstItem.getY() - dummyItem.getY(); 1345 1346 for (Item i : FreeItems.getInstance()) { 1347 i.setPosition(i.getX() - deltaX, i.getY() - deltaY); 1348 } 1349 } else { 1350 DisplayIO.MoveCursorToEndOfItem(dummyItem); 1351 } 1378 checkMovingCursor(dummyItem); 1352 1379 } 1353 1380 if (dummyItem.getText().length() == 0 … … 1367 1394 } 1368 1395 return true; 1396 } 1397 1398 /** 1399 * @param dummyItem 1400 */ 1401 private static void checkMovingCursor(Text dummyItem) { 1402 // Move the item to the cursor position 1403 if (FreeItems.itemsAttachedToCursor()) { 1404 moveCursorAndFreeItems(dummyItem.getX(), dummyItem.getY()); 1405 } else { 1406 DisplayIO.MoveCursorToEndOfItem(dummyItem); 1407 } 1408 } 1409 1410 /** 1411 * @param dummyItem 1412 */ 1413 public static void moveCursorAndFreeItems(int x, int y) { 1414 DisplayIO.setCursorPosition(x, y); 1415 Item firstItem = FreeItems.getItemAttachedToCursor(); 1416 int deltaX = firstItem.getX() - x; 1417 int deltaY = firstItem.getY() - y; 1418 1419 for (Item i : FreeItems.getInstance()) { 1420 i.setPosition(i.getX() - deltaX, i.getY() - deltaY); 1421 } 1369 1422 } 1370 1423 … … 1590 1643 toSize.addAll(toSet.getLines()); 1591 1644 } else if (toSet instanceof Line) { 1592 1645 1593 1646 Line line = (Line) toSet; 1594 1595 if (!(toSet instanceof WidgetEdge) || ((WidgetEdge)toSet).getWidgetSource().isWidgetEdgeThicknessAdjustable()) { 1647 1648 if (!(toSet instanceof WidgetEdge) 1649 || ((WidgetEdge) toSet).getWidgetSource() 1650 .isWidgetEdgeThicknessAdjustable()) { 1596 1651 1597 1652 float current = Math.abs(line.getThickness()); … … 1600 1655 FrameGraphics.Repaint(); 1601 1656 return; 1602 1603 } 1604 1657 1658 } 1659 1605 1660 } else { 1606 1661 toSize.add(toSet); … … 1620 1675 1621 1676 if (i.isLineEnd()) { 1622 1623 if (!(i instanceof WidgetCorner) || !((WidgetCorner)i).getWidgetSource().isFixedSize()) { // don't size fixed widgets 1624 1677 1678 if (!(i instanceof WidgetCorner) 1679 || !((WidgetCorner) i).getWidgetSource() 1680 .isFixedSize()) { // don't size fixed 1681 // widgets 1682 1625 1683 Collection<Item> allConnected = i.getAllConnected(); 1626 1684 done.addAll(allConnected); 1627 1685 for (Item it : allConnected) { 1628 1686 it.translate(origin, ratio); 1629 it 1630 .setArrowheadLength((float) (it 1631 .getArrowheadLength() * ratio)); 1687 it.setArrowheadLength((float) (it 1688 .getArrowheadLength() * ratio)); 1632 1689 } 1633 1690 i.setThickness((float) (i.getThickness() * ratio)); … … 1638 1695 // Ensure that the source is done before the XRayable 1639 1696 if (!done.contains(source)) { 1640 scaleText( origin, ratio, done, source);1697 scaleText(insideEnclosure, origin, ratio, done, source); 1641 1698 } 1642 1699 … … 1662 1719 item.getParent().parse(); 1663 1720 } else if (i instanceof Text) { 1664 scaleText( origin, ratio, done, (Text) i);1721 scaleText(insideEnclosure, origin, ratio, done, (Text) i); 1665 1722 } 1666 1723 } … … 1727 1784 * @param source 1728 1785 */ 1729 private static void scaleText( Point2D origin, double ratio,1786 private static void scaleText(boolean insideEnclosure, Point2D origin, double ratio, 1730 1787 Collection<Item> done, Text source) { 1788 if(insideEnclosure) 1789 source.setWidth(Math.round((float) (source.getWidth() * ratio))); 1731 1790 source.translate(origin, ratio); 1732 1791 source.setSize((float) (source.getSize() * ratio)); … … 2117 2176 public static void Refresh() { 2118 2177 Frame currentFrame = DisplayIO.getCurrentFrame(); 2119 2120 // Refresh widgets that use its self as a data source2178 2179 // Refresh widgets that use its self as a data source 2121 2180 currentFrame.notifyObservers(); 2122 2181 2123 2182 if (FrameIO.isProfileFrame(currentFrame)) { 2124 2183 // TODO ensure that users can not delete the first frame in a -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r320 r348 649 649 if (clicked instanceof Text) { 650 650 Text text = (Text) clicked; 651 /* Dont follow link when just highlighting text with the left button*/651 /* Dont follow link when just highlighting text with the left button */ 652 652 if (text.getText().length() == 0) 653 653 clicked = null; 654 else if (text.getSelectionSize() > 0) {654 else if (text.getSelectionSize() > 0) { 655 655 return; 656 656 } … … 689 689 if (clicked != null) { 690 690 // check item permissions 691 if (!clicked.hasPermission(Permission.followLinks)) { 691 if ((clicked.hasLink() && !clicked 692 .hasPermission(Permission.followLinks)) 693 || (!clicked.hasLink() && !clicked 694 .hasPermission(Permission.createFrames))) { 692 695 Item editTarget = clicked.getEditTarget(); 693 696 if (editTarget != clicked … … 1609 1612 private void mouseMoved(MouseEvent e, boolean shiftStateChanged) { 1610 1613 1611 // System.out.println(_context);1614 // System.out.println(_context); 1612 1615 if (_context == CONTEXT_FREESPACE) 1613 1616 FrameKeyboardActions.resetEnclosedItems(); … … 2043 2046 // around it 2044 2047 String text = linker.getText(); 2045 if (text.equals("@v") || text.equals("@f")) { 2048 boolean isVector = text.equals("@v") || text.equals("@av"); 2049 2050 if (isVector || text.equals("@f")) { 2046 2051 Collection<Item> enclosure = FrameUtils.getEnclosingLineEnds(linker 2047 2052 .getPosition()); … … 2049 2054 for (Item i : enclosure) { 2050 2055 if (i.isLineEnd() && i.isEnclosed()) { 2051 DisplayIO.getCurrentFrame().removeAllItems(enclosure); 2056 if (!isVector) 2057 DisplayIO.getCurrentFrame().removeAllItems( 2058 enclosure); 2052 2059 Rectangle rect = i.getEnclosedRectangle(); 2053 2060 long width = Math.round(rect.getWidth()); 2054 if ( text.equals("@v")) {2061 if (isVector) { 2055 2062 NumberFormat nf = Vector.getNumberFormatter(); 2056 linker.setText("@v: " 2063 linker.setText(linker.getText() 2064 + ": " 2057 2065 + nf.format((width / FrameGraphics 2058 2066 .getMaxFrameSize().getWidth()))); … … 2067 2075 } 2068 2076 } 2069 FrameMouseActions.deleteItems(enclosure, false); 2077 if (!isVector) 2078 FrameMouseActions.deleteItems(enclosure, false); 2070 2079 } 2071 2080 } … … 2983 2992 return new Point(getX(), getY()); 2984 2993 } 2985 2994 2986 2995 public static Point getFreeItemsOffset() { 2987 2996 return new Point(_offX, _offY); -
trunk/src/org/expeditee/gui/FrameUtils.java
r336 r348 54 54 public static int MINIMUM_INTERITEM_SPACING = -6; 55 55 56 public static Double MAXIMUM_SPACING_RATIO = null; 57 58 public static Double MINIMUM_SPACING_RATIO = null; 59 56 60 public static float getResponseTimeTotal() { 57 61 return _ResponseTimeSum; … … 148 152 Collections.sort(toAlign); 149 153 150 // Single items dont need alignment 151 if (toAlign.size() < 2) 154 /* 155 * Single items dont need alignment But if there are two items we may 156 * still want to format them... ie if they are too close together. 157 */ 158 if (toAlign.size() < 1) 152 159 return 0; 153 160 … … 215 222 if (space < MINIMUM_INTERITEM_SPACING) 216 223 space = MINIMUM_INTERITEM_SPACING; 224 225 if (MAXIMUM_SPACING_RATIO != null) { 226 double maxSpace = MAXIMUM_SPACING_RATIO * above.getSize(); 227 if (maxSpace < space) { 228 space = (int) Math.round(maxSpace); 229 } 230 } 231 232 if (MINIMUM_SPACING_RATIO != null) { 233 double minSpace = MINIMUM_SPACING_RATIO * above.getSize(); 234 if (minSpace > space) { 235 space = (int) Math.round(minSpace); 236 } 237 } 217 238 218 239 if (above != curr.getNameItem() && above != curr.getTitleItem()) … … 451 472 452 473 public static void DisplayProfileFrame() { 453 DisplayFrame(UserSettings. Username + '1');474 DisplayFrame(UserSettings.ProfileName + '1'); 454 475 } 455 476 … … 576 597 UserSettings.HomeFrame = profile.getName(); 577 598 } 578 } else if (attribute.equals(" menuframe"))579 UserSettings. MenuFrame = getLink(item, UserSettings.MenuFrame);580 else if (attribute.equals("defaultframe"))599 } else if (attribute.equals("username")) { 600 UserSettings.UserName = avp.getValue(); 601 } else if (attribute.equals("defaultframe")) 581 602 UserSettings.DefaultFrame = getLink(item, 582 603 UserSettings.DefaultFrame); … … 599 620 else if (attribute.equals("noopthreshold")) 600 621 UserSettings.NoOpThreshold = avp.getIntegerValue(); 601 else if (attribute.equals("initialwidth")) { 622 else if (attribute.equals("formatspacingmin")) { 623 FrameUtils.MINIMUM_SPACING_RATIO = avp.getDoubleValue(); 624 } else if (attribute.equals("formatspacingmax")) { 625 FrameUtils.MAXIMUM_SPACING_RATIO = avp.getDoubleValue(); 626 } else if (attribute.equals("initialwidth")) { 602 627 UserSettings.InitialWidth = avp.getIntegerValue(); 603 628 } else if (attribute.equals("initialheight")) { … … 670 695 } 671 696 697 /** 698 * Sets the first frame to be displayed. 699 * 700 * @param profile 701 */ 672 702 public static void loadFirstFrame(Frame profile) { 673 703 if (UserSettings.HomeFrame == null) 674 704 UserSettings.HomeFrame = profile.getName(); 675 // else { 705 676 706 Frame firstFrame = FrameIO.LoadFrame(UserSettings.HomeFrame); 677 707 if (firstFrame == null) { … … 683 713 DisplayIO.setCurrentFrame(firstFrame, true); 684 714 } 685 // } 715 686 716 } 687 717 … … 1363 1393 * Fills the given Frame with default profile tags 1364 1394 */ 1365 public static void CreateDefaultProfile( Frame profile) {1395 public static void CreateDefaultProfile(String username, Frame profile) { 1366 1396 Text title = profile.getTitleItem(); 1367 title.setText("Profile Frame"); 1397 if(username.equals(UserSettings.DEFAULT_PROFILE_NAME)){ 1398 title.setText("Default Profile Frame"); 1399 }else{ 1400 title.setText(username + "'s Profile Frame"); 1401 } 1368 1402 title.setSize(50); 1369 1403 title.setFontStyle("Bold"); … … 1378 1412 1379 1413 yPos += spacing; 1380 profile.addText(xPos, yPos, " HomeFrame: " + profile.getName(), null,1414 profile.addText(xPos, yPos, "@HomeFrame: " + profile.getName(), null, 1381 1415 profile.getName()); 1382 1416 yPos += spacing; 1383 1417 String defaultFrameName = profile.getFramesetName() + "0"; 1384 profile.addText(xPos, yPos, " DefaultFrame: " + defaultFrameName, null,1418 profile.addText(xPos, yPos, "@DefaultFrame: " + defaultFrameName, null, 1385 1419 defaultFrameName); 1386 1420 yPos += spacing; 1387 1421 1388 profile.addText(xPos, yPos, " InitialWidth: "1422 profile.addText(xPos, yPos, "@InitialWidth: " 1389 1423 + UserSettings.InitialWidth, null); 1390 1424 yPos += spacing; 1391 1425 1392 profile.addText(xPos, yPos, " InitialHeight: "1426 profile.addText(xPos, yPos, "@InitialHeight: " 1393 1427 + UserSettings.InitialHeight, null); 1394 1428 yPos += spacing; 1395 1429 1396 Text t = profile.addText(xPos, yPos, " ItemTemplate", null);1430 Text t = profile.addText(xPos, yPos, "@ItemTemplate", null); 1397 1431 t.setColor(null); 1398 1432 1399 1433 yPos += spacing; 1400 t = profile.addText(xPos, yPos, " AnnotationTemplate", null);1434 t = profile.addText(xPos, yPos, "@AnnotationTemplate", null); 1401 1435 t.setColor(Color.gray); 1402 1436 1403 1437 yPos += spacing; 1404 t = profile.addText(xPos, yPos, " CommentTemplate", null);1438 t = profile.addText(xPos, yPos, "@CommentTemplate", null); 1405 1439 t.setColor(Color.green.darker()); 1406 1440 1407 1441 yPos += spacing; 1408 t = profile.addText(xPos, yPos, " StatsTemplate", null);1442 t = profile.addText(xPos, yPos, "@StatsTemplate", null); 1409 1443 t.setColor(Color.BLACK); 1410 1444 t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F)); … … 1413 1447 1414 1448 xPos = 600; 1415 yPos = intialYPos ;1449 yPos = intialYPos + spacing; 1416 1450 1417 1451 // Iterate through the help folder and add links -
trunk/src/org/expeditee/gui/Reminders.java
r285 r348 58 58 _alertsRunning--; 59 59 reminderItem.setText("@" + reminderItem.getText()); 60 FrameIO.ForceSaveFrame(reminderItem.getParent()); 60 61 if (_alertsRunning == 0) { 61 62 _bStop = false; -
trunk/src/org/expeditee/gui/UserSettings.java
r311 r348 14 14 */ 15 15 public abstract class UserSettings { 16 17 public final static String DEFAULT_PROFILE_NAME = "default"; 16 18 17 19 public static List<Text> Style = new LinkedList<Text>();; … … 31 33 public static int InitialHeight = 768; 32 34 33 public static String Username; 34 35 public static String ProfileName; 36 37 public static String UserName; 38 35 39 public static String DefaultFrame = null; 36 40 -
trunk/src/org/expeditee/io/AbstractHTMLWriter.java
r309 r348 26 26 _writer.write("<html>" + ItemWriter.NEW_LINE); 27 27 _writer.write("<head>" + ItemWriter.NEW_LINE); 28 _writer 29 .write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"); 28 30 _writer.write("<title>" + start.getTitle()); 29 31 _writer.write("</title>" + ItemWriter.NEW_LINE); … … 59 61 + Conversion.getCssFontFamily(font.getFamily())); 60 62 61 // writer.write("; font-size: " + Math.round(style.getSize()) + "px");62 63 // writer.write("; font-size: " + Math.round(style.getSize()) + "px"); 64 63 65 if (font.isBold()) { 64 66 writer.write("; font-weight: bold"); -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r309 r348 2 2 3 3 import java.awt.Desktop; 4 import java.io.BufferedOutputStream; 4 5 import java.io.File; 5 import java.io.File Writer;6 import java.io.FileOutputStream; 6 7 import java.io.IOException; 8 import java.io.OutputStream; 9 import java.io.OutputStreamWriter; 7 10 import java.io.Writer; 8 11 import java.lang.reflect.Method; … … 87 90 _ItemTags.put("e", Item.class.getMethod("getFillColor", param)); 88 91 _ItemTags.put("E", Item.class.getMethod("getGradientColor", param)); 92 _ItemTags.put("Q", Item.class.getMethod("getGradientAngle", param)); 89 93 90 94 _ItemTags.put("i", Item.class.getMethod("getFillPattern", param)); … … 198 202 File test = new File(_filename); 199 203 200 test = test.getParentFile(); 201 if (test != null && !test.exists()) { 202 test.mkdirs(); 203 } 204 205 _writer = new ProxyWriter(new FileWriter(_filename)); 204 File parent = test.getParentFile(); 205 if (parent != null && !parent.exists()) { 206 parent.mkdirs(); 207 } 208 209 // Open an Output Stream Writer to set encoding 210 OutputStream fout = new FileOutputStream(_filename); 211 OutputStream bout = new BufferedOutputStream(fout); 212 Writer out = new OutputStreamWriter(bout, "UTF-8"); 213 214 _writer = new ProxyWriter(out); 206 215 _output = _filename; 207 216 } -
trunk/src/org/expeditee/io/ExpReader.java
r298 r348 271 271 } catch (Exception e) { 272 272 } 273 return 0;273 return -1; 274 274 } 275 275 } -
trunk/src/org/expeditee/io/ExpWriter.java
r306 r348 1 1 package org.expeditee.io; 2 2 3 import java.io.BufferedOutputStream; 3 4 import java.io.File; 4 import java.io.File Writer;5 import java.io.FileOutputStream; 5 6 import java.io.IOException; 7 import java.io.OutputStream; 8 import java.io.OutputStreamWriter; 6 9 import java.io.Writer; 7 10 import java.lang.reflect.Method; … … 12 15 import org.expeditee.agents.DefaultAgent; 13 16 import org.expeditee.gui.Frame; 17 import org.expeditee.gui.MessageBay; 14 18 import org.expeditee.items.Constraint; 15 19 import org.expeditee.items.Item; … … 45 49 46 50 _stringWriter = new StringBuilder(); 47 48 49 if (writer != null){ 51 52 if (writer != null) { 50 53 _writer = new ProxyWriter(writer); 51 54 _output = writer.toString(); 52 } else if (_filename.equalsIgnoreCase(DefaultAgent.CLIPBOARD)) {55 } else if (_filename.equalsIgnoreCase(DefaultAgent.CLIPBOARD)) { 53 56 _writer = new ProxyWriter(true); 54 57 _filename = DefaultAgent.CLIPBOARD; 55 } else 56 _writer = new ProxyWriter(new FileWriter(_filename)); 57 58 59 58 } else { 59 // Open an Output Stream Writer to set encoding 60 OutputStream fout = new FileOutputStream(_filename); 61 OutputStream bout = new BufferedOutputStream(fout); 62 Writer out = new OutputStreamWriter(bout, "UTF-8"); 63 64 _writer = new ProxyWriter(out); 65 } 66 60 67 try { 61 68 _FrameTags.remove("A"); 62 _ItemTags.put("S", Item.class.getMethod("getTypeAndID", new Class[] {})); 69 _ItemTags.put("S", Item.class.getMethod("getTypeAndID", 70 new Class[] {})); 63 71 } catch (Exception e) { 64 72 … … 67 75 68 76 /** 69 * Writes the given Frame (and all items it contains) to a Expeditee file. Note:70 * File path and location must be set before calling this or it will do71 * nothing.77 * Writes the given Frame (and all items it contains) to a Expeditee file. 78 * Note: File path and location must be set before calling this or it will 79 * do nothing. 72 80 * 73 81 * @param frame … … 82 90 writeHeader(frame); 83 91 84 85 92 // write each item in the frame 86 93 for (Item i : frame.getItemsToSave()) { 87 assert (!(i instanceof Line));94 assert (!(i instanceof Line)); 88 95 writeItem(i); 89 96 } … … 96 103 writeTerminator(); 97 104 writeLine(SessionStats.getFrameEventList(frame)); 98 105 99 106 return; 100 107 } … … 139 146 _stringWriter.append(toWrite); 140 147 } 141 148 142 149 // writes the given Item out to the file 143 150 // This method is not used to write out LINE items -
trunk/src/org/expeditee/io/FrameReader.java
r298 r348 5 5 import java.awt.Point; 6 6 import java.io.BufferedReader; 7 import java.io.FileInputStream; 7 8 import java.io.FileReader; 8 9 import java.io.IOException; 10 import java.io.InputStreamReader; 11 import java.io.Reader; 9 12 import java.lang.reflect.Method; 10 13 import java.util.LinkedHashMap; … … 93 96 _ItemTags.put('e', Item.class.getMethod("setFillColor", pColor)); 94 97 _ItemTags.put('E', Item.class.getMethod("setGradientColor", pColor)); 98 _ItemTags.put('Q', Item.class.getMethod("setGradientAngle", pInt)); 99 95 100 _ItemTags.put('i', Item.class.getMethod("setFillPattern", pString)); 96 101 _ItemTags.put('o', Item.class.getMethod("setOwner", pString)); … … 129 134 130 135 public Frame readFrame(String fullPath) throws IOException { 131 return readFrame(new BufferedReader(new FileReader(fullPath))); 136 Reader in = new InputStreamReader(new FileInputStream(fullPath), "UTF-8"); 137 return readFrame(new BufferedReader(in)); 132 138 } 133 139 -
trunk/src/org/expeditee/io/KMSReader.java
r298 r348 550 550 } catch (Exception e) { 551 551 } 552 return 0;552 return -1; 553 553 } 554 554 } -
trunk/src/org/expeditee/io/KMSWriter.java
r306 r348 1 1 package org.expeditee.io; 2 2 3 import java.io.BufferedOutputStream; 3 4 import java.io.File; 5 import java.io.FileOutputStream; 4 6 import java.io.FileWriter; 5 7 import java.io.IOException; 8 import java.io.OutputStream; 9 import java.io.OutputStreamWriter; 6 10 import java.io.Writer; 7 11 import java.lang.reflect.InvocationTargetException; … … 50 54 _writer = new ProxyWriter(true); 51 55 _filename = DefaultAgent.CLIPBOARD; 52 } else 53 _writer = new ProxyWriter(new FileWriter(_filename)); 54 56 } else{ 57 // Open an Output Stream Writer to set encoding 58 OutputStream fout = new FileOutputStream(_filename); 59 OutputStream bout = new BufferedOutputStream(fout); 60 Writer out = new OutputStreamWriter(bout, "UTF-8"); 61 _writer = new ProxyWriter(out); 62 } 63 55 64 try { 56 65 _FrameTags.put("A", Frame.class.getMethod("getName", new Class[] {})); -
trunk/src/org/expeditee/io/Logger.java
r86 r348 1 1 package org.expeditee.io; 2 2 3 import java.io.BufferedOutputStream; 3 4 import java.io.BufferedWriter; 4 5 import java.io.File; 6 import java.io.FileOutputStream; 5 7 import java.io.FileWriter; 6 8 import java.io.IOException; 9 import java.io.OutputStream; 10 import java.io.OutputStreamWriter; 11 import java.io.Writer; 7 12 import java.sql.Time; 8 13 import java.text.SimpleDateFormat; -
trunk/src/org/expeditee/io/PDF2Writer.java
r306 r348 49 49 _pdfDocument.open(); 50 50 _pdfDocument.addCreationDate(); 51 _pdfDocument.addAuthor(UserSettings.User name);51 _pdfDocument.addAuthor(UserSettings.UserName); 52 52 _pdfDocument.addCreator("Expeditee"); 53 53 } catch (DocumentException e) { -
trunk/src/org/expeditee/io/PDFWriter.java
r309 r348 52 52 _pdfDocument.open(); 53 53 _pdfDocument.addCreationDate(); 54 _pdfDocument.addAuthor(UserSettings.User name);54 _pdfDocument.addAuthor(UserSettings.UserName); 55 55 _pdfDocument.addCreator("Expeditee"); 56 56 _pdfDocument.addTitle(start.getTitle()); -
trunk/src/org/expeditee/io/PdfFramesetWriter.java
r306 r348 72 72 _pdfDocument.open(); 73 73 _pdfDocument.addCreationDate(); 74 _pdfDocument.addAuthor(UserSettings.User name);74 _pdfDocument.addAuthor(UserSettings.UserName); 75 75 _pdfDocument.addCreator("Expeditee"); 76 76 } catch (DocumentException e) { -
trunk/src/org/expeditee/items/Item.java
r311 r348 74 74 protected boolean _connectedToAnnotation = false; 75 75 76 private int _gradientAngle = 0; 77 76 78 public static final int NEAR_DISTANCE = 15; 77 79 … … 162 164 dest.setFillColor(source.getFillColor()); 163 165 dest.setGradientColor(source.getGradientColor()); 166 dest.setGradientAngle(source.getGradientAngle()); 164 167 dest.setFillPattern(source.getFillPattern()); 165 168 … … 182 185 dest.setArrow(source.getArrowheadLength(), source.getArrowheadRatio()); 183 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 /* 188 * Calling the methods will move the item... This messes things up when 189 * the user uses backspace to delete a text line end 190 */ 187 191 dest._anchorBottom = source._anchorBottom; 188 192 dest._anchorRight = source._anchorRight; … … 206 210 // dest.setID(source.getID()); 207 211 // } 212 } 213 214 public void setGradientAngle(int gradientAngle) { 215 _gradientAngle = gradientAngle; 216 217 for (Line line : _lines) { 218 Item other = line.getOppositeEnd(this); 219 if (other.getGradientAngle() != gradientAngle) 220 other.setGradientAngle(gradientAngle); 221 } 222 223 invalidateCommonTrait(ItemAppearence.GradientColor); 224 invalidateFill(); 225 } 226 227 public int getGradientAngle() { 228 return _gradientAngle; 208 229 } 209 230 … … 1054 1075 Color gradientColor = getGradientColor(); 1055 1076 if (gradientColor != null) { 1056 // The painting is not efficient enough for gradients... 1077 /* 1078 * It is slow when painting gradients... modify so this is only done 1079 * once unless it is resized... 1080 */ 1057 1081 Shape s = getEnclosedShape(); 1058 1082 if (s != null) { 1059 1083 Rectangle b = s.getBounds(); 1060 GradientPaint gp = new GradientPaint( 1061 (int) (b.x + b.width * 0.3), b.y, fillColor, 1062 (int) (b.x + b.width * 1.3), b.y, gradientColor); 1084 double rads = getGradientAngle() * Math.PI / 180; 1085 double cos = Math.cos(rads); 1086 double sin = Math.sin(rads); 1087 1088 GradientPaint gp = new GradientPaint((int) (b.x + b.width 1089 * (0.2 * cos + 0.5)), (int) (b.y + b.height 1090 * (0.2 * sin + 0.5)), fillColor, (int) (b.x + b.width 1091 * (-0.8 * cos + 0.5)), (int) (b.y + b.height 1092 * (-0.8 * sin + 0.5)), gradientColor); 1063 1093 g.setPaint(gp); 1064 1094 } -
trunk/src/org/expeditee/items/Justification.java
r147 r348 16 16 assert (justCode != null); 17 17 justCode = justCode.trim().toLowerCase(); 18 18 19 19 // if it is a single char just match the first character 20 20 if (justCode.length() == 1) { 21 char code = justCode.charAt(0);21 char code = justCode.charAt(0); 22 22 Justification[] values = values(); 23 for (int i = 1; i < values.length; i++) {23 for (int i = 0; i < values.length; i++) { 24 24 Justification j = values[i]; 25 if (Character.toLowerCase(j.name().charAt(0)) == code)25 if (Character.toLowerCase(j.name().charAt(0)) == code) 26 26 return j; 27 27 } 28 28 // Otherwise match the whole string 29 } else{30 try {31 return valueOf(justCode);32 } catch (Exception e) {29 } else { 30 try { 31 return valueOf(justCode); 32 } catch (Exception e) { 33 33 } 34 34 } -
trunk/src/org/expeditee/items/Text.java
r336 r348 378 378 */ 379 379 public Point2D.Float insertChar(char ch, float mouseX, float mouseY) { 380 if (ch != '\t') 380 if (ch != '\t') /* && ch != '\n'*/ 381 381 return insertText("" + ch, mouseX, mouseY); 382 382 … … 951 951 private static final int NEARBY_GRAVITY = 2; 952 952 953 p rivatestatic final int MINIMUM_FONT_SIZE = 6;953 public static final int MINIMUM_FONT_SIZE = 6; 954 954 955 955 public void toggleFontFamily() { … … 1041 1041 return null; 1042 1042 1043 if (_text.indexOf("\n") < 0) 1044 return _text.toString(); 1045 1046 return _text.substring(0, _text.indexOf("\n")); 1043 // start at the first non-newLine char 1044 int index = 0; 1045 while (_text.charAt(index) == '\n') { 1046 index++; 1047 } 1048 1049 int nextNewLine = _text.indexOf("\n", index); 1050 1051 /* If there are no more newLines return the remaining text */ 1052 if (nextNewLine < 0) 1053 return _text.substring(index); 1054 1055 return _text.substring(index, nextNewLine); 1047 1056 } 1048 1057 … … 1150 1159 // check if the cursor is within the top, bottom and within the 1151 1160 // gravity of right 1161 int justOffset = getJustOffset(text); 1162 1152 1163 if (mouseY - textY > textOutline.getY() 1153 1164 && mouseY - textY < textOutline.getY() 1154 1165 + textOutline.getHeight() 1155 && mouseX - textX < textOutline.getWidth() + gravity 1156 + Item.MARGIN_RIGHT) 1166 && mouseX - textX - justOffset < textOutline.getWidth() 1167 + gravity + Item.MARGIN_RIGHT 1168 /* &&(justOffset == 0 || mouseX > textX + justOffset - gravity ) */) 1157 1169 return true; 1158 1170 textY += getLineDrop(text); … … 1202 1214 minX -= getLeftMargin(); 1203 1215 maxX += Item.MARGIN_RIGHT; 1216 1217 // If its justification right or center then DONT limit the width 1218 if (getJustification() != null) { 1219 maxX = Item.MARGIN_RIGHT + getWidth(); 1220 } 1204 1221 1205 1222 _poly.addPoint(minX - getGravity(), minY - getGravity()); … … 1551 1568 copy.setText(_text.toString()); 1552 1569 copy.setHidden(!isVisible()); 1553 copy.setWidth(getWidth());1570 // copy.setWidth(getWidth()); 1554 1571 return copy; 1555 1572 } … … 1580 1597 size = MINIMUM_FONT_SIZE; 1581 1598 setFont(getPaintFont().deriveFont(size)); 1599 rebuild(true); 1582 1600 invalidateAll(); 1583 1601 } -
trunk/src/org/expeditee/simple/Context.java
r130 r348 1 1 package org.expeditee.simple; 2 2 3 import java.io.BufferedOutputStream; 3 4 import java.io.BufferedReader; 4 5 import java.io.BufferedWriter; 5 6 import java.io.File; 7 import java.io.FileOutputStream; 6 8 import java.io.FileReader; 7 9 import java.io.FileWriter; 10 import java.io.OutputStream; 11 import java.io.OutputStreamWriter; 12 import java.io.Writer; 8 13 9 14 import org.expeditee.actions.Simple; … … 132 137 // Get the values to be set 133 138 File filePath = new File(primitives_.getStringValue(fileNameVar)); 139 140 // Open an Output Stream Writer to set encoding 141 OutputStream fout = new FileOutputStream(filePath); 142 Writer out = new OutputStreamWriter(fout, "UTF-8"); 134 143 BufferedWriter currentFile = new BufferedWriter( 135 new FileWriter(filePath));144 out); 136 145 137 146 pointers_.setObject(fileVar, currentFile); -
trunk/src/org/expeditee/stats/StatsLogger.java
r78 r348 1 1 package org.expeditee.stats; 2 2 3 import java.io.BufferedOutputStream; 3 4 import java.io.BufferedWriter; 4 5 import java.io.File; 6 import java.io.FileOutputStream; 5 7 import java.io.FileWriter; 6 8 import java.io.IOException; 9 import java.io.OutputStream; 10 import java.io.OutputStreamWriter; 11 import java.io.Writer; 7 12 8 13 import org.expeditee.io.Logger; … … 51 56 BufferedWriter writer = new BufferedWriter(new FileWriter( 52 57 org.expeditee.gui.FrameIO.STATISTICS_DIR + _filename, true)); 58 53 59 writer.write(SessionStats.getCurrentStats()); 54 60 writer.newLine();
Note:
See TracChangeset
for help on using the changeset viewer.