Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameCreator.java

    r1063 r1102  
    1919package org.expeditee.gui;
    2020
    21 import java.awt.Color;
    22 import java.util.*;
     21import java.util.LinkedList;
     22import java.util.List;
    2323
    2424import org.expeditee.agents.ExistingFramesetException;
     25import org.expeditee.core.Colour;
    2526import org.expeditee.items.Item;
    2627import org.expeditee.items.Text;
    2728
    2829public class FrameCreator {
     30       
    2931        public static final int INDENT_FROM_TITLE = 20;
    3032
     
    6062
    6163        public FrameCreator(String frameTitle) {
    62                 this(DisplayIO.getCurrentFrame().getFramesetName(), DisplayIO
     64                this(DisplayController.getCurrentFrame().getFramesetName(), DisplayController
    6365                                .getCurrentFrame().getPath(), frameTitle, false, false);
    6466        }
     
    8385         * @return the newly created button.
    8486         */
    85         public static Item createButton(String text, Float x, Float y, Float right,
    86                         Float bottom) {
     87        public static Item createButton(String text, Integer x, Integer y, Integer right,
     88                        Integer bottom) {
    8789                Text button = new Text(text);
    8890
    89                 button.setBackgroundColor(Color.LIGHT_GRAY);
    90                 button.setBorderColor(Color.DARK_GRAY);
     91                button.setBackgroundColor(Colour.LIGHT_GREY);
     92                button.setBorderColor(Colour.DARK_GREY);
    9193                button.setThickness(2.0F);
    9294                if (bottom != null)
     
    99101                        button.setY(y);
    100102
    101                 button.updatePolygon();
     103                button.invalidateBounds();
    102104
    103105                return button;
    104106        }
    105107
    106         public FrameCreator(String name, String path, String frameTitle,
    107                         boolean recreate, boolean multiColumn) {
     108        public FrameCreator(String name, String path, String frameTitle, boolean recreate, boolean multiColumn)
     109        {
    108110                _multiColumn = multiColumn;
    109                 _Mnext = createButton("@Next", null, null, 10F, 15F);
     111                _Mnext = createButton("@Next", null, null, 10, 15);
    110112
    111113                _Mprev = createButton("@Previous", null, null, _Mnext.getBoundsWidth()
    112                                 + _Mnext.getAnchorRight() + 20F, 15F);
     114                                + _Mnext.getAnchorRight() + 20, 15);
    113115
    114116                _Mfirst = createButton("@First", null, null, _Mprev.getBoundsWidth()
    115                                 + _Mprev.getAnchorRight() + 20F, 15F);
     117                                + _Mprev.getAnchorRight() + 20, 15);
    116118
    117119                Frame toUse = null;
     
    180182        }
    181183
    182         private void resetGlobals(Frame toUse) {
     184        private void resetGlobals(Frame toUse)
     185        {
    183186                Text title = toUse.getTitleItem();
    184187                START_X = INDENT_FROM_TITLE + title.getX();
     
    217220                                // new frame
    218221                                if (!_multiColumn
    219                                                 || toAdd.getBoundsWidth() + _lastX > FrameGraphics
    220                                                                 .getMaxSize().width) {
     222                                                || toAdd.getBoundsWidth() + _lastX > DisplayController.getFramePaintArea().getWidth()) {
    221223                                        // Make sure text items that are created on the current
    222224                                        // frame are removed
     
    229231                        toAdd.setOffset(0, 0);
    230232                        toAdd.setID(_current.getNextItemID());
    231                         toAdd.setRightMargin(FrameGraphics.getMaxFrameSize().width, true);
     233                        toAdd.setRightMargin(DisplayController.getFramePaintArea().getWidth(), true);
    232234
    233235                        _current.addItem(toAdd);
     
    245247        }
    246248
    247         public Text addText(String toAdd, Color c, String link, String action,
     249        public Text addText(String toAdd, Colour c, String link, String action,
    248250                        boolean bSave) {
    249251                Text text = _current.createNewText(toAdd);
Note: See TracChangeset for help on using the changeset viewer.