Changeset 12125 in josm
- Timestamp:
- 2017-05-12T01:28:59+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12119 r12125 65 65 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 66 66 import org.openstreetmap.josm.data.validation.OsmValidator; 67 import org.openstreetmap.josm.gui.MainFrame;68 67 import org.openstreetmap.josm.gui.MainMenu; 69 68 import org.openstreetmap.josm.gui.MainPanel; … … 198 197 199 198 /** 199 * The main panel. 200 * @since 12125 201 */ 202 public MainPanel panel; 203 204 /** 200 205 * The file watcher service. 201 206 */ … … 213 218 @Deprecated 214 219 public static int logLevel = 3; 215 216 /**217 * The real main panel. This field may be removed any time and made private to {@link MainFrame}218 * @see #panel219 */220 protected static final MainPanel mainPanel = new MainPanel(getLayerManager());221 220 222 221 /** … … 491 490 protected Main() { 492 491 setInstance(this); 493 mainPanel.addMapFrameListener((o, n) -> redoUndoListener.commandChanged(0, 0));494 492 } 495 493 … … 579 577 /** 580 578 * Called once at startup to initialize the main window content. 581 * Should set {@link #menu} 579 * Should set {@link #menu} and {@link #panel} 582 580 */ 583 581 protected abstract void initializeMainWindow(); … … 716 714 717 715 /** 718 * Global panel. 719 */ 720 public static final JPanel panel = mainPanel; 721 722 private final CommandQueueListener redoUndoListener = (queueSize, redoSize) -> { 716 * Listener that sets the enabled state of undo/redo menu entries. 717 */ 718 protected final CommandQueueListener redoUndoListener = (queueSize, redoSize) -> { 723 719 menu.undo.setEnabled(queueSize > 0); 724 720 menu.redo.setEnabled(redoSize > 0); … … 770 766 toolbar = new ToolbarPreferences(); 771 767 contentPanePrivate.updateUI(); 772 panel.updateUI();773 768 774 769 UIManager.put("OptionPane.okIcon", ImageProvider.get("ok")); … … 1158 1153 */ 1159 1154 public static boolean addAndFireMapFrameListener(MapFrameListener listener) { 1160 return main Panel.addAndFireMapFrameListener(listener);1155 return main.panel.addAndFireMapFrameListener(listener); 1161 1156 } 1162 1157 … … 1169 1164 */ 1170 1165 public static boolean addMapFrameListener(MapFrameListener listener) { 1171 return main Panel.addMapFrameListener(listener);1166 return main.panel.addMapFrameListener(listener); 1172 1167 } 1173 1168 … … 1179 1174 */ 1180 1175 public static boolean removeMapFrameListener(MapFrameListener listener) { 1181 return main Panel.removeMapFrameListener(listener);1176 return main.panel.removeMapFrameListener(listener); 1182 1177 } 1183 1178 -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r11654 r12125 198 198 JMenu subMenu = Main.main.menu.imagerySubMenu; 199 199 int heightUnrolled = 30*(getItemCount()+subMenu.getItemCount()); 200 if (heightUnrolled < Main. panel.getHeight()) {200 if (heightUnrolled < Main.main.panel.getHeight()) { 201 201 // add all items of submenu if they will fit on screen 202 202 int n = subMenu.getItemCount(); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r11925 r12125 88 88 private static final List<String> COMMAND_LINE_ARGS = new ArrayList<>(); 89 89 90 private MainFrame mainFrame;90 private final MainFrame mainFrame; 91 91 92 92 /** … … 109 109 @Override 110 110 protected void initializeMainWindow() { 111 mainPanel.reAddListeners();112 111 if (mainFrame != null) { 112 mainFrame.preInitialize(); 113 panel = mainFrame.getPanel(); 113 114 mainFrame.initialize(); 114 115 115 menu = mainFrame.getMenu(); 116 116 } else { 117 117 // required for running some tests. 118 panel = new MainPanel(Main.getLayerManager()); 118 119 menu = new MainMenu(); 119 120 } 121 panel.addMapFrameListener((o, n) -> redoUndoListener.commandChanged(0, 0)); 122 panel.reAddListeners(); 120 123 } 121 124 -
trunk/src/org/openstreetmap/josm/gui/MainFrame.java
r11905 r12125 49 49 protected transient WindowGeometry geometry; 50 50 protected int windowState = JFrame.NORMAL; 51 private MainPanel panel; 51 52 private MainMenu menu; 52 53 … … 71 72 72 73 /** 74 * Performs pre-initialization required before the call to {@link #initialize()}. 75 * @since 12125 76 */ 77 public void preInitialize() { 78 panel = new MainPanel(Main.getLayerManager()); 79 } 80 81 /** 73 82 * Initializes the content of the window and get the current status panel. 83 * {@link #preInitialize()} must have been previously called. 74 84 */ 75 85 public void initialize() { … … 98 108 refreshTitle(); 99 109 100 getContentPane().add( Main.panel, BorderLayout.CENTER);110 getContentPane().add(panel, BorderLayout.CENTER); 101 111 menu.initialize(); 102 112 } … … 115 125 * Gets the main menu used for this window. 116 126 * @return The main menu. 127 * @throws IllegalStateException if the main frame has not been initialized yet 128 * @see #initialize 117 129 */ 118 130 public MainMenu getMenu() { … … 121 133 } 122 134 return menu; 135 } 136 137 /** 138 * Gets the main panel. 139 * @return The main panel. 140 * @throws IllegalStateException if the main frame has not been initialized yet 141 * @see #initialize 142 * @since 12125 143 */ 144 public MainPanel getPanel() { 145 if (panel == null) { 146 throw new IllegalStateException("Not initialized."); 147 } 148 return panel; 123 149 } 124 150 -
trunk/src/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandler.java
r11746 r12125 71 71 */ 72 72 public void pasteOn(OsmDataLayer editLayer, EastNorth mPosition, Transferable transferable) { 73 importData(new TransferSupport(Main. panel, transferable), editLayer, mPosition);73 importData(new TransferSupport(Main.main.panel, transferable), editLayer, mPosition); 74 74 } 75 75 … … 80 80 public void pasteTags(Collection<? extends OsmPrimitive> primitives) { 81 81 Transferable transferable = ClipboardUtils.getClipboardContent(); 82 importTags(new TransferSupport(Main. panel, transferable), primitives);82 importTags(new TransferSupport(Main.main.panel, transferable), primitives); 83 83 } 84 84 -
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r12070 r12125 152 152 new MainApplication().initialize(); 153 153 } else { 154 Main.main Panel.reAddListeners();154 Main.main.panel.reAddListeners(); 155 155 } 156 156 // Add a test layer to the layer manager to get the MapFrame -
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r12011 r12125 46 46 @Rule 47 47 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 48 public JOSMTestRules test = new JOSMTestRules().platform().devAPI() ;48 public JOSMTestRules test = new JOSMTestRules().platform().devAPI().commands(); 49 49 50 50 /**
Note:
See TracChangeset
for help on using the changeset viewer.