第4回:実機に載せよう(ダウンサイズ)
001: //package com.s_cradle.improve.client;
002:
003: import java.io.*;
004: //import com.s_cradle.improve.Constants;
005:
006: /**
007: * Copyright (C) 2003 Sophia Cradle, Inc.
008: *
009: * オペレーション delete を使ったタスクを行うクラスです。
010: *
011: * @author Masaru Yoshimura
012: */
013: public class E/*DeleteTask*/ extends Z/*Task*/ {
014: //downsize 定数展開
015: //private static String WARNING_MESSAGE = "退会処理時通信エラー
";
016:
017: private static final String[] ITEMS = new String[]{
018: "account"/*Constants.PARAMETER_ACCOUNT*/,
"password"/*Constants.PARAMETER_PASSWORD*/};
019:
020: /**
021: * コンストラクタ。タスクで使う値(アカウントとパスワード)を引数にとる。
022: */
023: public void E/*initializeDeleteTask*/(String[] str){
024: StackMap/*initializeTask*//*super*/(1/*TASK_DELETE*/,
ITEMS, new String[]{D/*strs*/[0]/*account*/, D/*strs*/[1]/*password*/});
025: }
026:
027: /**
028: * 失敗時の処理
029: */
030: protected void Z/*processFailed*/() {
031: I/*ImproveMIDlet*/.StackMap/*listCanvas*/.I/*ticker*/.Code/*insert*/(
3/*Ticker.LEVEL_WARNING*/,"退会処理時通信エラー
"/*WARNING_MESSAGE*/);
032: }
033:
034: /**
035: * 返値を読んだ後の処理
036: */
037: protected void Code/*processAfterReturnValue*/(int result, DataInputStream input)
038: throws java.io.IOException {
039: D/*strs*/[0]/*account*/ = "";
040: D/*strs*/[1]/*password*/ = "";
041: I/*ImproveMIDlet*//*
ResourceManager*/.Code/*setAccountAndPasswordToRecordStore*/();
042: I/*ImproveMIDlet*/.I/*midlet*/.notifyDestroyed();
043: }
044:
045: //downsize クラス融合 以下TwoChoiceMenu
046:
047: private static final String[] ITEMS2 = new String[]{"はい","いいえ"};
048:
049: // 何に使われているかの定数
050: //downsize 定数展開
051: /*
052: public static final int MENU_WITHDRAW = 0;
053: public static final int MENU_QUIT = 1;
054: public static final int MENU_REMOVEBUDDY = 2;
055: public static final int MENU_PHONE = 3;
056:
057: private static final int YES = 0;
058: private static final int NO = 1;
059: */
060:
061: private int いいえ/*mode*/;
062: private A/*Buddy*/ はい/*buddy*/;
063:
064: /**
065: * コンストラクタ
066: */
067: public void E/*initializeTwoChoiceMenu*/(String title, int mode_) {
068: //super(title, ITEMS, true);
069: E/*initializeMenu*/(title,ITEMS2,true);
070: いいえ/*mode*/ = mode_;
071: }
072:
073: /**
074: * コンストラクタ
075: */
076: public void E/*initializeTwoChoiceMenu*/(
String title, int mode_, A/*Buddy*/ buddy_) {
077: E/*initializeTwoChoiceMenu*//*this*/(title, mode_);
078: はい/*buddy*/ = buddy_;
079: }
080:
081: /**
082: * キーハンドラ
083: */
084: public Z/*Task*//*Menu*/ StackMap/*processFireKeyRelease*/(){
085: switch( いいえ/*mode*/ ){
086: case 0/*MENU_WITHDRAW*/:
087: if( Z/*idata*/[0]/*cursor*/ == 0/*YES*/ ){
088: Z/*getTask*/(
1/*Task.TASK_DELETE*/,new String[0]).StackMap/*schedule*/(0);
089: }
090: break;
091: case 1/*MENU_QUIT*/:
092: if( Z/*idata*/[0]/*cursor*/ == 0/*YES*/ ){
093: Z/*getTask*/(4/*Task.TASK_SET*/,new String[]{
094: String.valueOf(4/*Constants.ITEM_INDEX_STATUS*/),
095: String.valueOf(0/*Constants.STATUS_LOGOFF*/)})
096: .StackMap/*schedule*/(0);
097: }
098: break;
099: case 2/*MENU_REMOVEBUDDY*/:
100: if( Z/*idata*/[0]/*cursor*/ == 0/*YES*/ ){
101: //downsize 即値の利用
102: Z/*getTask*/(3/*Task.TASK_REMOVE*/,
103: new String[]{はい/*buddy*/.StackMap/*
etc*/[0]/*account*/}).StackMap/*schedule*/(0);
104: }
105: break;
106: case 3/*MENU_PHONE*/:
107: if( Z/*idata*/[0]/*cursor*/ == 0/*YES*/ ){
108: //電話処理
109: }
110: break;
111: default:
112: break;
113: }
114:
115: return null;
116: }
117: }