Ignore:
Timestamp:
2016-05-13T21:25:10+02:00 (9 years ago)
Author:
donvip
Message:

do not use MultiSplitLayout.parseModel so this code can be removed from JOSM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignInputDialog.java

    r30738 r32177  
    2424import java.io.IOException;
    2525import java.util.ArrayList;
     26import java.util.Arrays;
    2627import java.util.Collection;
    2728import java.util.Collections;
     
    6768import org.openstreetmap.josm.data.osm.OsmPrimitive;
    6869import org.openstreetmap.josm.gui.ExtendedDialog;
    69 import org.openstreetmap.josm.gui.widgets.MultiSplitLayout;
     70import org.openstreetmap.josm.gui.widgets.MultiSplitLayout.Divider;
     71import org.openstreetmap.josm.gui.widgets.MultiSplitLayout.Leaf;
    7072import org.openstreetmap.josm.gui.widgets.MultiSplitLayout.Node;
     73import org.openstreetmap.josm.gui.widgets.MultiSplitLayout.Split;
    7174import org.openstreetmap.josm.gui.widgets.MultiSplitPane;
    7275import org.openstreetmap.josm.plugins.roadsigns.RoadSignsPlugin.PresetMetaData;
     
    179182
    180183    private JComponent buildSignsPanel() {
    181         String layoutDef =
    182             "(COLUMN "+
    183                 "(ROW weight=0.3 (LEAF name=upperleft weight=1.0) upperright) "+
    184                 "(ROW weight=0.5 (LEAF name=middleleft weight=0.5) (LEAF name=middleright weight=0.5)) "+
    185                 "(LEAF name=bottom weight=0.2))";
    186 
    187184        FlowLayout fLayout = new FlowLayout(FlowLayout.LEFT);
    188185        fLayout.setAlignOnBaseline(true);
     
    201198            multiSplitPane.getMultiSplitLayout().setModel(model);
    202199            multiSplitPane.getMultiSplitLayout().setFloatingDividers(false);
    203         } catch (Exception ex) {
    204             Node modelRoot = MultiSplitLayout.parseModel(layoutDef);
     200        } catch (IOException ex) {
     201            // (COLUMN
     202            //    (ROW weight=0.3 (LEAF name=upperleft weight=1.0) upperright)
     203            //    (ROW weight=0.5 (LEAF name=middleleft weight=0.5) (LEAF name=middleright weight=0.5))
     204            //    (LEAF name=bottom weight=0.2))
     205
     206            Split modelRoot = new Split();
     207            modelRoot.setRowLayout(false);
     208
     209            Split row1 = new Split();
     210            row1.setWeight(0.3);
     211            Leaf upperleft = new Leaf("upperleft");
     212            upperleft.setWeight(1.0);
     213            row1.setChildren(Arrays.asList(upperleft, new Divider(), new Leaf("upperright")));
     214
     215            Split row2 = new Split();
     216            row2.setWeight(0.5);
     217            Leaf middleleft = new Leaf("middleleft");
     218            middleleft.setWeight(0.5);
     219            Leaf middleright = new Leaf("middleright");
     220            middleright.setWeight(0.5);
     221            row2.setChildren(Arrays.asList(middleleft, new Divider(), middleright));
     222
     223            Leaf bottom = new Leaf("bottom");
     224            bottom.setWeight(0.2);
     225
     226            modelRoot.setChildren(Arrays.asList(row1, new Divider(), row2, new Divider(), bottom));
     227
    205228            multiSplitPane.getMultiSplitLayout().setModel(modelRoot);
    206229        }
Note: See TracChangeset for help on using the changeset viewer.