⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browsetask.java

📁 j2me mobile application for upload file to server.
💻 JAVA
字号:
/**
 * 
 */
package org.celllife.clforms.task;

import java.io.IOException;
import java.util.Enumeration;

import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.io.file.FileSystemRegistry;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;

import org.celllife.clforms.FileBrowser;

import de.enough.polish.util.Locale;

/**
 * @author Simon
 *
 */
public class BrowseTask extends BackgroundTask {

	private String currDirName;

	/**
	 * @param d
	 */
	public BrowseTask(String currDirName, Display d) {
		super(d);
		// TODO Auto-generated constructor stub
		this.currDirName = currDirName;
		//#debug debug
		d.getCurrent().getTitle();
		prevScreen = d.getCurrent();
	}

	/* (non-Javadoc)
	 * @see org.celllife.clforms.thread.BackgroundTask#runTask()
	 */
	public void runTask() throws Exception {
		Enumeration e;
		FileConnection currDir = null;
		try {
			if (FileBrowser.MEGA_ROOT.equals(currDirName)) {				
				e = FileSystemRegistry.listRoots();
			} else {
				currDir = (FileConnection) Connector.open(FileBrowser.SERVER_URL
						+ currDirName);
				e = currDir.list();
			}

			if (currDir != null) {
				currDir.close();
			}
			nextScreen = (new FileBrowser(e)).prepareScreen();
		} catch (IOException ioe) {
			String s = "Can not access directroy '" + currDirName + "'";

			if ((ioe.getMessage() != null) && (ioe.getMessage().length() > 0)) {
				s += ("\n" + ioe);
			}

			needAlert = true;
			alertScreen = new Alert(Locale.get("error"));
			alertScreen.setType(AlertType.ERROR);
			alertScreen.setString(s);
			alertScreen.setTimeout(Alert.FOREVER);
			nextScreen = prevScreen;
		} 

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -