Package net.sf.mvc.mobile

Examples of net.sf.mvc.mobile.Navigation


  private Alert view;
 
  public void load(Object parameter) throws Exception {
    Object[] params = (Object[]) parameter;
    Observation existing = (Observation) params[0];   
    Navigation onYes = (Navigation) params[1];
    Navigation onNo = (Navigation) params[2];
 
    view.setString("${overwrite.existing}\n"+existing);
    view.setTimeout(Alert.FOREVER);
    view.removeCommand(yesCommand);
    view.removeCommand(noCommand);
View Full Code Here


    this.view = (EnterNameView) v;
   
    
    view.addCommand(new ActionCommand("Say hello",Command.SCREEN, 1){
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("say-hello",view.getName());
      }     
    });
    /* Please note that the command above can't be writter as
     *     view.addCommand(new NavigationCommand(
     *       new Navigation("say-hello",  view.getName()), "Say hello", Command.SCREEN, 1));
     * because view.getName() has to be evaluated each time the command is executed
     */
   
    view.addCommand(new ActionCommand("Quit",Command.SCREEN, 9){
      public Navigation execute(Displayable d) throws Exception {
        controler.getMidlet().notifyDestroyed();
        return null;
      }     
    });
    view.addCommand(new NavigationCommand(new Navigation("say-hello", null),
        "Slow load", Command.SCREEN, 2));
    view.addCommand(new ActionCommand("Slow action", Command.SCREEN, 3){
      public Navigation execute(Displayable d) throws Exception {
        String name = view.getName();
        controler.progressListner.setMaxValue(name.length());
        for(int i=0;i<name.length();++i) {
          //slow operation:
          Thread.sleep(100);
          controler.progressListner.setValue(i);
        }
        return new Navigation("say-hello", name);
      }     
    });
  }
View Full Code Here

    this.view = (SayHelloView) v;
   
    view.addCommand(new ActionCommand("Edit", Command.ITEM, 1) {
      public Navigation execute(Displayable d) throws Exception {
        System.out.println(".execute(), name="+name);
        return new Navigation("enter-name", "Edit your name", name);
      }     
    });
    view.addCommand(new NavigationCommand(
        new Navigation("enter-name", "Enter your new name", ""), "New name", Command.ITEM, 1));
  }
View Full Code Here

  public NavigationCommand(Navigation navigation, String label, int type, int priority) {
    super(label, type, priority);
    this.navigation = navigation;
  }
  public NavigationCommand(String navi, String label, int type, int priority) {
    this(new Navigation(navi, null), label, type, priority);
  }
View Full Code Here

  public void setView(Displayable v) {
    this.view = (MucusEditorView) v;
    view.addCommand(new ActionCommand("${ok}", Command.SCREEN, 1) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("mucus-editor", view.getMucus());
      }     
    });
    view.addCommand(new NavigationCommand("mucus-editor","${back}",Command.BACK,2));
  }
View Full Code Here

    this.list = (List) v;
    list.addCommand(new ActionCommand("${edit}", Command.ITEM, 1) {
      public Navigation execute(Displayable d) throws Exception {
        Mucus mucus = (Mucus) registry.elementAt(list
            .getSelectedIndex());
        return new Navigation("edit-mucus", mucus);
      }
    });
    list.addCommand(new ActionCommand("${add}", Command.SCREEN, 2) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("edit-mucus", new Mucus());
      }
    });
    list.addCommand(new ActionCommand("${remove}", Command.ITEM, 3) {
      public Navigation execute(Displayable d) throws Exception {
        Mucus mucus = (Mucus) registry.elementAt(list
            .getSelectedIndex());
        rms.deleteRecord(mucus.getId());
        refresh();
        return null;
      }
    });
    list.addCommand(new ActionCommand("${default}", Command.ITEM, 3) {
      public Navigation execute(Displayable d) throws Exception {
        rms.closeRecordStore();
        MucusRegistry.close();
        RecordStore.deleteRecordStore(MucusRegistry.MUCUS_REGISTRY);
        rms = RecordStore.openRecordStore(MucusRegistry.MUCUS_REGISTRY,
            true);
        saveDefaults();
        refresh();
        return null;
      }
    });
    list.addCommand(new ActionCommand("${back}", Command.BACK, 10) {
      public Navigation execute(Displayable d) throws Exception {
        MucusRegistry.close();
        return new Navigation("input", null);
      }
    });
  }
View Full Code Here

              MucusRegistry.instance().find(i % 3 + 1),
              false, random.nextInt() % 10 == 0, "");
          LogicDAO.addObservationToPeriod(o, new Period[]{period}, controler);
          controler.progressListner.setValue(i);
        }
        return new Navigation("graph", period, o);
      }
    });   
    view.addCommand(new ActionCommand("D:reset rms", Command.SCREEN, 102){
      public Navigation execute(Displayable d) throws Exception {
        controler.getPeriodDAO().deleteAll();
        controler.getObservationDAO().deleteAll();
        return new Navigation("quit",null);
      }     
    });
    //#endif
  }
View Full Code Here

    selectCommand = new ActionCommand("${select}", Command.SCREEN, 1) {
      public Navigation execute(Displayable d) throws Exception {
        GraphView view = (GraphView) d;
        Observation observation = view.getSelectedObservation();
        return new Navigation("input", period, observation);
      }
    };
    view.addCommand(selectCommand);
    view.addCommand(new ActionCommand("${enter.new}", Command.SCREEN, 2) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("input", period, new Observation());
      }
    });
    view.addCommand(new ActionCommand("${history}", Command.SCREEN, 5) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("history", period);
      }
    });
    view.addCommand(new ActionCommand("${delete}", Command.SCREEN, 3){
      public Navigation execute(Displayable d) throws Exception {
        Observation observation = view.getSelectedObservation();
        if(observation != null) {
          LogicDAO.removeObservation(controler, observation, period);
          return new Navigation("graph", period, observation);
        }else return null;
      }
    });
    view.setKeyListener(this);
    view.setExceptionListener(controler);
View Full Code Here

    super.setView(view);   
    Log.log("InputModel.setView("+view+") 2");
    this.view = (InputView) view;
    view.addCommand(new ActionCommand("${graph}", Command.SCREEN, 2) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("graph", period, null);
      }
    });
    view.addCommand(new ActionCommand("${save}", Command.BACK, 1) {
      public Navigation execute(Displayable d) throws Exception {
        InputView form = (InputView) d;
        Observation observation = form.getObservation();
        Observation existing = getObservationAt(observation.getDate());
        if (existing != null) {
          return new Navigation("confirm-overwrite", existing,
              new Navigation("save-observation", period, observation),
              new Navigation("graph", period, existing));
        }
        return new Navigation("save-observation", period, observation);
      }
    });
    view.addCommand(new NavigationCommand("mucus-editor","${mucus.editor}",Command.SCREEN, 50));
  }
View Full Code Here

      msg.append("\n${new.period.started}");
      view.setTicker(new Ticker("${new.period.started}"));
    }
    view.setString(msg.toString());
    view.removeCommand(okCommand);
    Navigation navigation = new Navigation("graph", period, observation);
    okCommand = new NavigationCommand(navigation, "${OK}", Command.OK, 1);
    view.addCommand(okCommand);
  }
View Full Code Here

TOP

Related Classes of net.sf.mvc.mobile.Navigation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.