예제 #1
0
 @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();
   }
 }
예제 #2
0
  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;
  }
예제 #3
0
  @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;
  }
예제 #4
0
 /** Initializes imagery preferences. */
 public static void initialize() {
   ImageryLayerInfo.instance.load(true);
   OffsetBookmark.loadBookmarks();
   Main.main.menu.imageryMenu.refreshImageryMenu();
   Main.main.menu.imageryMenu.refreshOffsetMenu();
 }