@Override public void setValueAt(Object o, int row, int column) { OffsetBookmark info = bookmarks.get(row); switch (column) { case 1: info.layerName = o.toString(); break; case 2: info.name = o.toString(); break; case 3: info.dx = Double.parseDouble((String) o); break; case 4: info.dy = Double.parseDouble((String) o); break; default: throw new ArrayIndexOutOfBoundsException(); } }
public JComponent getOffsetMenuItem(JComponent subMenu) { JMenuItem adjustMenuItem = new JMenuItem(adjustAction); if (OffsetBookmark.allBookmarks.isEmpty() && !offsetServerSupported) return adjustMenuItem; subMenu.add(adjustMenuItem); if (offsetServerSupported) { JCheckBoxMenuItem item = new JCheckBoxMenuItem(useServerOffsetAction); if (offsetServerUsed) { item.setSelected(true); } subMenu.add(item); } subMenu.add(new JSeparator()); boolean hasBookmarks = false; int menuItemHeight = 0; for (OffsetBookmark b : OffsetBookmark.allBookmarks) { if (!b.isUsable(this)) { continue; } JCheckBoxMenuItem item = new JCheckBoxMenuItem(new ApplyOffsetAction(b)); if (b.dx == dx && b.dy == dy && !offsetServerUsed) { item.setSelected(true); } subMenu.add(item); menuItemHeight = item.getPreferredSize().height; hasBookmarks = true; } if (menuItemHeight > 0) { int scrollcount = (Toolkit.getDefaultToolkit().getScreenSize().height / menuItemHeight) - 1; if (subMenu instanceof JMenu) { MenuScroller.setScrollerFor((JMenu) subMenu, scrollcount); } else if (subMenu instanceof JPopupMenu) { MenuScroller.setScrollerFor((JPopupMenu) subMenu, scrollcount); } } return (hasBookmarks || offsetServerSupported) ? subMenu : adjustMenuItem; }
@Override public boolean ok() { layerInfo.save(); ImageryLayerInfo.instance.clear(); ImageryLayerInfo.instance.load(false); Main.main.menu.imageryMenu.refreshOffsetMenu(); OffsetBookmark.saveBookmarks(); if (!GraphicsEnvironment.isHeadless()) { DownloadDialog.getInstance().refreshTileSources(); } boolean commonRestartRequired = commonSettings.saveSettings(); boolean wmsRestartRequired = wmsSettings.saveSettings(); boolean tmsRestartRequired = tmsSettings.saveSettings(); return commonRestartRequired || wmsRestartRequired || tmsRestartRequired; }
/** Initializes imagery preferences. */ public static void initialize() { ImageryLayerInfo.instance.load(true); OffsetBookmark.loadBookmarks(); Main.main.menu.imageryMenu.refreshImageryMenu(); Main.main.menu.imageryMenu.refreshOffsetMenu(); }