📄 postlist.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: PostList.java
package com.modofo.mofire;
import java.util.Vector;
import javax.microedition.lcdui.*;
// Referenced classes of package com.modofo.mofire:
// MoFire, Post, EditForm, MoFireMgr
public class PostList extends List
implements CommandListener
{
private Vector posts;
private Command editCmd;
private Command deleteCmd;
private Command backCmd;
private Command newCmd;
private Post selectedPost;
public PostList()
{
super("Posts", 1);
editCmd = new Command("Edit", 4, 2);
newCmd = new Command("New", 4, 3);
backCmd = new Command("Back", 2, 1);
deleteCmd = new Command("Delete", 2, 1);
addCommand(editCmd);
addCommand(newCmd);
addCommand(backCmd);
addCommand(deleteCmd);
setCommandListener(this);
}
public void commandAction(Command arg0, Displayable arg1)
{
if (arg0 == editCmd)
doEditCmd();
else
if (arg0 == deleteCmd)
doDeleteCmd();
else
if (arg0 == backCmd)
doBackCmd();
else
if (arg0 == newCmd)
doNewCmd();
}
private void doNewCmd()
{
EditForm ef = MoFire.getInstance().getEditForm();
ef.setPost(new Post());
MoFire.getInstance().setCurrent(ef);
}
private void doBackCmd()
{
EditForm ef = MoFire.getInstance().getEditForm();
MoFire.getInstance().setCurrent(ef);
}
private void doEditCmd()
{
EditForm ef = MoFire.getInstance().getEditForm();
selectedPost = (Post)posts.elementAt(getSelectedIndex());
ef.setPost(selectedPost);
MoFire.getInstance().setCurrent(ef);
}
void doDeleteCmd()
{
selectedPost = (Post)posts.elementAt(getSelectedIndex());
try
{
MoFire.getInstance().getMgr().delPost(selectedPost.getId());
}
catch (Exception e)
{
e.printStackTrace();
}
}
public Vector getPosts()
{
return posts;
}
public void setPosts(Vector posts)
{
this.posts = posts;
if (this.posts == null)
return;
deleteAll();
for (int i = 0; i < posts.size(); i++)
{
Post p = (Post)posts.elementAt(i);
append(p.getTitle(), null);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -