Changeset 88 for trunk/src/org/expeditee/gui/Frame.java
- Timestamp:
- 06/05/08 18:59:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Frame.java
r87 r88 11 11 import java.util.Collection; 12 12 import java.util.Collections; 13 import java.util.HashMap; 13 14 import java.util.LinkedList; 14 15 import java.util.List; 16 import java.util.Map; 15 17 import java.util.Stack; 16 18 … … 46 48 private String _frameset = null; 47 49 48 private boolean _throwsException = false;49 50 50 private int _number = -1; 51 51 … … 346 346 for (Item i : items) { 347 347 if (i instanceof Text && i.getX() < UserSettings.TitlePosition 348 && i.getY() < UserSettings.TitlePosition /*&& i.getY() > 0*/) 348 && i.getY() < UserSettings.TitlePosition /* 349 * && i.getY() > 350 * 0 351 */) 349 352 return (Text) i; 350 353 } … … 1585 1588 public void setActiveTime(String activeTime) { 1586 1589 try { 1587 _activeTime = new Time(Time.valueOf(activeTime).getTime() + 12*60*60*1000); 1590 _activeTime = new Time(Time.valueOf(activeTime).getTime() + 12 * 60 1591 * 60 * 1000); 1588 1592 } catch (Exception e) { 1589 1593 _activeTime = new Time(0); … … 1593 1597 public void setDarkTime(String darkTime) { 1594 1598 try { 1595 _darkTime = new Time(Time.valueOf(darkTime).getTime() + 12*60*60*1000); 1599 _darkTime = new Time(Time.valueOf(darkTime).getTime() + 12 * 60 1600 * 60 * 1000); 1596 1601 } catch (Exception e) { 1597 1602 _darkTime = new Time(0); … … 1630 1635 public Time getCometDarkTime(boolean topFrame) { 1631 1636 Time base; 1632 if (topFrame && _frameName.Permission >= Item.PERMISSION_FULL 1637 if (topFrame && _frameName.Permission >= Item.PERMISSION_FULL) 1633 1638 base = SessionStats.getFrameDarkTime(); 1634 1639 else if (_darkTime == null) … … 1661 1666 } 1662 1667 1663 public void setThrowsException(boolean b) { 1664 _throwsException = b; 1665 } 1666 1667 public boolean getThrowsException() { 1668 return _throwsException; 1668 public void addAnnotation(Text item) { 1669 // Check if this item has already been processed 1670 String[] tokens = item.getProcessedText(); 1671 if (tokens != null) { 1672 if (tokens.length > 0) { 1673 _annotations.put(tokens[0], item); 1674 } 1675 return; 1676 } 1677 1678 String text = item.getText().trim(); 1679 assert (text.charAt(0) == '@'); 1680 // Ignore annotations with spaces after the tag symbol 1681 if (text.length() < 2 || !Character.isLetter(text.charAt(1))) { 1682 item.setProcessedText(new String[0]); 1683 return; 1684 } 1685 // The separator char must come before the first non letter otherwise we 1686 // ignore the annotation item 1687 for (int i = 2; i < text.length(); i++) { 1688 char ch = text.charAt(i); 1689 if (!Character.isLetterOrDigit(ch)) { 1690 // Must have an attribute value pair 1691 if (ch == AttributeUtils.SEPARATOR_CHAR) { 1692 //Get the attribute 1693 String attribute = text.substring(1,i).toLowerCase(); 1694 String value =""; 1695 if(text.length() >1+ i ){ 1696 value = text.substring(i + 1).trim().toLowerCase(); 1697 } 1698 item.setProcessedText(new String[]{attribute, value}); 1699 _annotations.put(attribute, item); 1700 return; 1701 } else { 1702 item.setProcessedText(new String[0]); 1703 return; 1704 } 1705 } 1706 } 1707 // If it was nothing but letters and digits save the tag 1708 String lowerCaseText = text.substring(1).toLowerCase(); 1709 item.setProcessedText(new String[]{lowerCaseText}); 1710 _annotations.put(lowerCaseText, item); 1711 } 1712 1713 public boolean hasAnnotation(String annotation) { 1714 return _annotations.containsKey(annotation.toLowerCase()); 1715 } 1716 1717 public String getAnnotationValue(String annotation) { 1718 Text text = _annotations.get(annotation.toLowerCase()); 1719 if (text == null) 1720 return null; 1721 1722 String[] tokens = text.getProcessedText(); 1723 if (tokens != null || tokens.length > 1) 1724 return tokens[1]; 1725 return null; 1726 } 1727 1728 Map<String, Text> _annotations = new HashMap<String, Text>(); 1729 1730 public void clearAnnotations() { 1731 _annotations.clear(); 1669 1732 } 1670 1733 }
Note:
See TracChangeset
for help on using the changeset viewer.