Ignore:
Timestamp:
08/21/08 08:27:16 (16 years ago)
Author:
bjn8
Message:

Added absolute frame getter for iwidgets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/InteractiveWidget.java

    r237 r239  
    2323import org.expeditee.gui.Frame;
    2424import org.expeditee.gui.FrameGraphics;
     25import org.expeditee.gui.FrameIO;
    2526import org.expeditee.gui.FreeItems;
    2627import org.expeditee.gui.MouseEventRouter;
     
    15291530                return _textRepresentation.getLink();
    15301531        }
     1532       
     1533
     1534        /**
     1535         * <b>Note:</b> That if the widget has no parent (e.g. the widget is a free-item) then
     1536         * the absolute link returned will be for the frameset of the current frame.
     1537         *
     1538         * @return
     1539         *              The absolute link for this item. Null if there is no link, or if
     1540         *              there is no parent for this widget and the current frame is unavailable.
     1541         *
     1542         */
     1543        public String getAbsoluteLink() {
     1544               
     1545                // Note:  cannot return the source absolute link since it does not have
     1546                // a parent ... thus must manually format link
     1547               
     1548                String link = getLink();
     1549               
     1550                if (link == null || link.length() == 0) return null;
     1551               
     1552                if (FrameIO.isPositiveInteger(link)) { // relative - convert to absolute
     1553                       
     1554                        // Get the frameset of this item
     1555                        Frame parent = getParentFrame();
     1556                        if (parent == null) parent = DisplayIO.getCurrentFrame();
     1557                        if (parent == null) return null;
     1558                       
     1559                        String framesetName = parent.getFramesetName();
     1560                       
     1561                        if (framesetName == null) return null;
     1562                       
     1563                        return framesetName + link;
     1564                       
     1565                } else if (FrameIO.isValidFrameName(link)) { // already absolute
     1566                        return link;
     1567                }
     1568               
     1569                return null;
     1570        }
    15311571
    15321572        public void setColor(Color c) {
Note: See TracChangeset for help on using the changeset viewer.