- /*
- * Copyright 1999,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- package peaklau.eaglefund;
- import javax.microedition.lcdui.ChoiceGroup;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Form;
- /**
- * FundModifyScreen class <br>
- *
- * Selecting one fund to modify its quota.<br>
- *
- * <br>
- *
- * @author peaklau <br>
- * email:<A HREF="mailto:peaklau@hotmail.com">peaklau@hotmail.com</A> <br>
- * <a href="http://www.peaklau.com/fund/english/">HomePage</a>
- * @version $Revision: 1.1 $ $Date: 2007/05/09 16:07:04 $
- */
- public class FundModifyScreen extends Form implements CommandListener {
- private Command back=new Command("返回",Command.BACK,1);
- private Command refresh=new Command("刷新数据",Command.BACK,1);
- private Command ok=new Command("选择",Command.OK,1);
- private INavigator navigator=null;
- private ChoiceGroup codeChoices=null;
- private int codeChoicesID=0;
- public FundModifyScreen(INavigator navigator){
- super("修改基金");
- this.navigator=navigator;
- codeChoices=new ChoiceGroup("选择要修改的基金",ChoiceGroup.EXCLUSIVE,DataCenter.getFunds(),null);
- codeChoicesID=append(codeChoices);
- addCommand(ok);
- addCommand(back);
- addCommand(refresh);
- setCommandListener(this);
- }
- private void refreshData(){
- if(codeChoices!=null){
- this.delete(codeChoicesID);
- }
- codeChoices=new ChoiceGroup("选择要修改的基金",ChoiceGroup.EXCLUSIVE,DataCenter.getFunds(),null);
- codeChoicesID=append(codeChoices);
- }
- public void commandAction(Command command, Displayable displayable) {
- if(command == refresh){
- refreshData();
- }else if(command == back){
- navigator.getDisplay().setCurrent(navigator.getDisplayable("mainScreen"));
- }else if(command == ok){
- for(int i=0;i<codeChoices.size();i++){
- if(codeChoices.isSelected(i)){
- String codeID=codeChoices.getString(i);
- navigator.getDisplay().setCurrent(new FundDoModifyScreen(codeID,navigator));
- navigator.getCanvas("valueScreen").refresh();
- }
- }
- }
- }
- }