Package net.sf.nfp.mini.model

Source Code of net.sf.nfp.mini.model.ConfirmOverwriteModel

package net.sf.nfp.mini.model;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

import net.sf.mvc.mobile.Model;
import net.sf.mvc.mobile.Navigation;
import net.sf.mvc.mobile.command.NavigationCommand;
import net.sf.nfp.mini.data.Observation;

public class ConfirmOverwriteModel implements Model{
  private NavigationCommand yesCommand = null;
  private NavigationCommand noCommand = null;
  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);
    yesCommand = new NavigationCommand(onYes, "${yes}", Command.OK, 1);
    noCommand = new NavigationCommand(onNo, "${no}", Command.BACK, 2);
    view.addCommand(yesCommand);
    view.addCommand(noCommand);
  }
 
  public void setView(Displayable v) {
    view = (Alert) v;
    view.setType(AlertType.CONFIRMATION);
  }
}
TOP

Related Classes of net.sf.nfp.mini.model.ConfirmOverwriteModel

TOP
Copyright © 2018 www.massapi.com. 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.