Ignore:
Timestamp:
09/02/14 18:08:55 (10 years ago)
Author:
jts21
Message:

Improved ItemUtils.Justify (now justifies against Frame edge too)

File:
1 edited

Legend:

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

    r920 r922  
    10341034        }
    10351035       
     1036        /**
     1037         * Wraps any text items to the size of their container, or the frame size if they have not container
     1038         *
     1039         * @param items A list of Items to wrap (non-Text items are ignored)
     1040         */
    10361041        public static void Justify(Collection<Item> items) {
    10371042                for (Item i : items) {
    10381043                        if (i instanceof Text) {
    10391044                                Collection<Item> enclosure = FrameUtils.getEnclosingLineEnds(i.getPosition());
    1040                                 if (enclosure != null) {
    1041                                         ((Text)i).justify(false, enclosure.iterator().next().getEnclosedShape());
    1042                                 }
     1045                                ((Text)i).justify(false, enclosure != null ? enclosure.iterator().next().getEnclosedShape() : null);
    10431046                        }
    10441047                }
    10451048        }
    10461049       
     1050        /**
     1051         * Recalculates containers on the frame, then wraps all text items
     1052         *
     1053         * @param frame
     1054         */
    10471055        public static void Justify(Frame frame) {
    10481056                EnclosedCheck(frame.getItems());
Note: See TracChangeset for help on using the changeset viewer.