コード例 #1
0
ファイル: PTScheduler.java プロジェクト: remfalc/PonySDK
 @Override
 public void update(final PTInstruction update, final UIService uiService) {
   final long commandID = update.getLong(PROPERTY.COMMAND_ID);
   if (update.containsKey(PROPERTY.STOP)) {
     // Stop the command
     commandByIDs.remove(commandID).cancel();
   } else if (update.containsKey(PROPERTY.FIXDELAY)) {
     // Fix-delay
     // Wait for execution terminated before scheduling again
     final SchedulerCommand previousCmd = commandByIDs.remove(commandID);
     if (previousCmd != null) previousCmd.cancel();
     final int delay = update.getInt(PROPERTY.FIXDELAY);
     final FixDelayCommand command =
         new FixDelayCommand(uiService, update.getObjectID(), commandID, delay);
     Scheduler.get().scheduleFixedDelay(command, delay);
     commandByIDs.put(commandID, command);
   } else if (update.containsKey(PROPERTY.FIXRATE)) {
     // Fix-rate
     final SchedulerCommand previousCmd = commandByIDs.remove(commandID);
     if (previousCmd != null) previousCmd.cancel();
     final int delay = update.getInt(PROPERTY.FIXRATE);
     final FixRateCommand command =
         new FixRateCommand(uiService, update.getObjectID(), commandID, delay);
     Scheduler.get().scheduleFixedDelay(command, delay);
     commandByIDs.put(commandID, command);
   }
 }
コード例 #2
0
ファイル: PTDateBox.java プロジェクト: ghanquez/PonySDK
  @Override
  public void create(final PTInstruction create, final UIService uiService) {

    final PTDatePicker datePicker =
        (PTDatePicker) uiService.getPTObject(create.getLong(PROPERTY.PICKER));

    init(create, uiService, new MyDateBox(datePicker.cast(), null, DEFAULT_FORMAT));
  }