Beispiel #1
0
 protected boolean handleScaleSelection(Scale scale) {
   int min = scale.getMinimum();
   double portion = (scale.getSelection() - min) * 1.0d / (scale.getMaximum() - min);
   boolean selectionChanged = internalSetSelection(portion, false);
   refresh();
   return selectionChanged;
 }
  /** TODO summary sentence for apply ... */
  public void apply() {
    RasterSymbolizer symbolizer = (RasterSymbolizer) getContent();
    StyleBuilder styleBuilder = getStyleBuilder();

    double opacity = ((double) opacityScale.getSelection()) / 100;
    symbolizer.setOpacity(styleBuilder.literalExpression(opacity));
  }
  /** {@inheritDoc} */
  public Map<IPreferenceGroup, Object> eventFired() {
    Sensitivity sensitivity = Sensitivity.fromOrd(slider.getSelection());

    Map<IPreferenceGroup, Object> preferenceControlMap = new HashMap<IPreferenceGroup, Object>();
    preferenceControlMap.put(PreferenceId.SamplingRate.SLIDER_ID, sensitivity);

    // get the actual selected divider mode button and set the specific id
    if (timeframeModeButton.getSelection()) {
      preferenceControlMap.put(
          PreferenceId.SamplingRate.DIVIDER_ID, PreferenceId.SamplingRate.TIMEFRAME_DIVIDER_ID);
    }

    return preferenceControlMap;
  }
 @Override
 public void widgetSelected(SelectionEvent e) {
   if (e.getSource().equals(cmbDirectoryLocation)) {
     final String newDirectory =
         cmbDirectoryLocation.getItem(cmbDirectoryLocation.getSelectionIndex());
     if (newDirectory != null && newDirectory.length() > 0) {
       addToHistory();
       resetHistory();
       resetPlaying(true);
       spawnLoadJob(newDirectory);
       currentDir = newDirectory;
     }
   } else if (e.getSource().equals(btnHistoryBack)) {
     String newDir = history.get(historyPointer);
     btnHistoryForw.setEnabled(true);
     cmbDirectoryLocation.setText(newDir);
     resetPlaying(true);
     spawnLoadJob(newDir);
     historyPointer++;
     if (historyPointer >= history.size()) {
       btnHistoryBack.setEnabled(false);
       historyPointer = history.size() - 1;
     }
     if (firstBack) {
       addToHistory();
       firstBack = false;
       historyPointer++;
     }
   } else if (e.getSource().equals(btnHistoryForw)) {
     historyPointer--;
     String newDir = history.get(historyPointer);
     resetPlaying(true);
     spawnLoadJob(newDir);
     cmbDirectoryLocation.setText(newDir);
     btnHistoryBack.setEnabled(true);
     if (historyPointer <= 0) {
       btnHistoryForw.setEnabled(false);
       historyPointer = 1;
     }
   } else if (e.getSource().equals(btnPlay)) {
     if (btnPlay.getSelection()) {
       boolean isPaused = playback.isPaused();
       btnPlay.setImage(imgStill);
       playback.start();
       if (!isPaused) {
         playback.setSelection(getSelection());
         playback.setDelay(getPreferenceTimeDelay());
         playback.setStepping(getPreferencePlaybackRate());
         execSvc.execute(playback);
       }
     } else {
       playback.pause();
       btnPlay.setImage(imgPlay);
     }
   } else if (e.getSource().equals(btnStop)) {
     sldProgress.setSelection(0);
     curPosition = -1;
     btnPlay.setSelection(false);
     btnPlay.setImage(imgPlay);
     playback.stop();
   } else if (e.getSource().equals(btnRewind)) {
     sldProgress.setSelection(0);
     curPosition = -1;
     playback.rewind();
   } else if (e.getSource().equals(btnForward)) {
     sldProgress.setSelection(sldProgress.getMaximum());
     playback.forward();
   } else if (e.getSource().equals(sldProgress)) {
     int p = sldProgress.getSelection();
     if (p != curPosition) {
       playback.setPlayPos(p);
       curPosition = p;
     }
   } else if (e.getSource().equals(btnPlayLoop)) {
     playback.setAutoRewind(btnPlayLoop.getSelection());
   }
 }
  public void updateData() {
    if (roomC == null) return;

    SystemsMenu sysMenu = SystemsMenu.getInstance();
    sysMenu.setController(roomC);
    sysMenu.disposeSystemSubmenus();
    sysMenu.createSystemSubmenus();

    Systems sys = container.getActiveSystem(roomC.getGameObject());
    SystemController system = container.getSystemController(sys);
    ShipController shipController = container.getShipController();
    boolean playerShip = shipController.isPlayerShip();

    String alias = roomC.getAlias();
    label.setText(
        "Room " + roomC.getId() + (alias == null || alias.equals("") ? "" : " (" + alias + ")"));

    btnSystem.setText(system.toString());

    btnAvailable.setEnabled(system.getSystemId() != Systems.EMPTY);
    scaleSysLevel.setEnabled(system.getSystemId() != Systems.EMPTY);
    if (!playerShip) scaleMaxLevel.setEnabled(system.getSystemId() != Systems.EMPTY);

    if (system.getSystemId() != Systems.EMPTY) {
      // Update widgets with the system's data
      btnAvailable.setSelection(system.isAvailableAtStart());

      scaleSysLevel.setMaximum(playerShip ? system.getLevelCap() : scaleMaxLevel.getSelection());
      scaleSysLevel.setSelection(system.getLevel());
      scaleSysLevel.notifyListeners(SWT.Selection, null);

      if (!playerShip) {
        scaleMaxLevel.setMaximum(system.getLevelCap());
        scaleMaxLevel.setSelection(system.getLevelMax());
        scaleMaxLevel.notifyListeners(SWT.Selection, null);

        scaleSysLevel.setEnabled(scaleMaxLevel.getSelection() > 1);
      } else {
        btnInteriorBrowse.setEnabled(system.canContainInterior());
        btnInteriorClear.setEnabled(system.canContainInterior());
        btnInteriorView.setEnabled(system.getInteriorPath() != null);

        String temp = system.getInteriorPath();
        txtInterior.setText(temp == null ? "" : IOUtils.trimProtocol(temp));
        txtInterior.selectAll();
        txtInterior.clearSelection();

        btnGlow.setEnabled(system.canContainGlow());
        if (system.canContainGlow() && playerShip) {
          btnGlow.setText(system.getGameObject().getGlowSet().getIdentifier());
        } else {
          btnGlow.setText("None");
        }
      }
    } else {
      // No system - reset to default
      scaleSysLevel.setMaximum(2);
      scaleSysLevel.setSelection(1);
      txtSysLevel.setText("");

      if (!playerShip) {
        scaleMaxLevel.setMaximum(2);
        scaleMaxLevel.setSelection(1);
        txtMaxLevel.setText("");
      } else {
        txtInterior.setText("");
        btnGlow.setText("None");
      }
    }
    OverviewWindow.staticUpdate(roomC);
  }
 /**
  * Get the current zoom value.
  *
  * @return
  */
 public int getZoom() {
   return scale.getSelection();
 }