📄 layerlistui.java
字号:
/*
* $Id: LayerListUI.java 257 2008-07-17 11:56:07Z khanh.lnq $
* $URL: https://jvnmobilegis.googlecode.com/svn/trunk/src/org/javavietnam/gis/client/midp/ui/LayerListUI.java $
* $Author: khanh.lnq $
* $Revision: 257 $
* $Date: 2008-07-17 18:56:07 +0700 (Thu, 17 Jul 2008) $
*
* ====================================================================
*
* Copyright (C) 2006-2007 by JVNGIS
*
* All copyright notices regarding JVNMobileGIS MUST remain
* intact in the Java codes and resource files.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Support can be obtained from project homepage at:
* http://code.google.com/p/jvnmobilegis/
*
* Correspondence and Marketing Questions can be sent to:
* khanh.lnq AT gmail.com
*
* @version: 1.0
* @author: Khanh Le
* @Date Created: 22 Jun 2007
*/
package org.javavietnam.gis.client.midp.ui;
import java.util.Vector;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.Ticker;
import org.javavietnam.gis.shared.midp.model.LayerInformation;
import org.javavietnam.gis.shared.midp.model.TreeNode;
/**
* @author khanhlnq
*/
class LayerListUI extends List implements CommandListener {
private final UIController uiController;
private final Command backCommand;
// private final Command getMapCommand;
private final Command nextCommand;
private Ticker ticker;
/**
* @uml.property name="layerList"
*/
private Vector layerList;
public LayerListUI(UIController uiController) {
super(uiController.getString(UIConstants.LAYER_LIST_TITLE),
Choice.MULTIPLE);
ticker = new Ticker(uiController
.getString(UIConstants.LAYER_LIST_TICKER));
setTicker(ticker);
this.uiController = uiController;
setLayerList(new Vector());
backCommand = new Command(uiController.getString(UIConstants.BACK),
Command.BACK, 5);
// getMapCommand = new
// Command(uiController.getString(UIConstants.GETMAP), Command.SCREEN,
// 0);
nextCommand = new Command(uiController.getString(UIConstants.NEXT),
Command.SCREEN, 0);
addCommand(backCommand);
// addCommand(getMapCommand);
addCommand(nextCommand);
// uiController.setCommands(this);
setCommandListener(this);
}
public void init(Vector treeNode) {
deleteAll();
setTitle(treeNode + "");
layerList.removeAllElements();
for (int i = 0; i < treeNode.size(); i++) {
Object nodeElement = treeNode.elementAt(i);
LayerInformation layerInfo = ((TreeNode) nodeElement)
.getLayerInformation();
layerList.addElement(layerInfo);
append(layerInfo.getField("title"), null);
}
}
public void commandAction(Command command, Displayable displayable) {
if (command == backCommand) {
uiController.mapServerRequested();
// } else if (command == getMapCommand) {
// uiController.getMapRequested();
} else if (command == nextCommand) {
uiController.sortLayerListRequested();
// } else {
// uiController.commandAction(command, displayable);
}
}
/**
* @return Returns the layerList.
* @uml.property name="layerList"
*/
public Vector getLayerList() {
return layerList;
}
/**
* @param layerList
* The layerList to set.
* @uml.property name="layerList"
*/
private void setLayerList(Vector layerList) {
this.layerList = layerList;
}
public Vector getSelectedLayerList() {
boolean[] layerFlags;
layerFlags = new boolean[size()];
Vector selectLayerList = new Vector();
getSelectedFlags(layerFlags);
for (int i = 0; i < layerList.size(); i++) {
if (layerFlags[i]) {
LayerInformation layerInfo = (LayerInformation) layerList
.elementAt(i);
selectLayerList.addElement(layerInfo);
}
}
return selectLayerList;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -