127
DAFTAR PUSTAKA
Marimin. 1992. Pengenalan Sistem Pakar. Jakarta: Elex Media Komputindo.
Kusumadewi, Sri. 2003. Artificial Intelligence (Teknik dan Aplikasinya). Graha Ilmu, Yogyakarta, 2003.
Hart, Anna.2005. Sistem Pakar: Sebuah Perkenalan untuk Manajer, PT. Elex Media Komputindo, Jakarta.
Ir. Siswanto, 2005, Kecerdasan Tiruan, Cetakan Pertama, Edisi Kedua. Yogyakarta : Graha Ilmu.
Afriz, 2009, Kelebihan dan Kekurangan Java,
, Desember 2012
Febri, 2011, Teknologi WAP GPRS,
, Desember 2012
128
1. Lampiran Pohon Keputusan
KERUSAKAN PADA MOTOR HONDA BEAT
A010
A010 A020
: Jika Mesin Dalam Keadaan Hidup : Jika Mesin Dalam Keadaan Mati
A020
129
A010
B010
C010
B020
B030
B040
B050
B060
C020
C030
C040
C050
C060
C070
D010
D020
D030
D040
D050
D060
D070
D080
E010
E020
E030
E040
E050
E060
E070
E080
K010
K020
K030
k040
K050
K060
K070
K080
A010 B010 B020 B030 B040 B050 B060 C010 C020 C030 C040 C050 C060 C070 D010 D020 D030 D040 D050 D060 D070 D080 E010 E020 E030 E040 E050 E060
: : : : : : : : : : : : : : : : : : : : : : : : : : : :
Jika Mesin Motor Hidup Busi pada 3000 km per 3 bulan pada 1000 km 1 bulan pertama bensin terasa boros Terasa oleng pada bagian depan Lampu Sen Bagus Starter Bagus Busi Ganti setiap 9000 km per 9 bulan Tempatkan sepeda motor pada standar tengah Stel jarak main brake lever Pengapian bagus Ukuran angin pada ban cukup kabel sen bagus aki bagus Busi terdapat endapan karbon Kondisi elektroda sudah aus Cek rantai Brake pad dapat dilihat dari garis batas pada brake pad Motor terasa tidak nyaman Velg tidak oleng Battery bagus Kabel klakson bagus Busi penuh dengan endapan karbon Kondisi eletroda sudah terbakar Suara rantai kasar suara kasar dari piringan disk cakram buangan gas pada knalpot tidak pas Klaher roda goyang
130
E070 E080 K010 K020 K030 K040 K050 K060 K070 K080
: : : : : : : : : :
Lampu sen tidak nyala Klakson tidak nyala Busi kotor Busi rusak Rantai kendor Brake pad aus Setelan karburator tidak pas Klaher roda aus Saklar sen korslet Saklar klakson rusak
B070
C080
D090
E090
K090
B070 C080 D090 D100 E090 E100 E110 E120 E130 K090 K100 K110 K120 K130
: : : : : : : : :
D100
E100
E110
E120
E130
K100
K110
K120
K130
Ketebalan permukaan valve berkurang Letakkan dial gauge dengan sudut yang tepat pada valve head Ukur penyimpangan radial valve head Periksa kekuatan valve spring Penyimpangan melebihi batas yang di ijinkan Lebar telah melebihi batas yang di ijinkan Panjang spring kurang dari batas pemakaian yang diijinkan Permukaan cam bila rusak atau aus Putar chamshaft bearing outer race dengan jari tangan untuk memeriksa ketidak normalan putaran : valve head rusak : valve seat rusak : inner dan outer spring rusak : camshaft rusak : bearing rusak
131
B080
C090
D110
D120
E140
E150
E160
K140
k150
K160
B080 C090 C100 D110 D120 D130 D140 D150 D160 D170 E140 E150 E160 E170 E180 E190 E200 E210 E220 K140 K150 K160 K170 K180 K190 K200 K210 K220
: : : : : : : : : : : : : : : : : : : : : : : : : : : :
C100
D150
E170
E180
E190
E200
E210
E220
K170
K180
K190
K200
K210
K220
Battery dalam keadaan penuh Battery cepat habis Tahanan generator coil tidak ada masalah Ada perlengkapan tambahan Tidak ada perlengkapan tambahan Battery tidak ada masalah Pengisian tidak ada masalah Tahanan generator coil ada masalah Generator tanpa beban ada masalah Generator tanpa beban tidak ada masalah Membutuhkan tambahan tenaga listrik Battery ada masalah Pengisian tidak ada masalah pengisian ada masalah Tahanan generator coil ada masalah Generator tanpa beban ada masalah Regulator ada masalah Wire harness ada masalah Regulator tidak ada masalah Lepaskan perlengkapan tambahan Ada peralatan listrik yang rusak Kondisi pemakaian tidak normal Kabel tidak tersambung Generator coil rusak Stater rusak Regulator karatan Sambungan coupler tidak sempurna Regulator kotor
D160
D170
D140
D130
132
B090
C110
D190
D180
B090 C110 D180 D190 E230 E240 E250 E260 E270 E280 K230 K240 K250 K260 K270 K280
E230
E240
E250
E260
E270
E280
K230
K240
K250
K260
K270
K280
: Cabut starter motor lead wire : Putar ignition switch ke posisi on : Terdengar tidak bunyi klik : Tegangannya cukup : Starter dapat dihidupkan : Starter tidak dapat dihidupkan : Tegangannya cukup : Tidak cukup tegangannya : Kondisi starter relay baik : Kondisi starter relay tidak baik : Sambungan antara starter relay dan terminal batteray kendor atau terlepas : Starter motor tidak berfungsi : Kondisi relay kurang baik : Starter button tidak berfungsi : Starter relay tidak terhubung dengan baik : Starter relay tidak berfungsi
B100
B100
C120
C130
C140
C150
D200
D210
D220
D230
E290
E300
E310
E320
E330
K290
K300
K310
K320
K330
: Starter motor dapat dihidupkan tetapi tidak dapat memutar mesin
133
C120 C130 C140 C150 D200 D210 D220 D230 E290 E300 E310 E320 E330 K290 K300 K310 K320 K330
: Brush bila aus dan retak : Commutator berubah warna : Hubungan antara masing-masing segment menggunakan multi-circuit tester : Bibir oil seal rusak atau bocor : Kehalusan pada brush holder : Kondisi commutator rusak : Tidak ada hubungan segment-segmentnya : bunyi bearing tidak normal : Panjang brush kurang dari 3,5 mm : Kondisi commutator under cut : Amature coil tidak sesuai : Kehalusan gerakkannya tidak sesuai : Bushing bila aus atau rusak : Brush harus ganti : Armature commutator rusak : Sesuaikan amature coil : Ganti housing end bagian dalam : Ganti housing end bagian luar
armature
B110
B110 C160 C170 C180 C190 D240 D250 D260 D270 E340 E350 E360 E370 K340 K350
: : : : : : : : : : : : : : :
C160
C170
C180
C190
D240
D250
D260
D270
E340
E350
E360
E370
K340
K350
K360
K370
Tidak ada percikan api atau percikan api lemah Ada hubungan pada coupler, ignition switch Coupler ignition sistem bila sambungannya tidak sempurna Tegangan rendah dan tahanannya tidak stabil Tegangan tinggi pick up coil Tegangan battery diantara input lead wire Tidak ada hubungan pada coupler Ignition coil baik Adaptor tegangan tinggi Tegangannya tidak baik Tidak ada ignition switch Tegangan tinggi tahanannya baik Tegangan tinggi dan tahanannya baik Hubungan pada busy tidak sempurna Sambungan coupler putus
shaft
134
K360 K370
: CDI tidak berfungsi : Pickup coil tidak berfungsi B120
B120 C200 C210 C220 C230 D280 D290 D300 D310 E380 E390 E400 E410 K380 K390 K400 K410
: : : : : : : : : : : : : : : : :
C200
C210
C220
C230
D280
D290
D300
D310
E380
E390
E400
E410
K380
K390
K400
K410
Pada bagian belakang motor Motor dijalankan roda belakang terasa oleng Motor tidak nyaman pada saat berjalan dipermukaan berlubang Baut suspensi belakang kendor Terdapat bunyi getaran pada kecepatan tinggi Jika ban digoyangkan ke kiri dan ke kanan chasis ikut goyang Tekanan angin ban sudah sesuai Baut suspensi belakang kendor Body motor bagus Velg ban belakang tidak rusak Shock tidak berayun normal Pemegang swing arm kendor Dudukan rumah plat nomor goyang Bash arm rusak Shockbreaker rusak Bantalan lengan ayun rusak Rumah plat nomor rusak atau kendor
B130
C240
D320
C250
C260
C270
C280
D330
D340
D350
D360
D370
D380
D390
D400
E420
E430
E440
E450
E460
E470
E480
E490
E500
E510
K420
K430
K440
K450
K460
K470
K480
K490
K500
K510
B130
: Pada rem timbul bunyi abnormal
135
C240 C250 C260 C270 C280 D320 D330 D340 D350 D360 D370 D380 D390 D400 E420 E430 E440 E450 E460 E470 E480 E490 E500 E510 K420 K430 K440 K450 K460 K470 K480 K490 K500 K510
: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
Berkurangnya daya pengereman Switch rem sering macet Gerak tuas rem terlalu jauh Minyak rem bocor Setelan rem tidak mau kembali Terdapat oli pada sepatu rem Minyak rem normal Tromol masih bagus Lubang pengendali pada master cylinder tersumbat Pad aus Per switch rem karatan Sepatu rem tidak aus Selang piston retak Rem terseret Sepatu rem aus Pad rem aus disc rem aus tromol rem aus permukaan rem menempel pada permukaan pad Pad tidak rata Terdapat kotoran pada permukaan sepatu rem Tromol rem tidak aus Cakram rem tidak aus Piston rem berkarat Sepatu rem rusak Pad rem rusak Disc rem speleng Tromol rem rusak Kanvas rem habis Dust sel atau sel debu rusak kampas rem habis Setelan rem terlalu jauh Piston seal rem rusak Piston rem rusak
136
B140
C290
C300
D410
D420
C310
D440
D430
D460
D450
C320
C330
C340
C350
D470
D480
D490
D500
D510
D520
D530
E520
E530
E540
E550
E560
E570
E580
E590
E600
E610
E620
E630
E640
E650
E660
E670
E680
E690
K520
K530
K540
K550
K560
K570
K580
K590
K600
K610
K620
K630
K640
K650
K660
K670
K680
K690
B140 C290 C300 C310 C320 C330 C340 C350 D410 D420 D430 D440 D450 D460 D470 D480 D490 D500 D510 D520 D530 E520 E530 E540 E550 E560 E570 E580
: Pada bagian aksesoris : Oli keluar dari baut pembuangan oli : Klakson tidak bunyi : Listrik normal : Lampu depan mati saat dihidupkan : Pada saat di starter tangan motor tidak menyala : Starter tidak berfungsi : Klakson motor tidak nyaring : Drat oli sudah ditambah seal tape : Listrik dari kabel baik : Lampu depan tidak menyala : Lampu sen tidak menyala : Lampu sen menyala tanpa kedipan : Lampu rem belakang tidak menyala : Jarum penunjuk bahan bakar mati : Lampu malam belakang tidak menyala : Pada kabel lampu tidak ada yang terkelupas : Lampu indicator menyala : Starter tidak rusak : Tuas torak tidak dapat di tekan : Aki masih bagus : Drat pembuangan oli tidak loss : Tombol klakson tidak rusak : Klakson tidak rusak : Socket rumah bohlam dalam keadaan normal : Bohlam depan tidak putus : Socket rumah sen tidak karatan : Lampu sen putus
137
E590 E600 E610 E620
: Socket sen tidak karatan : Switch rem tidak rusak : Pada saat menekan rem depan lampu rem menyala : menggunakan rem depan lampu rem menyala sedangkan saat
E630 E640 E650 E660 E670 E680 E690 K520 K530 K540 K550 K560 K570 K580 K590 K600 K610 K620 K630 K640 K650 K660 K670 K680 K690
: Jarum tidak berfungsi pada saat bensin diisi full : Kabel socket rumah bohlam tidak putus : Aki tidak mati : Bunyi tek-tek saat di starter : Aki dan listrik normal : Torak macet : Klakson berkarat : Baut oli rusak : Klakson rusak : Tombol klakson rusak atau kotor : Bohlam depan putus : Tombol lampu depan rusak : Bohlam sen putus : Saklar sen rusak atau kotor : Relay sen karatan atau rusak : Lampu belakang rem rusak : Switch rem rusak : Bohlam putus : Pelampung bensin rusak : Bohlam malam putus : Regulator rusak : Bendik starter rusak : Tombol starter karatan : Torak kotor : Klakson berkarat
menggunakan rem belakang lampu rem tidak menyala
138
A020
D540
B150
B160
C360
C370
D550
D560
D570
D580
B170
C380
D590
B180
C390
C400
D600
D610
D620
E700
E710
E720
E730
E740
E750
E760
E770
E780
E790
E800
E810
K700
K710
K720
K730
K740
K750
K760
K770
K780
K790
K800
K810
A020 B150 B160 B170 B180 C360 C370 C380 C390 C400 D540 D550 D560 D570 D580 D590 D600 D610 D620 E700 E710 E720 E730 E740 E750 E760 E770 E780 E790 E800 E810
: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
Mesin dalam keadaan mati Bensin keluar dengan baik Tidak ada kompresi Ada api pada busi Mulai dari sok sampai roda belakang terdapat kerusakan Starter motor tidak rusak Magnet bagus Kunci kontak tidak rusak dan kabel kontak tidak putus Busi belum diganti Terdapat bunyi getaran pada kecepatan yang kencang Busi menghasilkan buangan api Ada bensin pada selang karburator tuas torak tidak dapat ditekan Mesin tidak kebanjiran bensin CDI bagus Bensin pada karburator keluar dengan baik Bensin pada karburator tidak keluar dengan baik Terdapat oli pada busi Cover body tidak rusak Tidak ada api pada spul CDI Busi tidak kebanjiran bensin Ada api pada CDI dan tidak ada api pada koil Busi kebanjiran bensin Tuas torak macet atau aus Tidak ada api pada CDI dan ada api pada spul CDI Koil tidak rusak Bensin tidak keluar dengan baik pada keran bensin Karburator bersih Bensin keluar pada keran bensin busi tidak dapat dikencangkan dengan maksimal Cover body tidak pecah
139
K700 K710 K720 K730 K740 K750 K760 K770 K780 K790 K800 K810
: : : : : : : : : : : :
Spul CDI rusak Busi rusak Koil rusak Pelampung bensin pada karburator rusak Torak rusak CDI rusak Ring seher jebol Tangki bensin kotor Bensin mampet pada keran bensin Karburator kotor Drat busi aus Baut cover body kendor A020
B190
A020 B190 B200 C410 C420 C430 C440 D630 D640 D650 D660 E820 E830 E840 E850 K820 K830 K840 K850
B200
C410
C420
C430
C440
D630
D640
D650
D660
E820
E830
E840
E850
K820
K830
K840
K850
: Mesin dalam keadaan mati : Stang sampai roda dalam keadaan baik : Tekanan angin di dalam ban sesuai : Tidak ada goyangan antara stang sampai roda :stang digoyang ke kanan terdapat celah gesekan antara stang dengan segitiga : Shockbreaker depan tidak rusak : Cakram rem berdebu : Sepeda motor menarik ke satu sisi : Stang kemudian mempunyai gerak longgar : Tidak ada yang longgar dari stang sampai garpu : Dispad berlumpur : Peredam kejut depan bengkok : Stang keras untuk digerakan : Pemegang handle bar longgar : Seal caliper aus : Permukaan oli shockbreaker depan tidak sama tinggi : Baut kepala kemudi terlalu kencang : Baut steering head longgar : Rem cakram bunyi
140
2. Lampiran Listing Program /* -------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component Alert
Nama File
: GetAlert.java
------------------------------------------------------------------------------*/ package com.application.component;
import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.AlertType;
/** * * @author */ public class GetAlert { public Alert altBerhasilLogin = new Alert("Pemberitahuan !!", "Anda Berhasil Login\n",null, AlertType.INFO); public Alert altArahan
= new Alert("Peringatan !!", "Maaf identifikasi Anda "
+ "Tidak Dapat Kami Definisi \n" + "Silahkan ulangi identifikasi " +
141
"anda", null, AlertType.INFO); public Alert altBerhasiSimpan = new Alert("Pemberitahuan !!", "Data Berhasil Disimpan",null, AlertType.INFO); public Alert altDataAda
= new Alert("Pemberitahuan !!", "Data Sudah Ada",null, AlertType.INFO);
public Alert alttxtKosong
= new Alert("Pemberitahuan !!",
"Field Tidak Boleh Kosong",null, AlertType.WARNING); public Alert alttxtBerhasilHapus
= new Alert("Pemberitahuan !!",
"Data Berhasil Dihapus",null, AlertType.INFO); public Alert alttxtKonfirmasi = new Alert("Konfirmasi !!", "",null, AlertType.CONFIRMATION); public Alert altBerhasiUbah = new Alert("Pemberitahuan !!", "Data Berhasil Di Ubah",null, AlertType.INFO); public Alert altPesan = new Alert("Pemberitahuan !!", null,null, AlertType.INFO); public GetAlert(){} } /*
142
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component Command
Nama File
: GetCommand.java
-------------------------------------------------------------------------------*/ package com.application.component;
import javax.microedition.lcdui.Command;
/** * * @author */ public class GetCommand { public Command cmdLogin public Command cmdKembali
= new Command("Login", Command.OK, 0); = new Command("Kembali", Command.OK, 1);
public Command cmdKeluar
= new Command("Keluar", Command.EXIT, 1);
public Command cmdMenu
= new Command("Menu", Command.OK, 0);
public Command cmdPilih
= new Command("Pilih", Command.OK, 0);
public Command cmdYA
= new Command("Ya", Command.OK, 2);
public Command cmdTidak
= new Command("Tidak", Command.OK, 2);
public Command cmdAwal
= new Command("Awal", Command.OK, 2);
143
public Command cmdPrev
= new Command("Prev", Command.OK, 2);
public Command cmdNext
= new Command("Next", Command.OK, 2);
public Command cmdSimpan public Command cmdUBah
= new Command("Simpan", Command.OK, 0); = new Command("Ubah", Command.OK, 0);
public Command cmdHapus
= new Command("Hapus", Command.OK, 0);
public Command cmdUbahData = new Command("Ubah Data", Command.OK, 0); public Command cmdAlertYa
= new Command("Ya", Command.OK, 0);
public Command cmdAlertTidak = new Command("Tidak", Command.OK, 0); public Command cmdSearch public Command cmdCari
= new Command("Search", Command.OK, 0); = new Command("Cari", Command.OK, 0);
public Command cmdCLEAR
= new Command("Clear", Command.OK, 0);
public Command cmdLogOut
= new Command("LogOut", Command.OK, 0);
public GetCommand(){ } } /*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component Image
Nama File
: GetImage.java
-------------------------------------------------------------------------------*/
144
package com.application.component;
import javax.microedition.lcdui.Image; /** * * @author */ public class GetImage { public Image imgHome; public Image imgIdentifikasi; public Image imgKamus; public Image imgAbout; public Image imgHelp; public Image imgAdmin; public GetImage(){ try{ imgHome = Image.createImage("/com/application/screen/image/motor.jpg"); imgIdentifikasi = Image.createImage("/com/application/screen/image/iconidentifikasi.png"); imgKamus = Image.createImage("/com/application/screen/image/nilai16.png"); imgAbout = Image.createImage("/com/application/screen/image/add_16.png"); imgHelp
= Image.createImage("/com/application/screen/image/login.png");
imgAdmin = Image.createImage("/com/application/screen/image/help_16.png"); }catch(Exception e){
145
System.out.print(e.getMessage()); } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.application.component;
import javax.microedition.lcdui.StringItem;
/** * * @author */ public class GetLabel { public StringItem lblPertanyaan = new StringItem(null, null); public GetLabel(){} } /* -------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component TextField
146
Nama File
: GetTextfield.java
-------------------------------------------------------------------------------*/ package com.application.component;
import javax.microedition.lcdui.TextField;
/** * * @author */ public class GetTextfield { public TextField txtUsername TextField.ANY);
= new TextField("Username", null,10 ,
public TextField txtPassword TextField.PASSWORD);
= new TextField("Password", null, 10,
public TextField txtPrevious
= new TextField(null, null, 100, TextField.ANY);
public TextField txtKode
= new TextField(null, null, 15, TextField.ANY);
public TextField txtIndex
= new TextField(null, "0", 10, TextField.ANY);
public TextField txtPage
= new TextField(null, "1", 5, TextField.ANY);
public TextField txtNext
= new TextField(null, "1", 5, TextField.ANY);
public TextField txtKodePertanyaan = new TextField("Kode Identifikasi : ", null, 5, TextField.ANY); public TextField txtPertanyaan TextField.ANY);
= new TextField("Identifikasi : ", null, 150,
public TextField txtKodeKesimpulan = new TextField("Kode Kesimpulan : ", null, 5, TextField.ANY); public TextField txtKesimpulan TextField.ANY);
= new TextField("Kesimpulan : ", null, 150,
147
public TextField txtSolusi public TextField txtKodeKamus TextField.ANY); public TextField txtKata
= new TextField("Solusi : ", null, 100, TextField.ANY); = new TextField("Kode Kamus : ", null, 5, = new TextField("Kata : ", null, 30, TextField.ANY);
public TextField txtKeterangan TextField.ANY);
= new TextField("Keterangan : ", null, 150,
public TextField txtKodeTujuan TextField.ANY);
= new TextField("Kode Tujuan : ", null, 150,
public TextField txtidentTujuan TextField.UNEDITABLE);
= new TextField("identifikasi : ", null, 150,
public TextField txtKodeTujuanAsli = new TextField("Kode Tujuan : ", null, 150, TextField.ANY);
public GetTextfield(){} } /*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component Ticker
Nama File
: GetTicker.java
-------------------------------------------------------------------------------*/
package com.application.component;
148
import javax.microedition.lcdui.Ticker;
/** * * @author */ public class GetTicker { public Ticker tickerWelcome = new Ticker("Selamat datang di Applikasi Sistem "+ "Identifikasi Kerusakan Motor Honda Beat " + "Berbasis Mobile "); public Ticker tickerHome = new Ticker("Selamat datang"); public GetTicker(){} }
/*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component Url
Nama File
: GetUrl.java
-------------------------------------------------------------------------------*/
149
package com.application.component; /** * * @author */ public class GetUrl { // public String urlGetMethod
= "http://umaryadi.com/Sispak";
// public String urlPostMethod
= "http://umaryadi.com/Sispak";
public String urlGetMethod
= "http://localhost/Sispak";
public String urlPostMethod
= "http://localhost/Sispak";
public String urlLogin
= "/Login.php?";
public String urlIdentification
= "/contohIdentifikasi.php?";
public String urlNextIdentification
= "/contohIdentifikasi2.php?";
public String urlNextIdentificationFull = ""; public String urlArahan
= "/CariArahan.php?";
public String urlSimpan
= "/insertData.php?";
public String urlList
= "/AmbilSemuaData.php?";
public String urlUbahData public String urlCariUbahData public String urlHapusData public String urlCariDataTarget public String urlCariData public String urlCariKamusKata
public String getUrlLogin() { return urlLogin;
= "/UbahData.php?"; = "/CariDataYangUbah.php?"; = "/HapusData.php?"; = "/cariTarget.php?"; = "/CariData.php?"; = "/CariKamusKata.php?";
150
}
public void setUrlLogin(String user, String password) { this.urlLogin = urlLogin+"username="+user+"&password="+password; }
public String getUrlNextIdentification() { return urlNextIdentificationFull; }
public void setUrlNextIdentification(String subKw, String kondisi) { this.urlNextIdentificationFull = ""; this.urlNextIdentificationFull = urlNextIdentification+"kw="+subKw+"&k="+kondisi; }
public GetUrl(){ } }
/* -------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua Class Keterangan
: Component ListData
Nama File
: ListData.java
--------------------------------------------------------------------------------
151
*/
package com.application.component.list;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.screen.MasterArahanScreen; import com.application.screen.MasterKamusScreen; import com.application.screen.MasterKesimpulanScreen; import com.application.screen.MasterPencarianScreen; import com.application.screen.MasterPertanyaanScreen; import com.application.screen.MasterTargetScreen; import com.application.screen.UpdateScreen; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.List;
/**
152
* * @author */ public class ListData extends List implements Runnable,CommandListener { Utama midListData; Display dispListData; String ParamList,HUList; Thread thListData = new Thread(this);; MethodCheck check = new MethodCheck(); GetUrl url
= new GetUrl();
GetCommand GetCMD = new GetCommand(); GetTextfield GetTXT = new GetTextfield(); GetAlert GTalert = new GetAlert(); int index
= 0;
Object objList; UpdateScreen UPS; MasterPertanyaanScreen MasterTanya; MasterKesimpulanScreen MasterKesimpulan; MasterKamusScreen MasterKamus; MasterTargetScreen MasterTarget; MasterPencarianScreen MasterCari; MasterArahanScreen MasterArahan; //======================================================= public ListData( Utama midUtama,Display dispUtama, String Param,String HU){ super("List Data ",IMPLICIT);
153
this.midListData = midUtama; this.dispListData = dispUtama; this.ParamList = Param; this.HUList = HU;
//String HU adalalah untuk Melempar Kata "Hapus" atau "Ubah" if(HU.equals("Ubah")){ addCommand(GetCMD.cmdUbahData); } else if(HU.equals("Hapus")){ addCommand(GetCMD.cmdHapus); }
addCommand(GetCMD.cmdSearch); addCommand(GetCMD.cmdKembali); setCommandListener(this); thListData.start(); } //======================================================= public void commandAction(Command c, Displayable d) { objList = c; if(c==GetCMD.cmdNext){ new Thread(this).start(); } else if(c==GetCMD.cmdPrev){ new Thread(this).start();
154
} else if(c==GetCMD.cmdKembali){ new Thread(this).start(); } else if(c==GetCMD.cmdUbahData){ new Thread(this).start(); } else if(c==GetCMD.cmdHapus){ new Thread(this).start(); } else if(c==GetCMD.cmdYA){ new Thread(this).start(); } else if(c==GetCMD.cmdTidak){ new Thread(this).start(); } else if(c==GetCMD.cmdSearch){ new Thread(this).start(); } } //======================================================= public void run() { if(objList == GetCMD.cmdKembali){ UPS = new UpdateScreen(midListData, dispListData, ParamList); dispListData.setCurrent(UPS); }
155
else if(objList == GetCMD.cmdSearch){ MasterCari = new MasterPencarianScreen(midListData, dispListData, ParamList,HUList); dispListData.setCurrent(MasterCari); } else if(objList == GetCMD.cmdHapus){ String Kode = getString(getSelectedIndex()).substring(0,4); GTalert.alttxtKonfirmasi.addCommand(GetCMD.cmdYA); GTalert.alttxtKonfirmasi.addCommand(GetCMD.cmdTidak); GTalert.alttxtKonfirmasi.setString("yakin ingin Hapus data dibawah\nKode "+ParamList+" : "+Kode ); GTalert.alttxtKonfirmasi.setTimeout(GTalert.alttxtKonfirmasi.FOREVER); GTalert.alttxtKonfirmasi.setCommandListener(this); dispListData.setCurrent(GTalert.alttxtKonfirmasi); } else if(objList == GetCMD.cmdYA){ String Kode =""; String HasilHapus =""; if(ParamList.equals("Target")|| ParamList.equals("Arahan")){ String kodeIdent = getString(getSelectedIndex()).substring(0,4); String kodeTujuan = getString(getSelectedIndex()).substring(8,12); HasilHapus = check.getCheck(url.urlHapusData, kodeIdent+"-"+kodeTujuan, ParamList, "hapus", "GET"); } else if(ParamList.equals("kamus")){ Kode
= getString(getSelectedIndex()).substring(0,5);
HasilHapus = check.getCheck(url.urlHapusData, Kode, ParamList, "hapus", "GET");
156
} else { Kode
= getString(getSelectedIndex()).substring(0,4);
HasilHapus = check.getCheck(url.urlHapusData, Kode, ParamList, "hapus", "GET"); } if(HasilHapus.equals("sukses")){ UPS = new UpdateScreen(midListData, dispListData, ParamList); dispListData.setCurrent(GTalert.alttxtBerhasilHapus,UPS); } else{ GTalert.alttxtBerhasilHapus.setString("Data Gagal dihapus"); dispListData.setCurrent(GTalert.alttxtBerhasilHapus,this); } } else if(objList== GetCMD.cmdTidak){ dispListData.setCurrent(this); } else if(objList==GetCMD.cmdUbahData){ String ambilKata = getString(getSelectedIndex());//untuk mengambil string yang dipilih di list data String Kode = ambilKata.substring(0,4);// string ambil kata di potong dari string index yang ke 0 hingga 4 if(ParamList.equals("identifikasi")){ MasterTanya = new MasterPertanyaanScreen(midListData, dispListData, "Ubah",Kode); dispListData.setCurrent(MasterTanya);
157
} else if(ParamList.equals("kesimpulan")){ MasterKesimpulan = new MasterKesimpulanScreen(midListData, dispListData, "Ubah",Kode); dispListData.setCurrent(MasterKesimpulan); } else if(ParamList.equals("kamus")){ String kodeKamus = getString(getSelectedIndex()).substring(0,5); MasterKamus = new MasterKamusScreen(midListData, dispListData, "Ubah",kodeKamus); dispListData.setCurrent(MasterKamus); } else if(ParamList.equals("Target")){ String kodeIdent = getString(getSelectedIndex()).substring(0,4); String kodeujuan = getString(getSelectedIndex()).substring(8,12); MasterTarget = new MasterTargetScreen(midListData, dispListData, "Ubah",kodeIdent,kodeujuan); dispListData.setCurrent(MasterTarget); } else if(ParamList.equals("Arahan")){ String kodeIdent = getString(getSelectedIndex()).substring(0,4); String kodeKes = getString(getSelectedIndex()).substring(8,12); MasterArahan = new MasterArahanScreen(midListData, dispListData, "Ubah",kodeIdent,kodeKes); dispListData.setCurrent(MasterArahan); } } else if(objList == GetCMD.cmdNext){
158
index = Integer.parseInt(GetTXT.txtIndex.getString())+10; GetTXT.txtIndex.setString(""+index); //===================== try{ String Urlhasil "List","POST");
= check.getCheck(url.urlList,ParamList, ""+index,
//======================================================= //fungsi untuk membuat Jumlah halaman //===================================== String ada = Urlhasil.substring(Urlhasil.length()-3,Urlhasil.length()); int JumPageMod = Integer.parseInt(ada)%10; int JumPage = Integer.parseInt(ada)/10; int page = Integer.parseInt(GetTXT.txtPage.getString())+1; GetTXT.txtPage.setString(""+page); if(JumPageMod>0){ JumPage = JumPage + 1; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } else{ JumPage = JumPage+0; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } //======================================================= if(page==JumPage){ removeCommand(GetCMD.cmdNext); } else{
159
addCommand(GetCMD.cmdNext); } //======================================================= if(page<=JumPage){ addCommand(GetCMD.cmdPrev); } //======================================================= int x
= Urlhasil.indexOf("+", 0);
int y
= Integer.parseInt(Urlhasil.substring(0,x));
String l2
= Urlhasil.substring(0, 1);
String[] data = new String[y]; Urlhasil data
= Urlhasil.substring(x + 1, Urlhasil.length()); = ParsingData.parseData(Urlhasil, y);
deleteAll(); for (int i = 0; i < y ; i++) { append(data[i], null);// } } catch(IOException aaz){} } else if(objList==GetCMD.cmdPrev){
index = Integer.parseInt(GetTXT.txtIndex.getString())-10; GetTXT.txtIndex.setString(""+index); //===================== try{
160
String Urlhasil "List","POST");
= check.getCheck(url.urlList,ParamList, ""+index,
//======================================================= //fungsi untuk membuat Jumlah halaman
String ada = Urlhasil.substring(Urlhasil.length()-3,Urlhasil.length()); int JumPageMod = Integer.parseInt(ada)%10; int JumPage = Integer.parseInt(ada)/10; int page = Integer.parseInt(GetTXT.txtPage.getString())-1; GetTXT.txtPage.setString(""+page); if(JumPageMod>0){ JumPage = JumPage + 1; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } else{ JumPage = JumPage+0; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } //======================================================= if(page==JumPage){ removeCommand(GetCMD.cmdNext); } else{ addCommand(GetCMD.cmdNext); } //======================================================= if(page==1){
161
removeCommand(GetCMD.cmdPrev); } else if(page>1){ addCommand(GetCMD.cmdPrev); } //======================================================= int x
= Urlhasil.indexOf("+", 0);
int y
= Integer.parseInt(Urlhasil.substring(0,x));
String l2
= Urlhasil.substring(0, 1);
String[] data = new String[y]; Urlhasil data
= Urlhasil.substring(x + 1, Urlhasil.length()); = ParsingData.parseData(Urlhasil, y);
deleteAll(); for (int i = 0; i < y ; i++) { append(data[i], null); } } catch(IOException aaz){} } else if(ParamList!=null){ try{ String Urlhasil
= check.getCheck(url.urlList,ParamList, "0", "List","POST");
//======================================================= //fungsi untuk membuat Jumlah halaman
String ada = Urlhasil.substring(Urlhasil.length()-3,Urlhasil.length());
162
int JumPageMod = Integer.parseInt(ada)%10; int JumPage = Integer.parseInt(ada)/10; int page = Integer.parseInt(GetTXT.txtPage.getString()); if(JumPageMod>0){ JumPage = JumPage + 1; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } else{ JumPage = JumPage+0; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } //======================================================= if(page==JumPage){ removeCommand(GetCMD.cmdNext); } else{ addCommand(GetCMD.cmdNext); } //======================================================= int x
= Urlhasil.indexOf("+", 0);
int y
= Integer.parseInt(Urlhasil.substring(0,x));
String l2
= Urlhasil.substring(0, 1);
String[] data = new String[y]; Urlhasil data deleteAll();
= Urlhasil.substring(x + 1, Urlhasil.length()); = ParsingData.parseData(Urlhasil, y);
163
for (int i = 0; i < y ; i++) { append(data[i], null);// } } catch(IOException aaz){} } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package com.application.component.list;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.screen.MasterArahanScreen; import com.application.screen.MasterKamusScreen; import com.application.screen.MasterKesimpulanScreen; import com.application.screen.MasterPencarianScreen;
164
import com.application.screen.MasterPertanyaanScreen; import com.application.screen.MasterTargetScreen; import com.application.screen.UpdateScreen; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.List;
/** * * @author */
public class ListDataSearch extends List implements Runnable,CommandListener { Utama midListData; Display dispListData; Thread thListData = new Thread(this);; String ParamList,KataCariLDS,huListdata,CGkataLDS;
MethodCheck check = new MethodCheck(); GetUrl url = new GetUrl(); GetCommand GetCMD = new GetCommand(); GetTextfield GetTXT = new GetTextfield();
165
GetAlert GTalert = new GetAlert(); int index = 0;
public ListDataSearch( Utama midUtama,Display dispUtama, String Param,String HU,String KataCari,String CGkata){ super("Hasil Pencarian ",IMPLICIT); this.midListData = midUtama; this.dispListData = dispUtama; this.ParamList = Param; this.KataCariLDS = KataCari; this.huListdata = HU; this.CGkataLDS = CGkata; //String HU adalalah untuk Melempar Kata "Hapus" atau "Ubah" if(HU.equals("Ubah")){ addCommand(GetCMD.cmdUbahData); } else if(HU.equals("Hapus")){ addCommand(GetCMD.cmdHapus); } addCommand(GetCMD.cmdSearch); addCommand(GetCMD.cmdKembali); setCommandListener(this); thListData.start(); }
Object objList; UpdateScreen UPS;
166
MasterPertanyaanScreen MasterTanya; MasterKesimpulanScreen MasterKesimpulan; MasterKamusScreen MasterKamus; MasterTargetScreen MasterTarget; MasterPencarianScreen MasterCari; MasterArahanScreen MasterArahan; public void commandAction(Command c, Displayable d) { objList = c; if(c==GetCMD.cmdNext){ new Thread(this).start(); } else if(c==GetCMD.cmdPrev){ new Thread(this).start(); } else if(c==GetCMD.cmdKembali){ new Thread(this).start(); } else if(c==GetCMD.cmdUbahData){ new Thread(this).start(); } else if(c==GetCMD.cmdHapus){ new Thread(this).start(); } else if(c==GetCMD.cmdYA){ new Thread(this).start(); }
167
else if(c==GetCMD.cmdTidak){ new Thread(this).start(); } else if(c==GetCMD.cmdSearch){ new Thread(this).start(); } }
public void run() { if(objList == GetCMD.cmdKembali){ UPS = new UpdateScreen(midListData, dispListData, ParamList); dispListData.setCurrent(UPS); } else if(objList == GetCMD.cmdSearch){ MasterCari = new MasterPencarianScreen(midListData, dispListData, ParamList,huListdata); dispListData.setCurrent(MasterCari); } else if(objList == GetCMD.cmdHapus){ String Kode = getString(getSelectedIndex()).substring(0,4); GTalert.alttxtKonfirmasi.addCommand(GetCMD.cmdYA); GTalert.alttxtKonfirmasi.addCommand(GetCMD.cmdTidak); GTalert.alttxtKonfirmasi.setString("yakin ingin Hapus data dibawah\nKode "+ParamList+" : "+Kode ); GTalert.alttxtKonfirmasi.setTimeout(GTalert.alttxtKonfirmasi.FOREVER); GTalert.alttxtKonfirmasi.setCommandListener(this); dispListData.setCurrent(GTalert.alttxtKonfirmasi);
168
} else if(objList == GetCMD.cmdYA){ String Kode =""; String HasilHapus =""; if(ParamList.equals("Target")|| ParamList.equals("Arahan")){ String kodeIdent = getString(getSelectedIndex()).substring(0,4); String kodeTujuan = getString(getSelectedIndex()).substring(8,12); HasilHapus = check.getCheck(url.urlHapusData, kodeIdent+"-"+kodeTujuan, ParamList, "hapus", "GET"); } else if(ParamList.equals("kamus")){ Kode
= getString(getSelectedIndex()).substring(0,5);
HasilHapus = check.getCheck(url.urlHapusData, Kode, ParamList, "hapus", "GET"); } else { Kode
= getString(getSelectedIndex()).substring(0,4);
HasilHapus = check.getCheck(url.urlHapusData, Kode, ParamList, "hapus", "GET"); }
if(HasilHapus.equals("sukses")){ UPS = new UpdateScreen(midListData, dispListData, ParamList); dispListData.setCurrent(GTalert.alttxtBerhasilHapus,UPS); } else{
169
GTalert.alttxtBerhasilHapus.setString("Data Gagal dihapus"); dispListData.setCurrent(GTalert.alttxtBerhasilHapus,this); }
} else if(objList== GetCMD.cmdTidak){ dispListData.setCurrent(this); } else if(objList==GetCMD.cmdUbahData){ String ambilKata = getString(getSelectedIndex());//untuk mengambil string yang dipilih di list data String Kode = ambilKata.substring(0,4);// string ambil kata di potong dari string index yang ke 0 hingga 4 if(ParamList.equals("identifikasi")){ MasterTanya = new MasterPertanyaanScreen(midListData, dispListData, "Ubah",Kode); dispListData.setCurrent(MasterTanya); } else if(ParamList.equals("kesimpulan")){ MasterKesimpulan = new MasterKesimpulanScreen(midListData, dispListData, "Ubah",Kode); dispListData.setCurrent(MasterKesimpulan); } else if(ParamList.equals("kamus")){ String kodeKamus = getString(getSelectedIndex()).substring(0,5); MasterKamus = new MasterKamusScreen(midListData, dispListData, "Ubah",kodeKamus); dispListData.setCurrent(MasterKamus);
170
} else if(ParamList.equals("Target")){ String kodeIdent = getString(getSelectedIndex()).substring(0,4); String kodeujuan = getString(getSelectedIndex()).substring(8,12); MasterTarget = new MasterTargetScreen(midListData, dispListData, "Ubah",kodeIdent,kodeujuan); dispListData.setCurrent(MasterTarget); } else if(ParamList.equals("Arahan")){ String kodeIdent = getString(getSelectedIndex()).substring(0,4); String kodeKes = getString(getSelectedIndex()).substring(8,12); MasterArahan = new MasterArahanScreen(midListData, dispListData, "Ubah",kodeIdent,kodeKes); dispListData.setCurrent(MasterArahan); }
} else if(objList == GetCMD.cmdNext){ index = Integer.parseInt(GetTXT.txtIndex.getString())+10; GetTXT.txtIndex.setString(""+index); //===================== try{ String Urlhasil = check.getCheck(url.urlCariData,KataCariLDS+""+CGkataLDS+"-"+ParamList, ""+index, "List","POST"); //======================================================= //fungsi untuk membuat Jumlah halaman //===================================== String ada = Urlhasil.substring(Urlhasil.length()-3,Urlhasil.length());
171
int JumPageMod = Integer.parseInt(ada)%10; int JumPage = Integer.parseInt(ada)/10; int page = Integer.parseInt(GetTXT.txtPage.getString())+1; GetTXT.txtPage.setString(""+page); if(JumPageMod>0){ JumPage = JumPage + 1; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } else{ JumPage = JumPage+0; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } //======================================================= if(page==JumPage){ removeCommand(GetCMD.cmdNext); } else{ addCommand(GetCMD.cmdNext); } //======================================================= if(page<=JumPage){ addCommand(GetCMD.cmdPrev); } //======================================================= int x
= Urlhasil.indexOf("+", 0);
int y
= Integer.parseInt(Urlhasil.substring(0,x));
172
String l2
= Urlhasil.substring(0, 1);
String[] data = new String[y]; Urlhasil data
= Urlhasil.substring(x + 1, Urlhasil.length()); = ParsingData.parseData(Urlhasil, y);
deleteAll(); for (int i = 0; i < y ; i++) { append(data[i], null); // } }
catch(IOException aaz){} } else if(objList==GetCMD.cmdPrev){
index = Integer.parseInt(GetTXT.txtIndex.getString())-10; GetTXT.txtIndex.setString(""+index); //=====================
try{ String Urlhasil = check.getCheck(url.urlCariData,KataCariLDS+""+CGkataLDS+"-"+ParamList, ""+index, "List","POST"); //======================================================= //fungsi untuk membuat Jumlah halaman
String ada = Urlhasil.substring(Urlhasil.length()-3,Urlhasil.length()); int JumPageMod = Integer.parseInt(ada)%10;
173
int JumPage = Integer.parseInt(ada)/10; int page = Integer.parseInt(GetTXT.txtPage.getString())-1; GetTXT.txtPage.setString(""+page); if(JumPageMod>0){ JumPage = JumPage + 1; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } else{ JumPage = JumPage+0; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } //======================================================= if(page==JumPage){ removeCommand(GetCMD.cmdNext); } else{ addCommand(GetCMD.cmdNext); } //======================================================= if(page==1){ removeCommand(GetCMD.cmdPrev); } else if(page>1){ addCommand(GetCMD.cmdPrev); } //=======================================================
174
int x
= Urlhasil.indexOf("+", 0);
int y
= Integer.parseInt(Urlhasil.substring(0,x));
String l2
= Urlhasil.substring(0, 1);
String[] data = new String[y]; Urlhasil data
= Urlhasil.substring(x + 1, Urlhasil.length()); = ParsingData.parseData(Urlhasil, y);
deleteAll(); for (int i = 0; i < y ; i++) { append(data[i], null); } }
catch(IOException aaz){}
} else if(ParamList!=null){ try{ String Urlhasil = check.getCheck(url.urlCariData,KataCariLDS+""+CGkataLDS+"-"+ParamList, "0", "List","POST"); //======================================================= //fungsi untuk membuat Jumlah halaman if(Urlhasil.equals("kosong")){ GTalert.altPesan.setString("Kata ["+KataCariLDS+"] Tidak Ditemukan Berdasarkan ["+CGkataLDS+"]"); MasterCari = new MasterPencarianScreen(midListData, dispListData, ParamList, huListdata); dispListData.setCurrent(GTalert.altPesan,MasterCari); }
175
else{ String ada = Urlhasil.substring(Urlhasil.length()-3,Urlhasil.length()); int JumPageMod = Integer.parseInt(ada)%10; int JumPage = Integer.parseInt(ada)/10; int page = Integer.parseInt(GetTXT.txtPage.getString()); if(JumPageMod>0){ JumPage = JumPage + 1; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } else{ JumPage = JumPage+0; setTitle("List Data "+ParamList +" >> Hal : [ "+page+"/"+JumPage+" ]"); } //======================================================= if(page==JumPage){ removeCommand(GetCMD.cmdNext); } else{ addCommand(GetCMD.cmdNext); } //======================================================= int x
= Urlhasil.indexOf("+", 0);
int y
= Integer.parseInt(Urlhasil.substring(0,x));
String l2
= Urlhasil.substring(0, 1);
String[] data = new String[y]; Urlhasil
= Urlhasil.substring(x + 1, Urlhasil.length());
176
data
= ParsingData.parseData(Urlhasil, y);
deleteAll(); for (int i = 0; i < y ; i++) { append(data[i], null); // }
}
}
catch(IOException aaz){} } } }
/*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua program yang terhubung akses database Keterangan
: Program koneksi database dengan MySQL
Nama File
: MethodCheck.java
-------------------------------------------------------------------------------*/
177
package com.application.maintenance;
import java.io.IOException;
/** * * @author */ public class MethodCheck { public String params = ""; String ad =""; MethodGet getdata = new MethodGet(); MethodPost postdata = new MethodPost(); public String getCheck(String url,String kw, String k, String cek, String method){ try { if (cek.equals("tanya")) { if (k.equals("")) { params = "kw=" + kw + "&k=" + k; } else { params = "kw=" + kw; } } else if (cek.equals("NP")){ params = "param="+kw+"&index="+k; } else if (cek.equals("arahan")){
178
params = "param="+kw+"&index="+k; } else if (cek.equals("simpan")){ params = "kode="+kw+"&data="+k; } else if (cek.equals("List")){ params = "param="+kw+"&index="+k; } else if (cek.equals("ubah")){ params = "kode="+kw+"¶mdata="+k; } else if (cek.equals("cariubah")){ params = "kode="+kw+"¶m="+k; } else if (cek.equals("hapus")){ params = "kode="+kw+"¶m="+k; } else if (cek.equals("CariTarget")){ params = "kode="+kw; } else if (cek.equals("Kamus")){ params = "param="+kw; } else if (cek.equals("login")){ params = "username="+kw+"&password="+k; }
179
if(method.equals("GET")){ if(getdata.doGet(url+params)){ ad = getdata.buff.toString(); } } else{ if(method.equals("POST")){ postdata.doPost(url, params); ad = postdata.buff.toString(); } } } catch (IOException ex) { ex.printStackTrace(); } return ad; }
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua program yang terhubung akses database Keterangan
: Program koneksi database dengan MySQL
Nama File
: MethodGet.java
--------------------------------------------------------------------------------
180
*/ package com.application.maintenance; import com.application.component.GetUrl; import java.io.IOException; import java.io.InputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; /** * * @author */ public class MethodGet { public StringBuffer buff = new StringBuffer(); GetUrl get = new GetUrl(); public boolean doGet(String url) throws IOException{ boolean kon=false; InputStream is = null; HttpConnection conn = null; String urlComplete = get.urlGetMethod+url; System.out.println (urlComplete); try{ long len = 0 ; int ch
= 0;
buff.delete(0,buff.length());// mengosongkan string buffer conn is
= (HttpConnection)Connector.open(urlComplete); = conn.openInputStream();
181
len
= conn.getLength() ;
System.out.println("panjang len : "+len); if ( len != -1){// membaca koding di php for (int i =0 ; i < len ; i++ ) if ((ch = is.read()) != -1) buff.append((char) ch); } else{ while ((ch = is.read()) != -1){ len = is.available(); buff.append((char)ch); } } kon=true; }catch(Exception e){kon=false;} finally{ is.close(); conn.close(); return kon; } /* -------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Semua program yang terhubung akses database Keterangan
: Program koneksi database dengan MySQL
Nama File
: MethodPost.java
182
-------------------------------------------------------------------------------*/ package com.application.maintenance; import com.application.component.GetUrl; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; /** * * @author */ public class MethodPost { public StringBuffer buff = new StringBuffer(); GetUrl post = new GetUrl(); public String doPost(String url,String param) throws IOException{ HttpConnection connect = null; InputStream input OutputStream output String urlComplete
= null; = null; = post.urlPostMethod+url;
try{ connect = (HttpConnection)Connector.open(urlComplete); connect.setRequestMethod(HttpConnection.POST); connect.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Confirguration/CLDC-1.0"); connect.setRequestProperty("Accept_Language", "en-US");
183
connect.setRequestProperty("Content-Type", "application/x-www-formurlencoded"); output = connect.openOutputStream(); output.write(param.getBytes()); buff.delete(0, buff.length()); input = connect.openDataInputStream(); int chr; while((chr = input.read())!= -1) buff.append((char)chr); }finally{ if(input!= null) input.close(); if(output!= null) output.close(); if(connect!= null) connect.close(); } String result = buff.toString(); System.out.print(result); return result; } } /* -------------------------------------------------------------------------------Nama Program : Sispakmobile Dipanggil Oleh : MenuHomeScreen.java Keterangan
: Menampilkan info pembuat aplikasi
184
Nama File
: AboutScreen.java
-------------------------------------------------------------------------------*/ package com.application.screen;
import com.application.component.GetCommand; import com.application.main.Utama; import java.io.IOException; import java.util.TimerTask; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.ImageItem; import javax.microedition.lcdui.StringItem; //======================================================= /** * @author */ public class AboutScreen extends Form implements CommandListener { private Utama midlet; private Display dispCall; GetCommand cmd = new GetCommand(); private StringItem txt;
185
private Command obj; private Image img; int w, h, hImg; TimerTask tmTask; //======================================================= public AboutScreen(Utama midlet, Display disp){ super("About"); this.midlet
= midlet;
this.dispCall = disp;
txt
= new StringItem("Universitas Mercubuana" + "\nresievinaria" + "\n41810120028" + " Fakultas Ilmu Komputer, Sistem Informasi ",null);
txt.setLayout(txt.LAYOUT_LEFT); try{ Image imgLogo = Image.createImage("/com/application/screen/image/Mercubuana.jpg"); ImageItem imgItemLogo = new ImageItem(null, imgLogo, ImageItem.LAYOUT_CENTER, null); append(imgItemLogo); }catch(IOException dhika){}
append(txt); addCommand(cmd.cmdKembali); setCommandListener(this); }
186
//======================================================= MenuHomeScreen mn; public void commandAction(Command c, Displayable d){ obj=c; if(c==cmd.cmdKembali){ mn = new MenuHomeScreen(midlet, dispCall); dispCall.setCurrent(mn); } } }
/*
-------------------------------------------------------------------------------Nama Program : Sispakmobile Dipanggil Oleh : MenuHomeScreen.java Keterangan
: Menampilkan info tentang Pembuat Aplikasi
Nama File
: AboutScreen.java
--------------------------------------------------------------------------------
187
*/
package com.application.screen;
import com.application.component.GetCommand; import com.application.main.Utama; import java.io.IOException; import java.util.TimerTask; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.ImageItem; import javax.microedition.lcdui.StringItem; //======================================================= /** * @author */ public class AboutScreen extends Form implements CommandListener { private Utama midlet; private Display dispCall; GetCommand cmd = new GetCommand(); private StringItem txt; private Command obj;
188
private Image img; int w, h, hImg; TimerTask tmTask; //======================================================= public AboutScreen(Utama midlet, Display disp){ super("About"); this.midlet
= midlet;
this.dispCall = disp;
txt
= new StringItem("Mercubuana" + "\nresievinaria" + "\n41810120028" + " Fakultas Ilmu Komputer, Sistem Informasi ",null);
txt.setLayout(txt.LAYOUT_LEFT); try{ Image imgLogo = Image.createImage("/com/application/screen/image/Mercubuana.jpg"); ImageItem imgItemLogo = new ImageItem(null, imgLogo, ImageItem.LAYOUT_CENTER, null); append(imgItemLogo); }catch(IOException dhika){}
append(txt); addCommand(cmd.cmdKembali); setCommandListener(this); }
189
//======================================================= MenuHomeScreen mn; public void commandAction(Command c, Displayable d){ obj=c; if(c==cmd.cmdKembali){ mn = new MenuHomeScreen(midlet, dispCall); dispCall.setCurrent(mn); } } }
/*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : HoMeScreen.java Keterangan
: Form Help
Nama File
: help.java
-------------------------------------------------------------------------------*/
package com.application.screen;
import com.application.component.GetCommand; import com.application.component.GetTicker; import com.application.main.Utama;
190
import java.util.TimerTask; import javax.microedition.lcdui.Ticker; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.StringItem; //=======================================================/** * * @author */ public class HelpScreen extends Form implements CommandListener{ private Utama midlet; private Display dispHelp; private StringItem txt; private Command obj; GetTicker ticker = new GetTicker(); GetCommand cmd = new GetCommand(); TimerTask tmTask; //======================================================= public HelpScreen(Utama midlet, Display disp){ super("Bantuan Penggunaan Aplikasi"); this.midlet
= midlet;
this.dispHelp = disp;
191
txt
= new StringItem("1. Silahkan pilih kerusakan apa saja yang anda alami\n" + "2. Pilih jawaban 'Ya' atau 'Tidak' dari pertanyaan yang muncul di
Layar Handphone\n" + "3. Tekan tombol 'prev' jika ingin kembali pertanyaan sebelumnya\n" + "4. Tekan tombol 'Menu depan' jika ingin keluar dari proses Identifikasi masalah", null);
append(txt); setTicker(ticker.tickerHome); addCommand(cmd.cmdKembali); setCommandListener(this); } //======================================================= MenuHomeScreen mn; public void commandAction(Command c, Displayable d) { obj=c; if(c==cmd.cmdKembali){ mn = new MenuHomeScreen(midlet, dispHelp); dispHelp.setCurrent(mn); } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
192
package com.application.screen;
import com.application.component.GetCommand; import com.application.main.Utama; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.List;
/** * * @author */ public class HomeAdminScreen extends List implements CommandListener, Runnable{ Utama midHomeAdmin; Display dispHAS; Object objHomeAdmin; Thread thHomeAdmin; GetCommand cmd = new GetCommand(); MasterPertanyaanScreen MPS; MasterKesimpulanScreen MKS; MenuHomeScreen MHome; UpdateScreen US; //======================================================= public HomeAdminScreen(Utama midU, Display dispU){
193
super("Menu Home Admin",IMPLICIT); this.midHomeAdmin = midU; this.dispHAS = dispU;
append("Master Identifikasi ", null); append("Master Kesimpulan", null); append("Master Kamus", null); append("Master Target", null); append("Master Arahan", null);
addCommand(cmd.cmdPilih); addCommand(cmd.cmdLogOut); setCommandListener(this); } //======================================================= public void commandAction(Command c, Displayable d) { objHomeAdmin = c; if(cmd.cmdPilih == c){ thHomeAdmin = new Thread(this); thHomeAdmin.start(); } if (c == cmd.cmdLogOut){ thHomeAdmin = new Thread(this); thHomeAdmin.start(); } }
194
//======================================================= public void run() { if(objHomeAdmin==cmd.cmdPilih){ if(getSelectedIndex()==0){ US = new UpdateScreen(midHomeAdmin, dispHAS,"identifikasi"); dispHAS.setCurrent(US); } else if(getSelectedIndex()==1){ US = new UpdateScreen(midHomeAdmin, dispHAS,"kesimpulan"); dispHAS.setCurrent(US); } else if(getSelectedIndex()==2){ US = new UpdateScreen(midHomeAdmin, dispHAS,"kamus"); dispHAS.setCurrent(US); } else if(getSelectedIndex()==3){ US = new UpdateScreen(midHomeAdmin, dispHAS,"Target"); dispHAS.setCurrent(US); } else if(getSelectedIndex()==4){ US = new UpdateScreen(midHomeAdmin, dispHAS,"Arahan"); dispHAS.setCurrent(US); } } if(objHomeAdmin == cmd.cmdLogOut){ MHome = new MenuHomeScreen(midHomeAdmin, dispHAS);
195
dispHAS.setCurrent(MHome); } } }
/*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : Utama.java Keterangan
: Tampilan awal Program
Nama File
: HomeScreen.java
-------------------------------------------------------------------------------*/
package com.application.screen;
import com.application.component.GetCommand; import com.application.component.GetImage; import com.application.component.GetTicker; import com.application.main.Utama; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form;
196
import javax.microedition.lcdui.Image; import javax.microedition.lcdui.ImageItem; //====================================================================== ======== /** * * @author */ public class HomeScreen extends Form implements CommandListener, Runnable{ private Utama mid; Display dispHome; Image imageHome; GetCommand cmd = new GetCommand(); GetTicker ticker = new GetTicker(); GetImage img = new GetImage(); Object obj; Thread threadHome ; MenuHomeScreen menuHome;
public HomeScreen(Utama midlet, Display disp){ super("Home"); this.mid = midlet; this.dispHome = disp;
setTicker(ticker.tickerWelcome); append(new ImageItem(null, img.imgHome, ImageItem.LAYOUT_CENTER, null)); addCommand(cmd.cmdKeluar);
197
addCommand(cmd.cmdMenu); //fungsi untuk menangkap even yang dibuat oleh Command setCommandListener(this); } //======================================================= public void commandAction(Command c, Displayable d) {
obj=c; if(c==cmd.cmdMenu){ threadHome = new Thread(this); threadHome.start(); //metode menjalankan Thread } else if(c == cmd.cmdKeluar){ threadHome = new Thread(this); threadHome.start(); //metode menjalankan Thread }
} //======================================================= public void run() {
if (obj == cmd.cmdMenu) { MenuHomeScreen menuHome = new MenuHomeScreen(mid, dispHome); dispHome.setCurrent(menuHome); }
198
else if (obj == cmd.cmdKeluar) { mid.exitMIDlet(); }
} //======================================================= } /*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : MenuHomeScreen.java Keterangan
: Form Identifikasi Masalah
Nama File
: IdentificationScreen.java
-------------------------------------------------------------------------------*/
package com.application.screen;
import com.application.component.GetCommand;
199
import com.application.component.GetLabel; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.maintenance.MethodGet; import com.application.utils.ParsingData;
import java.io.IOException; import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.AlertType; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.StringItem; //======================================================= /** * * @author */ public class IdentificationScreen extends Form implements CommandListener, Runnable{ private Utama midlet; Display dispInden; GetCommand cmd
= new GetCommand();
200
GetTextfield txt = new GetTextfield(); GetUrl url GetLabel lbl
= new GetUrl(); = new GetLabel();
MethodCheck check = new MethodCheck(); MethodGet method = new MethodGet(); IdentificationScreen ident; MenuHomeScreen mnuHome; ArahanScreen arah; String Urlhasil
= "";
String trima
= "";
Object obj; String kw; String subKW; String kondisi; String hasil; String Tanya; String kdj; String jj; String prev; String prev2; String k; //======================================================= public IdentificationScreen(Utama mid, Display disp){ super("Identifikasi Screen"); this.midlet this.dispInden
= mid; = disp;
201
try { Urlhasil
= check.getCheck(url.urlIdentification,"A0", "", "tanya","GET");
trima
= Urlhasil;
int x String l2
= trima.indexOf("+", 0); = trima.substring(0, 1);
String[] data = new String[3]; trima
= trima.substring(x + 1, trima.length());
data
= ParsingData.parseData(trima, 3);
lbl.lblPertanyaan = new StringItem(data[0], null); txt.txtKode.setString(data[2]);
append(lbl.lblPertanyaan); addCommand(cmd.cmdYA); addCommand(cmd.cmdTidak); addCommand(cmd.cmdMenu); setCommandListener(this); } catch (Exception ex) { ex.printStackTrace(); } } //======================================================= public void commandAction(Command cmdk, Displayable dsb) { obj = cmdk; if (cmdk == cmd.cmdYA){ new Thread(this).start();
202
} else if(cmdk == cmd.cmdTidak){ new Thread(this).start(); } else if(cmdk == cmd.cmdPrev){ new Thread(this).start(); } else if(cmdk == cmd.cmdAwal){ new Thread(this).start(); } else if(cmdk == cmd.cmdMenu){ new Thread(this).start(); } } //======================================================= public void run() { if(obj == cmd.cmdAwal){ ident = new IdentificationScreen(midlet, dispInden); dispInden.setCurrent(ident); } else if(obj == cmd.cmdMenu){ mnuHome = new MenuHomeScreen(midlet, dispInden); dispInden.setCurrent(mnuHome); } else if(obj == cmd.cmdYA){ kw
= txt.txtKode.getString();
203
subKW = kw.substring(0,4); kondisi = cmd.cmdYA.getLabel(); url.setUrlNextIdentification(subKW, kondisi);
setTitle("Loading.."); try { if(method.doGet(url.getUrlNextIdentification())){ hasil = ""+method.buff.toString(); for(int i=1; i
= hasil.substring(0,4); = hasil.substring(0,1);
if(jj.equals("K")){ Alert altKes = new Alert("Kesimpulan", Tanya, null, AlertType.INFO); altKes.addCommand(cmd.cmdAwal); altKes.setCommandListener(this); altKes.setTimeout(altKes.FOREVER); dispInden.setCurrent(altKes); }else{
204
addCommand(cmd.cmdPrev); prev = txt.txtKode.getString()+txt.txtPrevious.getString(); txt.txtPrevious.setString(prev); txt.txtKode.setString(""); txt.txtKode.setString(kdj); lbl.lblPertanyaan.setLabel(Tanya); } } } } catch (IOException pl) { } } else if(obj == cmd.cmdTidak){ kw
= txt.txtKode.getString();
subKW = kw.substring(0,4); kondisi = cmd.cmdTidak.getLabel(); url.setUrlNextIdentification(subKW, kondisi);
setTitle("Loading.."); try { if(method.doGet(url.getUrlNextIdentification())){ hasil = ""+method.buff.toString(); for(int i=1; i
205
dispInden.setCurrent(arah); }else{ Tanya = hasil.substring(4,hasil.length()); kdj jj
= hasil.substring(0,4); = hasil.substring(0,1);
if(jj.equals("K")){ Alert altKes = new Alert("Kesimpulan", Tanya, null, AlertType.INFO); altKes.addCommand(cmd.cmdAwal); altKes.setCommandListener(this); altKes.setTimeout(altKes.FOREVER); dispInden.setCurrent(altKes); }else{ addCommand(cmd.cmdPrev); prev = txt.txtKode.getString()+txt.txtPrevious.getString(); txt.txtPrevious.setString(prev); txt.txtKode.setString(""); txt.txtKode.setString(kdj); lbl.lblPertanyaan.setLabel(Tanya); } } } } catch (IOException pl) { } } else if(obj == cmd.cmdPrev){ if(txt.txtPrevious.getString().equals("")){
206
removeCommand(cmd.cmdPrev); }else{ k
= txt.txtPrevious.getString();
prev2 = txt.txtPrevious.getString().substring(0, 4); txt.txtKode.setString(prev2); txt.txtPrevious.setString(txt.txtPrevious.getString().substring(4,txt.txtPrevious.getString( ).length())); url.setUrlNextIdentification(prev2, ""); setTitle("Loading.."); try { if(method.doGet(url.getUrlNextIdentification())){ hasil = ""+method.buff.toString(); for(int i=1; i
/*
207
* To change this template, choose Tools | Templates * and open the template in the editor. */
package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.AlertType; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.TextField;
/** * * @author
208
*/ public class KamusKataScreen extends Form implements CommandListener,Runnable{
Utama MidKK; Display dispKK; // TextField txtKK; // Command cmdCariKK,cmdKembali; GetCommand GTcmd= new GetCommand(); GetTextfield GTtxt = new GetTextfield(); GetAlert GTalert = new GetAlert(); MenuHomeScreen MenuHome; MethodCheck Mcheck = new MethodCheck(); GetUrl url = new GetUrl(); Object obj; Thread thCmdKK;
public KamusKataScreen(Utama MidU, Display dsp){ super("Kamus Kata"); this.MidKK = MidU; this.dispKK = dsp; append(GTtxt.txtKata); addCommand(GTcmd.cmdCari); addCommand(GTcmd.cmdKembali); addCommand(GTcmd.cmdCLEAR); setCommandListener(this);
209
}
public void commandAction(Command cmd,Displayable dsb){ obj=cmd;
if(cmd==GTcmd.cmdCari){ if(GTtxt.txtKata.getString().equals("")){
dispKK.setCurrent(GTalert.alttxtKosong); } else{ thCmdKK = new Thread(this); thCmdKK.start();
} } else if(cmd==GTcmd.cmdKembali){ thCmdKK = new Thread(this); thCmdKK.start(); } else if(cmd==GTcmd.cmdCLEAR){ deleteAll(); append(GTtxt.txtKata); } }
210
public void run(){ if(obj==GTcmd.cmdCari){ //
String Hasil=""; try{
String Hasil = Mcheck.getCheck(url.urlCariKamusKata, GTtxt.txtKata.getString(),null,"Kamus","POST"); if(Hasil.equals("KOSONG")){ GTalert.alttxtKosong.setString("Maaf.. Kata [ "+GTtxt.txtKata.getString()+" ] Yang Anda Cari Tidak Ditemukan Dalam Kamus Kata..!!"); GTalert.alttxtKosong.setTimeout(GTalert.alttxtKosong.FOREVER); dispKK.setCurrent(GTalert.alttxtKosong); } else{ deleteAll(); append(GTtxt.txtKata);
int x = Hasil.indexOf("+",0); int y = Integer.parseInt(Hasil.substring(0,x));
String [] Data = new String[y]; Hasil = Hasil.substring(x+1,Hasil.length()); Data = ParsingData.parseData(Hasil,y ); append("Hasil Pencarian Berkaitan dengan Kata : "+GTtxt.txtKata.getString()); append("========================="); append("terdapat ["+y+"] Kata yang ditemukan"); append("=========================");
211
for (int i = 0; i < y ; i++) { append(Data[i]); append("========================="); } }
} catch(IOException az){} } //============================================== else if(obj==GTcmd.cmdKembali){ MenuHome = new MenuHomeScreen(MidKK, dispKK); dispKK.setCurrent(MenuHome); } } }
/*
-------------------------------------------------------------------------------Nama Program : SispakMobile Dipanggil Oleh : LoginScreen.java Keterangan
: File Login
Nama File
: LoginScreen.java
--------------------------------------------------------------------------------
212
*/
package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.maintenance.MethodGet; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.ImageItem;
/** * * @author */ public class LoginScreen extends Form implements CommandListener, Runnable{ private Utama mid;
213
private Display dispLogin; GetCommand cmd
= new GetCommand();
GetTextfield Field
= new GetTextfield();
GetAlert alt
= new GetAlert();
GetUrl url
= new GetUrl();
MethodGet method
= new MethodGet();
HomeAdminScreen HomeAdmin ; Object obj; String user=""; String pass=""; MethodCheck Mchek = new MethodCheck(); GetUrl getURL = new GetUrl(); //======================================================= public LoginScreen(Utama midlet, Display disp) { super("Login Admin"); this.mid = midlet; this.dispLogin = disp; try{ Image imgLogo = Image.createImage("/com/application/screen/image/user.png"); ImageItem imgItemLogo = new ImageItem(null, imgLogo, ImageItem.LAYOUT_CENTER, null); append(imgItemLogo); }catch(IOException dhika){} append(Field.txtUsername); append(Field.txtPassword); addCommand(cmd.cmdLogin);
214
addCommand(cmd.cmdKembali); setCommandListener(this); } //======================================================= public void commandAction(Command c, Displayable d) { obj = c; if(obj==cmd.cmdLogin){ new Thread(this).start(); } else if (obj==cmd.cmdKembali){ new Thread(this).start(); } } //=======================================================
public void run() { if(obj==cmd.cmdKembali){
}else if (obj == cmd.cmdLogin){ user = Field.txtUsername.getString(); pass = Field.txtPassword.getString(); url.setUrlLogin(user, pass);
try{ if(user.equals("") || pass.equals("")){ }
215
else{ String cekLogin = Mchek.getCheck(getURL.urlLogin, user, pass, "login", "GET");
if(cekLogin.equals("sukses")){ HomeAdmin = new HomeAdminScreen(mid, dispLogin); dispLogin.setCurrent(alt.altBerhasilLogin,HomeAdmin); } else if(cekLogin.equals("gagal")){ alt.altPesan.setString("Username atau password anda salah"); dispLogin.setCurrent(alt.altPesan); } } } catch(Exception a){} } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand;
216
import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Item; import javax.microedition.lcdui.ItemStateListener; import javax.microedition.lcdui.TextField;
/** * * @author */ public class MasterArahanScreen extends Form implements ItemStateListener,CommandListener,Runnable { Utama midArahan; Display dispArahan;
GetTextfield GETtxt = new GetTextfield(); GetCommand GETcmd = new GetCommand(); GetUrl GTurl = new GetUrl();
217
GetAlert GTalert= new GetAlert(); Object objArahan; Thread thArahan; MethodCheck Mchek = new MethodCheck(); UpdateScreen UpdateSC; String TUArahan,KodeIdentArahan,KodeKesimpulanArahan; String [] arrLevelKode = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V"," W","X","Y","Z"}; public MasterArahanScreen (Utama Midl, Display disp,String TU,String Kodeident, String KodeKesimpulan){ super("Master Arahan"); this.midArahan = Midl; this.dispArahan = disp; this.TUArahan = TU; this.KodeIdentArahan = Kodeident; this.KodeKesimpulanArahan = KodeKesimpulan;
GETtxt.txtPertanyaan = new TextField("identifikasi :", "", 150, TextField.UNEDITABLE); GETtxt.txtKesimpulan TextField.UNEDITABLE); GETtxt.txtSolusi
= new TextField("Kesimpulan : ", null, 150,
= new TextField("Solusi : ", null, 150, TextField.UNEDITABLE);
if(TU.equals("Tambah")){ addCommand(GETcmd.cmdSimpan); }
218
else if(TU.equals("Ubah")){ addCommand(GETcmd.cmdUBah); GETtxt.txtKodePertanyaan = new TextField("Kode identifikasi", null, 4, TextField.UNEDITABLE); GETtxt.txtKodePertanyaan.setString(KodeIdentArahan); GETtxt.txtKodeKesimpulan.setString(KodeKesimpulanArahan);
} append(GETtxt.txtKodePertanyaan); append(GETtxt.txtPertanyaan); append(GETtxt.txtKodeKesimpulan); append(GETtxt.txtKesimpulan); append(GETtxt.txtSolusi); addCommand(GETcmd.cmdKembali); setCommandListener(this); setItemStateListener(this); thArahan = new Thread(this); thArahan.start();
}
public void commandAction(Command c, Displayable d) { objArahan = c; if(GETcmd.cmdSimpan==c){
int kodeIdent=0;
219
int kodeTujuan=0;
if(GETtxt.txtKodePertanyaan.getString().equals("") || GETtxt.txtKodeKesimpulan.getString().equals("")){ dispArahan.setCurrent(GTalert.alttxtKosong); } else{ new Thread(this).start(); } } ///======================================================= else if(GETcmd.cmdUBah==c){ new Thread(this).start();
} else if(GETcmd.cmdKembali==c){ new Thread(this).start(); } else if(GETcmd.cmdYA==c){ new Thread(this).start(); } else if(GETcmd.cmdTidak==c){ new Thread(this).start(); }
}
220
public void run() { if(objArahan==GETcmd.cmdKembali){ UpdateSC = new UpdateScreen(midArahan, dispArahan, "Arahan"); dispArahan.setCurrent(UpdateSC); } else if(objArahan==GETcmd.cmdSimpan){ String KodeTargetSimpan = GETtxt.txtKodePertanyaan.getString().toUpperCase(); String KodeTujuan
= GETtxt.txtKodeKesimpulan.getString().toUpperCase();
String hasilPost = Mchek.getCheck(GTurl.urlSimpan, KodeTargetSimpan,KodeTujuan+"#null"+"#Arahan", "simpan", "POST");
if(hasilPost.equals("sukses")){
dispArahan.setCurrent(GTalert.altBerhasiSimpan); GETtxt.txtKodePertanyaan.setString(""); GETtxt.txtPertanyaan.setString(""); GETtxt.txtKodeKesimpulan.setString(""); GETtxt.txtKesimpulan.setString(""); GETtxt.txtSolusi.setString(""); } else if(hasilPost.equals("ada")){ GTalert.altPesan.setString("Kode Yang dimasukan sudah ada..!!"); dispArahan.setCurrent(GTalert.altPesan); } } //=========================================o==============
221
else if(objArahan==GETcmd.cmdUBah){ GTalert.alttxtKonfirmasi.addCommand(GETcmd.cmdYA); GTalert.alttxtKonfirmasi.addCommand(GETcmd.cmdTidak); GTalert.alttxtKonfirmasi.setString("yakin ingin Ubah data dibawah\nKode "+"Identifikasi"+" : "+KodeIdentArahan ); GTalert.alttxtKonfirmasi.setTimeout(GTalert.alttxtKonfirmasi.FOREVER); GTalert.alttxtKonfirmasi.setCommandListener(this); dispArahan.setCurrent(GTalert.alttxtKonfirmasi); } //======================================================= else if(objArahan == GETcmd.cmdYA){ String KodeKesimpulanUbah = GETtxt.txtKodeKesimpulan.getString().toUpperCase();
String HasilPostUbah = Mchek.getCheck(GTurl.urlUbahData , KodeKesimpulanUbah, KodeIdentArahan+"#"+KodeKesimpulanArahan+"#Arahan", "ubah","POST"); if(HasilPostUbah.equals("sukses")){ UpdateSC = new UpdateScreen(midArahan, dispArahan, "Arahan"); dispArahan.setCurrent(GTalert.altBerhasiUbah,UpdateSC);
} } //======================================================= else if(objArahan == GETcmd.cmdTidak){ dispArahan.setCurrent(this); } //=======================================================
222
else if(KodeIdentArahan !=null){ try{ /// untuk menampilkan pertanyaan kode identifikasi ///======================================================= String CariUbah = Mchek.getCheck(GTurl.urlCariUbahData, KodeIdentArahan, "identifikasi", "cariubah", "POST");
//
int x
= CariUbah.indexOf("+", 0);
int y
= Integer.parseInt(CariUbah.substring(0,x));
String l2
= CariUbah.substring(0, 1);
String[] data = new String[2]; CariUbah data
= CariUbah.substring(x + 1, CariUbah.length()); = ParsingData.parseData(CariUbah, 1);
GETtxt.txtPertanyaan.setString(data[0]); //untuk menampilkan pertnyaan kode kesimpulan arahan.. //======================================================= String CariUbahTujuan = Mchek.getCheck(GTurl.urlCariUbahData, KodeKesimpulanArahan, "kesimpulan", "cariubah", "POST"); int xTujuan
= CariUbahTujuan.indexOf("+", 0);
int yTujuan
= Integer.parseInt(CariUbahTujuan.substring(0,x));
String[] dataTujuan = new String[2]; CariUbahTujuan CariUbahTujuan.length()); dataTujuan
= CariUbahTujuan.substring(x + 1, = ParsingData.parseData(CariUbahTujuan, 2);
GETtxt.txtKesimpulan.setString(dataTujuan[0]); GETtxt.txtSolusi.setString(dataTujuan[1]); } catch(IOException z){ }
223
} }
//// fungsi untuk mencari pertanyaan sesuai dengan kode yang diketik... //======================================================= public void itemStateChanged(Item item) { //======================================================= if(item==GETtxt.txtKodePertanyaan){ if(GETtxt.txtKodePertanyaan.getString().length()>=4){ GETtxt.txtPertanyaan.setString("Loading.."); String HasilCari = Mchek.getCheck(GTurl.urlCariDataTarget, GETtxt.txtKodePertanyaan.getString().toUpperCase(), null, "CariTarget", "GET"); if(HasilCari.equals("kosong")){ GTalert.alttxtKosong.setString("Kode yang anda masukan tidak ditemukan..!!"); dispArahan.setCurrent(GTalert.alttxtKosong); GETtxt.txtPertanyaan.setString(""); } else{ GETtxt.txtPertanyaan.setString(HasilCari); }
} else if(GETtxt.txtKodePertanyaan.getString().length()==0){ GETtxt.txtPertanyaan.setString(""); }
224
} //======================================================= else if(item==GETtxt.txtKodeKesimpulan){ if(GETtxt.txtKodeKesimpulan.getString().length()>=4){ GETtxt.txtKesimpulan.setString("Loading.."); GETtxt.txtSolusi.setString("Loading.."); String HasilCari = Mchek.getCheck(GTurl.urlCariDataTarget, GETtxt.txtKodeKesimpulan.getString().toUpperCase(), null, "CariTarget", "GET"); if(HasilCari.equals("kosong")){ GTalert.alttxtKosong.setString("Kode yang anda masukan tidak ditemukan..!!"); dispArahan.setCurrent(GTalert.alttxtKosong); GETtxt.txtKesimpulan.setString(""); GETtxt.txtSolusi.setString(""); } else{ try{ int x
= HasilCari.indexOf("+", 0);
int y
= Integer.parseInt(HasilCari.substring(0,x));
String[] data = new String[2]; HasilCari data
= HasilCari.substring(x + 1, HasilCari.length()); = ParsingData.parseData(HasilCari, 2);
GETtxt.txtKesimpulan.setString(data[0]); GETtxt.txtSolusi.setString(data[1]);
} catch(IOException az){
225
} } } else if(GETtxt.txtKodeKesimpulan.getString().length()==0){ GETtxt.txtKesimpulan.setString(""); GETtxt.txtSolusi.setString(""); } } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command;
226
import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.TextField;
/** * * @author */ public class MasterKamusScreen extends Form implements CommandListener,Runnable { Utama midKamus; Display dispKamus;
GetTextfield GETtxt = new GetTextfield(); GetCommand GETcmd = new GetCommand(); GetUrl GTurl = new GetUrl(); GetAlert GTalert= new GetAlert(); Object objKamus; Thread thkamus; MethodCheck Mchek = new MethodCheck(); String TUkamus,Kodekamus;
public MasterKamusScreen (Utama Midl, Display disp,String TU,String Kode){ super("Master Kamus"); this.midKamus = Midl;
227
this.dispKamus = disp; this.TUkamus = TU; this.Kodekamus = Kode;
if(TU.equals("Tambah")){ addCommand(GETcmd.cmdSimpan); } else if(TU.equals("Ubah")){ addCommand(GETcmd.cmdUBah); GETtxt.txtKodeKamus = new TextField("Kode Kamus", null, 5, TextField.UNEDITABLE); GETtxt.txtKodeKamus.setString(Kodekamus);
} append(GETtxt.txtKodeKamus); append(GETtxt.txtKata); append(GETtxt.txtKeterangan);
setCommandListener(this); thkamus = new Thread(this); thkamus.start(); }
public void commandAction(Command c, Displayable d) { objKamus = c;
228
if(GETcmd.cmdSimpan==c){ thkamus = new Thread(this); thkamus.start(); } else if(GETcmd.cmdUBah==c){ new Thread(this).start();
}
}
public void run() {
if(objKamus==GETcmd.cmdSimpan){ String KodeKamusSimpan = GETtxt.txtKodeKamus.getString().toUpperCase(); String Kata String Ket
= GETtxt.txtKata.getString(); = GETtxt.txtKeterangan.getString();
String hasilPost = Mchek.getCheck(GTurl.urlSimpan, KodeKamusSimpan,Kata+"#"+Ket+"#kamus", "simpan", "POST");
if(hasilPost.equals("sukses")){
dispKamus.setCurrent(GTalert.altBerhasiSimpan); GETtxt.txtKodeKamus.setString(""); GETtxt.txtKata.setString(""); GETtxt.txtKeterangan.setString("");
229
}else if(hasilPost.equals("ada")){ GTalert.altPesan.setString("Kode kamus Yang dimasukan sudah ada..!!"); dispKamus.setCurrent(GTalert.altPesan); }
} else if(objKamus==GETcmd.cmdUBah){ String KataUbah = GETtxt.txtKata.getString(); String SolusiUbah= GETtxt.txtSolusi.getString(); String HasilPostUbah = Mchek.getCheck(GTurl.urlUbahData , Kodekamus, KataUbah+"#"+SolusiUbah+"#kamus", "ubah","POST"); if(HasilPostUbah.equals("sukses")){
dispKamus.setCurrent(GTalert.altBerhasiUbah); GETtxt.txtKodeKamus.setString(""); GETtxt.txtKata.setString(""); GETtxt.txtKeterangan.setString(""); } } else if(Kodekamus !=null){ try{ String CariUbah = Mchek.getCheck(GTurl.urlCariUbahData, Kodekamus, "kamus", "cariubah", "POST");
//
int x
= CariUbah.indexOf("+", 0);
int y
= Integer.parseInt(CariUbah.substring(0,x));
String l2
= CariUbah.substring(0, 1);
String[] data = new String[2];
230
CariUbah data
= CariUbah.substring(x + 1, CariUbah.length()); = ParsingData.parseData(CariUbah, 2);
GETtxt.txtKata.setString(data[0]); GETtxt.txtKeterangan.setString(data[1]);
} catch(IOException z){
}
}
}
}
/*
-------------------------------------------------------------------------------Nama Program : Sispak_ Dipanggil Oleh : UpdateScreen.java Keterangan
: Menu Tambah dan Ubah Kesimpulan
Nama File
: MasterKesimpulanScreen.java
--------------------------------------------------------------------------------
231
*/ package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.TextField; //======================================================= /** * * @author */ public class MasterKesimpulanScreen extends Form implements CommandListener,Runnable { Utama midKesimpulan; Display dispKesimpulan;
232
GetTextfield GETtxt = new GetTextfield(); GetCommand GETcmd = new GetCommand(); GetUrl GTurl
= new GetUrl();
GetAlert GTalert = new GetAlert(); Object objKesimpulan; Thread thKesimpulan; MethodCheck Mchek = new MethodCheck(); UpdateScreen UpdateSC; String ParamKes,kodeKes; //======================================================= public MasterKesimpulanScreen (Utama Midl, Display disp, String Param, String Kode){ super("Master Kesimpulan"); this.midKesimpulan = Midl; this.dispKesimpulan = disp; this.ParamKes = Param; this.kodeKes=Kode;
if(ParamKes.equals("Tambah")){ addCommand(GETcmd.cmdSimpan); } else if(ParamKes.equals("Ubah")){ addCommand(GETcmd.cmdUBah); GETtxt.txtKodeKesimpulan = new TextField("Kode Kesimpulan", null, 4, TextField.UNEDITABLE); GETtxt.txtKodeKesimpulan.setString(kodeKes); }
233
append(GETtxt.txtKodeKesimpulan); append(GETtxt.txtKesimpulan); append(GETtxt.txtSolusi); addCommand(GETcmd.cmdKembali); setCommandListener(this); thKesimpulan = new Thread(this); thKesimpulan.start(); } //======================================================= public void commandAction(Command c, Displayable d) { objKesimpulan = c; if(GETcmd.cmdSimpan==c){ if(GETtxt.txtKodeKesimpulan.getString().equals("")||GETtxt.txtKesimpulan.getString().eq uals("")||GETtxt.txtSolusi.getString().equals("")){ dispKesimpulan.setCurrent(GTalert.alttxtKosong); } else{ thKesimpulan = new Thread(this); thKesimpulan.start(); } } if(GETcmd.cmdUBah==c){ thKesimpulan = new Thread(this); thKesimpulan.start(); }
234
if(GETcmd.cmdKembali==c){ thKesimpulan = new Thread(this); thKesimpulan.start(); } } //======================================================= public void run() { if(objKesimpulan==GETcmd.cmdKembali){ UpdateSC = new UpdateScreen(midKesimpulan, dispKesimpulan, "kesimpulan"); dispKesimpulan.setCurrent(UpdateSC); } else if(objKesimpulan==GETcmd.cmdSimpan){ String KodeKesimpulan = GETtxt.txtKodeKesimpulan.getString().toUpperCase(); String Kesimpulan String Solusi
= GETtxt.txtKesimpulan.getString();
= GETtxt.txtSolusi.getString();
String hasilPost = Mchek.getCheck(GTurl.urlSimpan, KodeKesimpulan,Kesimpulan+"#"+Solusi+"#kesimpulan", "simpan", "POST");
if(hasilPost.equals("sukses")){ dispKesimpulan.setCurrent(GTalert.altBerhasiSimpan); GETtxt.txtKodeKesimpulan.setString(""); GETtxt.txtKesimpulan.setString(""); GETtxt.txtSolusi.setString(""); }else if(hasilPost.equals("ada")){ GTalert.altPesan.setString("Kode Kesimpulan Yang dimasukan sudah ada..!!"); dispKesimpulan.setCurrent(GTalert.altPesan); }
235
} else if(objKesimpulan==GETcmd.cmdUBah){ String KesimpulanUbah = GETtxt.txtKesimpulan.getString(); String SolusiUbah
= GETtxt.txtSolusi.getString();
String HasilPostUbah = Mchek.getCheck(GTurl.urlUbahData , kodeKes, KesimpulanUbah+"#"+SolusiUbah+"#kesimpulan", "ubah","POST"); if(HasilPostUbah.equals("sukses")){ dispKesimpulan.setCurrent(GTalert.altBerhasiUbah); GETtxt.txtKodeKesimpulan.setString(""); GETtxt.txtKesimpulan.setString(""); GETtxt.txtSolusi.setString(""); }else{ dispKesimpulan.setCurrent(GTalert.altDataAda); GETtxt.txtKodeKesimpulan.setString(""); GETtxt.txtKesimpulan.setString(""); GETtxt.txtSolusi.setString(""); } } else if(kodeKes !=null){ try{ String CariUbah = Mchek.getCheck(GTurl.urlCariUbahData, kodeKes, "kesimpulan", "cariubah", "POST"); int x
= CariUbah.indexOf("+", 0);
int y
= Integer.parseInt(CariUbah.substring(0,x));
String[] data = new String[2]; CariUbah data
= CariUbah.substring(x + 1, CariUbah.length()); = ParsingData.parseData(CariUbah, 2);
236
GETtxt.txtKesimpulan.setString(data[0]); GETtxt.txtSolusi.setString(data[1]); } catch(IOException z){ } } } }
/*
-------------------------------------------------------------------------------Nama Program : Sispak_LG Dipanggil Oleh : UpdateScreen.java Keterangan
: Menampilkan form untuk mencari data sesuai dengan parameter dan kondisi yang dikirim dari \ UpdateScreen.java
Nama File
: MasterPencarianScreen.java
-------------------------------------------------------------------------------*/
package com.application.screen;
import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.list.ListData;
237
import com.application.component.list.ListDataSearch; import com.application.main.Utama; import javax.microedition.lcdui.Choice; import javax.microedition.lcdui.ChoiceGroup; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.TextField; //=======================================================
/** * * @author */ public class MasterPencarianScreen extends Form implements CommandListener, Runnable{ Utama midCari; Display dispCari; String [] elIdent={"kode_identifikasi","pertanyaan"}; String [] elKes={"kode_kesimpulan","Kesimpulan","Solusi"}; String [] elKam={"kode_kamus","kata","Keterangan"}; String [] elTar = {"kode_identifikasi","kode_tujuan"}; String [] elAr = {"kode_identifikasi","kode_kesimpulan"}; String ParamDataCari, HUcari; TextField txtKata = new TextField("Kata Kunci : ", null, 20, TextField.ANY);
238
ChoiceGroup cgCari; Object objCari; Thread thCari; GetCommand GTcmd = new GetCommand(); GetTextfield GTtxt = new GetTextfield(); ListDataSearch ListCari; ListData Listdata; //======================================================= public MasterPencarianScreen(Utama midU, Display disp, String Param, String HU){ super("Form Pencarian Data " +Param); this.midCari = midU; this.dispCari = disp; this.ParamDataCari = Param; this.HUcari = HU;
if(ParamDataCari.equals("identifikasi")){ cgCari = new ChoiceGroup("Cari Berdasarkan ", Choice.POPUP, elIdent, null); } else if (ParamDataCari.equals("kesimpulan")){ cgCari = new ChoiceGroup("Cari Berdasarkan ", Choice.POPUP, elKes, null); } else if(ParamDataCari.equals("kamus")){ cgCari = new ChoiceGroup("Cari Berdasarkan ", Choice.POPUP, elKam, null); } else if(ParamDataCari.equals("Target")){ cgCari = new ChoiceGroup("Cari Berdasarkan ", Choice.POPUP, elTar, null);
239
} else if(ParamDataCari.equals("Arahan")){ cgCari = new ChoiceGroup("Cari Berdasarkan ", Choice.POPUP, elAr, null); } append(cgCari); append(GTtxt.txtKata); addCommand(GTcmd.cmdCari); addCommand(GTcmd.cmdKembali); setCommandListener(this); } //======================================================= public void commandAction(Command cmd, Displayable dsb){ objCari=cmd;
if(cmd==GTcmd.cmdCari){ thCari = new Thread(this); thCari.start(); } else if(cmd==GTcmd.cmdKembali){ thCari = new Thread(this); thCari.start(); } } //=======================================================
public void run(){
240
if(objCari == GTcmd.cmdCari ){ String isiKata = GTtxt.txtKata.getString(); String isiCG = cgCari.getString(cgCari.getSelectedIndex()); ListCari = new ListDataSearch(midCari, dispCari, ParamDataCari, HUcari, isiKata, isiCG); dispCari.setCurrent(ListCari); } else if(objCari==GTcmd.cmdKembali){ Listdata = new ListData(midCari, dispCari, ParamDataCari, HUcari); dispCari.setCurrent(Listdata); } } } /* -------------------------------------------------------------------------------Nama Program : Sispak_LG Dipanggil Oleh : UpdateScreen.java Keterangan
: Menu Tambah dan Ubah Identifikasi
Nama File
: MasterPertanyaanScreen.java
-------------------------------------------------------------------------------*/ package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl;
241
import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.TextField; //======================================================= /** * * @author */ public class MasterPertanyaanScreen extends Form implements CommandListener,Runnable { Utama midPertanyaan; Display dispPertanyaan; GetTextfield GETtxt = new GetTextfield(); GetCommand GETcmd = new GetCommand(); GetUrl GTurl
= new GetUrl();
GetAlert GTalert = new GetAlert(); MethodCheck Mchek = new MethodCheck(); Object objPertanyaan; Thread thPertanyaan; UpdateScreen UpdateSC;
242
String TUtanya,KodePertanyaan; Thread thTanya; //======================================================= public MasterPertanyaanScreen (Utama Midl, Display disp,String TU,String Kode){ super("Master identifikasi"); this.midPertanyaan = Midl; this.dispPertanyaan = disp; this.TUtanya = TU; this.KodePertanyaan = Kode;
if(TU.equals("Tambah")){ addCommand(GETcmd.cmdSimpan); } else if(TU.equals("Ubah")){ addCommand(GETcmd.cmdUBah); GETtxt.txtKodePertanyaan = new TextField("Kode Pertanyaan", null, 4, TextField.UNEDITABLE); GETtxt.txtKodePertanyaan.setString(KodePertanyaan); } append(GETtxt.txtKodePertanyaan); append(GETtxt.txtPertanyaan); addCommand(GETcmd.cmdKembali); setCommandListener(this); thTanya = new Thread(this); thTanya.start(); }
243
//======================================================= commandAction(Command c, Displayable d) {
public void
objPertanyaan = c; if(GETcmd.cmdSimpan==c){ thPertanyaan = new Thread(this); thPertanyaan.start(); } else if(GETcmd.cmdUBah==c){ new Thread(this).start(); } else if(GETcmd.cmdKembali==c){ new Thread(this).start(); } else if(GETcmd.cmdYA==c){ new Thread(this).start(); } else if(GETcmd.cmdTidak==c){ new Thread(this).start(); } } //======================================================= public void run() { if(objPertanyaan==GETcmd.cmdKembali){ UpdateSC = new UpdateScreen(midPertanyaan, dispPertanyaan, "identifikasi"); dispPertanyaan.setCurrent(UpdateSC); } else if(objPertanyaan==GETcmd.cmdSimpan){
244
String KodePertanyaanTanya = GETtxt.txtKodePertanyaan.getString().toUpperCase(); String Pertanyaan
= GETtxt.txtPertanyaan.getString();
String hasilPost = Mchek.getCheck(GTurl.urlSimpan, KodePertanyaanTanya,Pertanyaan+"#null"+"#identifikasi", "simpan", "POST");
if(hasilPost.equals("sukses")){ dispPertanyaan.setCurrent(GTalert.altBerhasiSimpan); GETtxt.txtKodePertanyaan.setString(""); GETtxt.txtPertanyaan.setString(""); }else{ dispPertanyaan.setCurrent(GTalert.altDataAda); GETtxt.txtKodePertanyaan.setString(""); GETtxt.txtPertanyaan.setString(""); } } else if(objPertanyaan==GETcmd.cmdUBah){ GTalert.alttxtKonfirmasi.addCommand(GETcmd.cmdYA); GTalert.alttxtKonfirmasi.addCommand(GETcmd.cmdTidak); GTalert.alttxtKonfirmasi.setString("yakin ingin Ubah data dibawah\nKode "+"identifikasi"+" : "+KodePertanyaan ); GTalert.alttxtKonfirmasi.setTimeout(GTalert.alttxtKonfirmasi.FOREVER); GTalert.alttxtKonfirmasi.setCommandListener(this); dispPertanyaan.setCurrent(GTalert.alttxtKonfirmasi); } else if(objPertanyaan == GETcmd.cmdYA){ String PertanyaanUbah = GETtxt.txtPertanyaan.getString();
245
String HasilPostUbah = Mchek.getCheck(GTurl.urlUbahData , KodePertanyaan, PertanyaanUbah+"#null#identifikasi", "ubah","POST"); if(HasilPostUbah.equals("sukses")){ UpdateSC = new UpdateScreen(midPertanyaan, dispPertanyaan, "identifikasi"); dispPertanyaan.setCurrent(GTalert.altBerhasiUbah,UpdateSC); GETtxt.txtKodePertanyaan.setString(""); GETtxt.txtPertanyaan.setString(""); } } else if(objPertanyaan == GETcmd.cmdTidak){ dispPertanyaan.setCurrent(this); } else if(KodePertanyaan !=null){ try{ String CariUbah = Mchek.getCheck(GTurl.urlCariUbahData, KodePertanyaan, "identifikasi", "cariubah", "POST"); int x
= CariUbah.indexOf("+", 0);
int y
= Integer.parseInt(CariUbah.substring(0,x));
String[] data = new String[2]; CariUbah data
= CariUbah.substring(x + 1, CariUbah.length()); = ParsingData.parseData(CariUbah, 1);
GETtxt.txtPertanyaan.setString(data[0]); } catch(IOException z){} } } }
246
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.application.screen;
import com.application.component.GetAlert; import com.application.component.GetCommand; import com.application.component.GetTextfield; import com.application.component.GetUrl; import com.application.main.Utama; import com.application.maintenance.MethodCheck; import com.application.utils.ParsingData; import java.io.IOException; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Item; import javax.microedition.lcdui.ItemStateListener; import javax.microedition.lcdui.TextField;
/** *
247
* @author */ public class MasterTargetScreen extends Form implements ItemStateListener,CommandListener,Runnable { Utama midTarget; Display dispTarget;
GetTextfield GETtxt = new GetTextfield(); GetCommand GETcmd = new GetCommand(); GetUrl GTurl
= new GetUrl();
GetAlert GTalert = new GetAlert(); Thread thTar; Object objTarget; Thread thTarget; MethodCheck Mchek = new MethodCheck(); UpdateScreen UpdateSC; String TUTarget,KodeIdentTarget,KodeTujuanTarget; String [] arrLevelKode = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V"," W","X","Y","Z"}; //======================================================= public MasterTargetScreen (Utama Midl, Display disp,String TU,String Kodeident, String KodeTujuan){ super("Master Target"); this.midTarget = Midl; this.dispTarget = disp; this.TUTarget = TU; this.KodeIdentTarget = Kodeident;
248
this.KodeTujuanTarget = KodeTujuan; GETtxt.txtPertanyaan = new TextField("identifikasi :", "", 150, TextField.UNEDITABLE); GETtxt.txtKodeTujuanAsli.setString(KodeTujuanTarget);
if(TU.equals("Tambah")){ addCommand(GETcmd.cmdSimpan); } else if(TU.equals("Ubah")){ addCommand(GETcmd.cmdUBah); GETtxt.txtKodePertanyaan = new TextField("Kode identifikasi", null, 4, TextField.UNEDITABLE); GETtxt.txtKodePertanyaan.setString(KodeIdentTarget); GETtxt.txtKodeTujuan.setString(KodeTujuanTarget);
} append(GETtxt.txtKodePertanyaan); append(GETtxt.txtPertanyaan); append(GETtxt.txtKodeTujuan); append(GETtxt.txtidentTujuan); addCommand(GETcmd.cmdKembali); setCommandListener(this); setItemStateListener(this); thTarget = new Thread(this); thTarget.start(); } //=======================================================
249
public void commandAction(Command c, Displayable d) { objTarget = c; int kodeIdent=0; int kodeTujuan=0; if(GETcmd.cmdSimpan==c){ if(GETtxt.txtKodePertanyaan.getString().equals("") || GETtxt.txtKodeTujuan.getString().equals("")){ dispTarget.setCurrent(GTalert.alttxtKosong); } else{ //====untuk mengecek apakah kode identifikasi sama isinya denngan kode tujuan... if(GETtxt.txtKodePertanyaan.getString().toUpperCase().equals(GETtxt.txtKodeTujuan.get String().toUpperCase())) { GTalert.altPesan.setString("Kode Tujuan Tidak boleh Sama dengan kode awal"); dispTarget.setCurrent(GTalert.altPesan); } else{ String subKodeIdent = GETtxt.txtKodePertanyaan.getString().toUpperCase().substring(0,1); String subKodeTujuan = GETtxt.txtKodeTujuan.getString().toUpperCase().substring(0,1); ///untuk mencari menambahkan index pada tiap kode yang kemudian kan dichek levelnya... for(int i= 0; i<arrLevelKode.length;i++){ if(subKodeIdent.equals(arrLevelKode[i])){ kodeIdent = i;
250
} else if(subKodeTujuan.equals(arrLevelKode[i])){ kodeTujuan = i; } } /*
if(kodeIdent >= kodeTujuan){
GTalert.altPesan.setString("Kode identifikasi tidak boleh lebih dalam levelnya dari kode tujuan..!!"); GTalert.altPesan.setTimeout(GTalert.altPesan.FOREVER); dispTarget.setCurrent(GTalert.altPesan); }*/ if(kodeIdent+1 < kodeTujuan){ GTalert.altPesan.setString("Kode Tujuan tidak boleh lebih dari satu level dari kode identifikasi"); GTalert.altPesan.setTimeout(GTalert.altPesan.FOREVER); dispTarget.setCurrent(GTalert.altPesan); } else{ new Thread(this).start(); } } //======================================================= }
} ///======================================================= else if(GETcmd.cmdUBah==c){
251
new Thread(this).start();
} else if(GETcmd.cmdKembali==c){ new Thread(this).start(); } else if(GETcmd.cmdYA==c){ new Thread(this).start(); } else if(GETcmd.cmdTidak==c){ new Thread(this).start(); }
}
public void run() { if(objTarget==GETcmd.cmdKembali){ UpdateSC = new UpdateScreen(midTarget, dispTarget, "Target"); dispTarget.setCurrent(UpdateSC); } else if(objTarget==GETcmd.cmdSimpan){ String KodeTargetSimpan = GETtxt.txtKodePertanyaan.getString().toUpperCase(); String KodeTujuan
= GETtxt.txtKodeTujuan.getString().toUpperCase();
String hasilPost = Mchek.getCheck(GTurl.urlSimpan, KodeTargetSimpan,KodeTujuan+"#null"+"#Target", "simpan", "POST");
252
if(hasilPost.equals("sukses")){
dispTarget.setCurrent(GTalert.altBerhasiSimpan); GETtxt.txtKodePertanyaan.setString(""); GETtxt.txtPertanyaan.setString(""); GETtxt.txtKodeTujuan.setString(""); GETtxt.txtidentTujuan.setString(""); } else if(hasilPost.equals("ada")){ GTalert.altPesan.setString("Kode Yang dimasukan sudah ada..!!"); dispTarget.setCurrent(GTalert.altPesan); } } //======================================================= else if(objTarget==GETcmd.cmdUBah){ GTalert.alttxtKonfirmasi.addCommand(GETcmd.cmdYA); GTalert.alttxtKonfirmasi.addCommand(GETcmd.cmdTidak); GTalert.alttxtKonfirmasi.setString("yakin ingin Ubah data dibawah\nKode "+"Identifikasi"+" : "+KodeIdentTarget ); GTalert.alttxtKonfirmasi.setTimeout(GTalert.alttxtKonfirmasi.FOREVER); GTalert.alttxtKonfirmasi.setCommandListener(this); dispTarget.setCurrent(GTalert.alttxtKonfirmasi); } //======================================================= else if(objTarget == GETcmd.cmdYA){ String KodeTujuanUbah = GETtxt.txtKodeTujuan.getString().toUpperCase();
253
String HasilPostUbah = Mchek.getCheck(GTurl.urlUbahData , KodeTujuanUbah, KodeIdentTarget+"#"+KodeTujuanTarget+"#Target", "ubah","POST"); if(HasilPostUbah.equals("sukses")){ UpdateSC = new UpdateScreen(midTarget, dispTarget, "Target"); dispTarget.setCurrent(GTalert.altBerhasiUbah,UpdateSC); //
GETtxt.txtKodePertanyaan.setString("");
//
GETtxt.txtKodeTujuan.setString("");
} } ================================ else if(objTarget == GETcmd.cmdTidak){ dispTarget.setCurrent(this); } //================================== else if(KodeIdentTarget !=null){ try{ /// untuk menampilkan pertanyaan kode identifikasi ///======================================================= String CariUbah = Mchek.getCheck(GTurl.urlCariUbahData, KodeIdentTarget, "identifikasi", "cariubah", "POST");
//
int x
= CariUbah.indexOf("+", 0);
int y
= Integer.parseInt(CariUbah.substring(0,x));
String l2
= CariUbah.substring(0, 1);
String[] data = new String[2]; CariUbah data
= CariUbah.substring(x + 1, CariUbah.length()); = ParsingData.parseData(CariUbah, 1);
254
GETtxt.txtPertanyaan.setString(data[0]); //untuk menampilkan pertnyaan kode tujuan.. //======================================================= String CariUbahTujuan = Mchek.getCheck(GTurl.urlCariUbahData, KodeTujuanTarget, "identifikasi", "cariubah", "POST");
//
int xTujuan
= CariUbahTujuan.indexOf("+", 0);
int yTujuan
= Integer.parseInt(CariUbahTujuan.substring(0,x));
String l2
= CariUbah.substring(0, 1);
String[] dataTujuan = new String[2]; CariUbahTujuan = CariUbahTujuan.substring(x + 1, CariUbahTujuan.length()); dataTujuan
= ParsingData.parseData(CariUbahTujuan, 1);
GETtxt.txtidentTujuan.setString(dataTujuan[0]); } catch(IOException z){ } } }
//// fungsi untuk mencari pertanyaan sesuai dengan kode yang diketik... //======================================================= public void itemStateChanged(Item item) { //======================================================= if(item==GETtxt.txtKodePertanyaan){ if(GETtxt.txtKodePertanyaan.getString().length()>=4){ GETtxt.txtPertanyaan.setString("Loading..");
255
String HasilCari = Mchek.getCheck(GTurl.urlCariDataTarget, GETtxt.txtKodePertanyaan.getString().toUpperCase(), null, "CariTarget", "GET"); if(HasilCari.equals("kosong")){ GTalert.alttxtKosong.setString("Kode yang anda masukan tidak ditemukan..!!"); dispTarget.setCurrent(GTalert.alttxtKosong); GETtxt.txtPertanyaan.setString(""); } else{ GETtxt.txtPertanyaan.setString(HasilCari); }
} else if(GETtxt.txtKodePertanyaan.getString().length()==0){ GETtxt.txtPertanyaan.setString(""); }
} //======================================================= else if(item==GETtxt.txtKodeTujuan){ if(GETtxt.txtKodeTujuan.getString().length()>=4){ GETtxt.txtidentTujuan.setString("Loading.."); String HasilCari = Mchek.getCheck(GTurl.urlCariDataTarget, GETtxt.txtKodeTujuan.getString().toUpperCase(), null, "CariTarget", "GET"); if(HasilCari.equals("kosong")){ GTalert.alttxtKosong.setString("Kode yang anda masukan tidak ditemukan..!!"); dispTarget.setCurrent(GTalert.alttxtKosong);
256
GETtxt.txtidentTujuan.setString(""); } else{ GETtxt.txtidentTujuan.setString(HasilCari); }
} else if(GETtxt.txtKodeTujuan.getString().length()==0){ GETtxt.txtidentTujuan.setString(""); }
} }
}