Changeset 7075 in josm
- Timestamp:
- 2014-05-08T02:40:40+02:00 (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r6935 r7075 7 7 import java.awt.BorderLayout; 8 8 import java.awt.EventQueue; 9 import java.awt.GraphicsEnvironment; 9 10 import java.awt.event.InputEvent; 10 11 import java.awt.event.KeyEvent; … … 126 127 getMOTD(); 127 128 128 new FileDrop(scroller); 129 if (!GraphicsEnvironment.isHeadless()) { 130 new FileDrop(scroller); 131 } 129 132 } 130 133 -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r7005 r7075 6 6 7 7 import java.awt.Component; 8 import java.awt.GraphicsEnvironment; 8 9 import java.awt.MenuComponent; 9 10 import java.awt.Toolkit; … … 104 105 MainMenu.add(subMenu, rectaction); 105 106 } 106 107 107 108 private void setupMenuScroller() { 108 int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; 109 int menuItemHeight = singleOffset.getPreferredSize().height; 110 MenuScroller.setScrollerFor(this, (screenHeight / menuItemHeight)-1); 109 if (!GraphicsEnvironment.isHeadless()) { 110 int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; 111 int menuItemHeight = singleOffset.getPreferredSize().height; 112 MenuScroller.setScrollerFor(this, (screenHeight / menuItemHeight)-1); 113 } 111 114 } 112 115 … … 234 237 235 238 /** 236 * Collection to store temporary menu items. They will be deleted 239 * Collection to store temporary menu items. They will be deleted 237 240 * (and possibly recreated) when refreshImageryMenu() is called. 238 241 * @since 5803 239 242 */ 240 243 private List <Object> dynamicItems = new ArrayList<>(20); 241 244 242 245 /** 243 246 * Remove all the items in @field dynamicItems collection … … 264 267 add(s); 265 268 } 266 269 267 270 private void addDynamic(Action a) { 268 271 dynamicItems.add( this.add(a) ); 269 272 } 270 273 271 274 private void addDynamic(JMenuItem it) { 272 275 dynamicItems.add( this.add(it) ); -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r7026 r7075 7 7 8 8 import java.awt.Component; 9 import java.awt.GraphicsEnvironment; 9 10 import java.awt.Toolkit; 10 11 import java.awt.event.KeyEvent; … … 567 568 public JMenu addMenu(String name, int mnemonicKey, int position, String relativeHelpTopic) { 568 569 final JMenu menu = new JMenu(tr(name)); 569 int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; 570 int menuItemHeight = new JMenu().add(newAction).getPreferredSize().height; 571 MenuScroller.setScrollerFor(menu, screenHeight / menuItemHeight); 570 if (!GraphicsEnvironment.isHeadless()) { 571 int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; 572 int menuItemHeight = new JMenu().add(newAction).getPreferredSize().height; 573 MenuScroller.setScrollerFor(menu, screenHeight / menuItemHeight); 574 } 572 575 return addMenu(menu, name, mnemonicKey, position, relativeHelpTopic); 573 576 } -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r7005 r7075 9 9 import java.awt.Dimension; 10 10 import java.awt.Font; 11 import java.awt.GraphicsEnvironment; 11 12 import java.awt.GridBagLayout; 12 13 import java.awt.Rectangle; … … 53 54 import org.openstreetmap.josm.actions.mapmode.ZoomAction; 54 55 import org.openstreetmap.josm.data.Preferences; 55 import org.openstreetmap.josm.data.ViewportData;56 56 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 57 57 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 58 import org.openstreetmap.josm.data.ViewportData; 58 59 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 59 60 import org.openstreetmap.josm.gui.dialogs.ChangesetDialog; … … 161 162 162 163 mapView = new MapView(contentPane, viewportData); 163 new FileDrop(mapView); 164 if (!GraphicsEnvironment.isHeadless()) { 165 new FileDrop(mapView); 166 } 164 167 165 168 splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); … … 599 602 600 603 /** 601 * Remove panel from top of MapView by class 604 * Remove panel from top of MapView by class 602 605 */ 603 606 public void removeTopPanel(Class<?> type) { -
trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java
r7067 r7075 2 2 package org.openstreetmap.josm.io.auth; 3 3 4 import java.awt.GraphicsEnvironment; 4 5 import java.net.Authenticator.RequestorType; 5 6 import java.net.PasswordAuthentication; … … 44 45 */ 45 46 } else if (noSuccessWithLastResponse || username.isEmpty() || password.isEmpty()) { 46 GuiHelper.runInEDTAndWait(new Runnable() { 47 @Override 48 public void run() { 49 CredentialDialog dialog = null; 50 if (requestorType.equals(RequestorType.PROXY)) 51 dialog = CredentialDialog.getHttpProxyCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); 52 else 53 dialog = CredentialDialog.getOsmApiCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); 54 dialog.setVisible(true); 55 response.setCanceled(dialog.isCanceled()); 56 if (dialog.isCanceled()) 57 return; 58 response.setUsername(dialog.getUsername()); 59 response.setPassword(dialog.getPassword()); 60 response.setSaveCredentials(dialog.isSaveCredentials()); 61 } 62 }); 47 if (!GraphicsEnvironment.isHeadless()) { 48 GuiHelper.runInEDTAndWait(new Runnable() { 49 @Override 50 public void run() { 51 CredentialDialog dialog = null; 52 if (requestorType.equals(RequestorType.PROXY)) 53 dialog = CredentialDialog.getHttpProxyCredentialDialog( 54 username, password, host, getSaveUsernameAndPasswordCheckboxText()); 55 else 56 dialog = CredentialDialog.getOsmApiCredentialDialog( 57 username, password, host, getSaveUsernameAndPasswordCheckboxText()); 58 dialog.setVisible(true); 59 response.setCanceled(dialog.isCanceled()); 60 if (dialog.isCanceled()) 61 return; 62 response.setUsername(dialog.getUsername()); 63 response.setPassword(dialog.getPassword()); 64 response.setSaveCredentials(dialog.isSaveCredentials()); 65 } 66 }); 67 } 63 68 if (response.isCanceled() || response.getUsername() == null || response.getPassword() == null) { 64 69 return response; -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7033 r7075 8 8 import java.awt.Graphics; 9 9 import java.awt.Graphics2D; 10 import java.awt.GraphicsConfiguration;11 10 import java.awt.GraphicsEnvironment; 12 11 import java.awt.Image; … … 14 13 import java.awt.RenderingHints; 15 14 import java.awt.Toolkit; 16 import java.awt.Transparency;17 15 import java.awt.image.BufferedImage; 18 16 import java.io.ByteArrayInputStream; … … 793 791 img = overlay(img, ImageProvider.get("cursor/modifier/" + overlay), OverlayPosition.SOUTHEAST); 794 792 } 793 if (GraphicsEnvironment.isHeadless()) { 794 Main.warn("Cursors are not available in headless mode. Returning null for '"+name+"'"); 795 return null; 796 } 795 797 return Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(), 796 798 "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2), "Cursor"); … … 808 810 */ 809 811 public static ImageIcon overlay(Icon ground, Icon overlay, OverlayPosition pos) { 810 GraphicsConfiguration conf = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()811 .getDefaultConfiguration();812 812 int w = ground.getIconWidth(); 813 813 int h = ground.getIconHeight(); 814 814 int wo = overlay.getIconWidth(); 815 815 int ho = overlay.getIconHeight(); 816 BufferedImage img = conf.createCompatibleImage(w, h, Transparency.TRANSLUCENT);816 BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); 817 817 Graphics g = img.createGraphics(); 818 818 ground.paintIcon(null, g, 0, 0); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r7037 r7075 99 99 @Override 100 100 public boolean canFullscreen() { 101 return GraphicsEnvironment.getLocalGraphicsEnvironment() 101 return !GraphicsEnvironment.isHeadless() && 102 GraphicsEnvironment.getLocalGraphicsEnvironment() 102 103 .getDefaultScreenDevice().isFullScreenSupported(); 103 104 } … … 328 329 } 329 330 330 // Method kept because strings have already been translated. To enable for Java 8 migration somewhere in 2016 331 // Method kept because strings have already been translated. To enable for Java 8 migration somewhere in 2016 331 332 protected void askUpdateJava(final String version, final String url) { 332 333 GuiHelper.runInEDTAndWait(new Runnable() { -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
r7070 r7075 4 4 import java.io.File; 5 5 import java.io.IOException; 6 import java.util.Collection;7 6 import java.util.Collections; 8 7 import java.util.HashMap; … … 19 18 import org.openstreetmap.josm.gui.layer.Layer; 20 19 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 20 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; 21 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 21 22 import org.openstreetmap.josm.tools.MultiMap; 22 23 … … 75 76 Main.initApplicationPreferences(); 76 77 Main.determinePlatformHook(); 77 Main.preConstructorInit(new HashMap<MainApplication.Option, Collection<String>>()); 78 ProjectionPreference.setProjection(); 79 Main.toolbar = new ToolbarPreferences(); 78 80 new MainApplication(); 79 81 Main.main.createMapFrame(null, null);
Note:
See TracChangeset
for help on using the changeset viewer.