Exemplo n.º 1
0
 /** Update one attribute on the form */
 @Override
 public void update(RampMeter rm, String a) {
   if (a == null) updateConfig(rm);
   if (a == null || a.equals("name")) name_lbl.setText(rm.getName());
   if (a == null || a.equals("preset")) setPresetAction(rm);
   // FIXME: this won't update when geoLoc attributes change
   if (a == null || a.equals("geoLoc")) {
     location_lbl.setText(GeoLocHelper.getOnRampDescription(rm.getGeoLoc()));
   }
   if (a == null || a.equals("operation")) operation_lbl.setText(rm.getOperation());
   if (a == null || a.equals("rate")) {
     Integer rt = rm.getRate();
     release_lbl.setText(RampMeterHelper.formatRelease(rt));
     cycle_lbl.setText(RampMeterHelper.formatCycle(rt));
     if (rt != null) on_btn.setSelected(true);
     else off_btn.setSelected(true);
     boolean up = isUpdatePermitted(rm) && rt != null;
     shrink_btn.setEnabled(up);
     grow_btn.setEnabled(up);
   }
   if (a == null || a.equals("queue")) {
     RampMeterQueue q = RampMeterQueue.fromOrdinal(rm.getQueue());
     queue_lbl.setText(q.description);
   }
   if (a == null || a.equals("mLock")) {
     lock_cbx.setAction(null);
     lock_cbx.setSelectedIndex(getMLock(rm));
     lock_cbx.setAction(new LockMeterAction(rm, lock_cbx, isUpdatePermitted(rm)));
   }
   if (a == null || a.equals("styles")) {
     if (ItemStyle.FAILED.checkBit(rm.getStyles())) {
       operation_lbl.setForeground(Color.WHITE);
       operation_lbl.setBackground(Color.GRAY);
     } else {
       operation_lbl.setForeground(null);
       operation_lbl.setBackground(null);
     }
   }
 }
Exemplo n.º 2
0
 /** Set the camera preset action */
 private void setPresetAction(RampMeter rm) {
   CameraPreset cp = RampMeterHelper.getPreset(rm);
   preset_btn.setAction(new CameraPresetAction(session, cp));
 }