Changeset 669


Ignore:
Timestamp:
01/08/14 15:15:33 (10 years ago)
Author:
jts21
Message:

generateSettingsTree() now uses FrameCreator, and also now uses a single column of settings with info alongside instead of multiple columns with tooltips.

Location:
trunk/src/org/expeditee
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Navigation.java

    r655 r669  
    7777        public static void Goto(String frameName) {
    7878                FrameUtils.DisplayFrame(frameName);
     79        }
     80       
     81        /**
     82         * Goto a frame without adding it to history
     83         */
     84        public static void GotoQuiet(String frameName) {
     85                FrameUtils.DisplayFrame(frameName, false, true);
    7986        }
    8087
  • trunk/src/org/expeditee/gui/FrameCreator.java

    r655 r669  
    77import org.expeditee.items.Text;
    88
    9 /**
    10  *  TODO: merge with @see org.expeditee.settings.Settings.generateSettingsTree
    11  */
    129public class FrameCreator {
    1310        public static final int INDENT_FROM_TITLE = 20;
     11       
     12        // offset between items
     13        private int y_offset = 2;
    1414
    1515        private int START_Y;
     
    209209                                save();
    210210
    211                         _lastY = toAdd.getY() + toAdd.getBoundsHeight();
     211                        _lastY = toAdd.getY() + toAdd.getBoundsHeight() + y_offset;
    212212                        _maxX = Math.max(toAdd.getX() + toAdd.getBoundsWidth(), _maxX);
    213213
     
    233233        public void save() {
    234234                FrameIO.ForceSaveFrame(_current);
     235        }
     236       
     237        public int getLastY() {
     238                return _lastY;
     239        }
     240       
     241        public void setLastY(int lastY) {
     242                _lastY = lastY;
     243        }
     244       
     245        public Frame getCurrentFrame() {
     246                return _current;
    235247        }
    236248
     
    267279                Item previousButton = template.copy();
    268280                previousButton.setID(current.getNextItemID());
    269                 previousButton.setLink(link);
     281                // don't store button navigation in history,
     282                // since it's annoying to have to click back through all of it to get back to the profile frame
     283                previousButton.setAction("gotoQuiet " + link);
    270284                current.addItem(previousButton);
    271285
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r664 r669  
    3939
    4040        // the maximum size that can be used to paint on
    41         private static Dimension _MaxSize = new Dimension(1000, 1000);
     41        private static Dimension _MaxSize = new Dimension(UserSettings.InitialWidth.get(), UserSettings.InitialHeight.get() - MessageBay.MESSAGE_BUFFER_HEIGHT);
    4242
    4343        // Final passes to renderering the current frame
  • trunk/src/org/expeditee/items/Text.java

    r663 r669  
    13921392        // makes items copy really slowly when there are lots of lines of text!
    13931393        // This needs to be fixed!!
    1394         private void rebuild(boolean limitWidth) {
     1394        public void rebuild(boolean limitWidth) {
    13951395                rebuild(limitWidth, true);
    13961396        }
  • trunk/src/org/expeditee/settings/Settings.java

    r666 r669  
    1010import org.expeditee.gui.DisplayIO;
    1111import org.expeditee.gui.Frame;
     12import org.expeditee.gui.FrameCreator;
    1213import org.expeditee.gui.FrameIO;
    1314import org.expeditee.gui.FrameUtils;
     
    156157         *
    157158         * Generates settings tree
    158          * TODO: merge with @see FrameCreator
    159159         *
    160160         */
    161161        private static void generateSettingsTree(String page, Text text) {
    162                 Frame frame = FrameIO.CreateFrame(text.getParentOrCurrentFrame().getFramesetName(), page, null);
    163                 text.setLink(frame.getName());
    164                
    165                 int x = 50, y = 100;
    166                 int dY = UserSettings.ItemTemplate.get().getPolygon().getBounds().height + 1;
    167                 int maxY = UserSettings.InitialHeight.get() - 150;
     162                FrameCreator frames = new FrameCreator(text.getParentOrCurrentFrame().getFramesetName(), text.getParentOrCurrentFrame().getPath(), page, false, false);
     163                // Frame frame = FrameIO.CreateFrame(text.getParentOrCurrentFrame().getFramesetName(), page, null);
     164                text.setLink(frames.getName());
    168165               
    169166                // add subpages of the current page
     
    175172                                }
    176173                                System.out.println("Generating " + name);
    177                                 generateSettingsTree(k, frame.addText(x, y, name.substring(0, 1).toUpperCase() + name.substring(1), null));
    178                                 y += dY;
    179                                 if(y >= maxY) {
    180                                         x += 300;
    181                                         y = 100;
    182                                 }
    183                         }
    184                 }
    185                
    186                 x += 200;
    187                 y = 100;
     174                                generateSettingsTree(k, frames.addText(name.substring(0, 1).toUpperCase() + name.substring(1), null, null, null, false));
     175                        }
     176                }
     177               
     178                frames.setLastY(150);
    188179               
    189180                // add settings of the current page
     
    205196                                        }
    206197                                }
     198                                Text t;
    207199                                if(key.equals("pass")) {
    208                                         Text t = frame.addText(x, y, "iw: org.expeditee.items.widgets.Password", null);
     200                                        t = frames.addText("iw: org.expeditee.items.widgets.Password", null, null, null, false);
    209201                                        Password pw = new Password(t, null);
    210202                                        pw.setPassword((String) value);
    211                                         frame.removeItem(t);
    212                                         frame.addAllItems(pw.getItems());
    213                                         y += pw.getHeight();
     203                                        frames.getCurrentFrame().removeItem(t);
     204                                        frames.getCurrentFrame().addAllItems(pw.getItems());
    214205                                } else if(s instanceof GenericSetting && ((GenericSetting) s).getType().equals(Text.class)) {
    215                                         Text t = ((GenericSetting<Text>) s).get();
     206                                        t = ((GenericSetting<Text>) s).get();
    216207                                        if(t == null) continue;
    217208                                        t = t.copy();
    218                                         int h = t.getPolygon().getBounds().height + 1;
    219                                         t.setID(frame.getNextItemID());
    220                                         t.setX(x);
    221                                         t.setY(y + h / 2);
     209                                        t.setID(frames.getCurrentFrame().getNextItemID());
    222210                                        t.setText(name);
    223                                         t.setTooltip(s.getTooltip());
    224                                         frame.addItem(t);
    225                                         y += h;
     211                                        frames.addItem(t, false);
    226212                                } else {
    227                                         Text t = frame.addText(x, y + dY / 2, name + value, null);
    228                                         t.setTooltip(s.getTooltip());
    229                                         y += dY;
    230                                 }
    231                                 if(y >= maxY) {
    232                                         x += 300;
    233                                         y = 100;
    234                                 }
    235                         }
    236                 }
    237                
    238                 FrameIO.SaveFrame(frame);
     213                                        t = frames.addText(name + value, null, null, null, false);
     214                                }
     215                                Text tt = frames.getCurrentFrame().addText(600, t.getY(), s.getTooltip(), null);
     216                                tt.setWidth(400);
     217                                // rebuild to get the correct height since setWidth() doesn't immediately rebuild
     218                                tt.rebuild(true);
     219                                if(tt.getY() + tt.getBoundsHeight() > frames.getLastY()) {
     220                                        frames.setLastY(tt.getY() + tt.getBoundsHeight());
     221                                }
     222                        }
     223                }
     224               
     225                frames.save();
     226                //FrameIO.SaveFrame(frame);
    239227        }
    240228}
Note: See TracChangeset for help on using the changeset viewer.