📄 uicontroller.java
字号:
}
public SearchFeatureResultUI getSearchFeatureResultUI() {
if (searchFeatureResultUI == null) {
searchFeatureResultUI = new SearchFeatureResultUI(this);
}
return searchFeatureResultUI;
}
public LayerSelectUI getLayerSelectUI() {
if (layerSelectUI == null) {
layerSelectUI = new LayerSelectUI(this);
}
return layerSelectUI;
}
public FeatureInfoUI getFeatureInfoUI() {
if (featureInfoUI == null) {
featureInfoUI = new FeatureInfoUI(this);
}
return featureInfoUI;
}
public HelpUI getHelpUI() {
if (helpUI == null) {
if (getMapViewUI().hasPointerEvents()
&& getMapViewUI().hasPointerMotionEvents()) {
helpUI = new HelpUI(this, true);
} else {
helpUI = new HelpUI(this, false);
}
}
return helpUI;
}
public LayerListUI getLayerListUI() {
if (layerListUI == null) {
layerListUI = new LayerListUI(this);
}
return layerListUI;
}
public void setLayerListUI(LayerListUI layerListUI) {
this.layerListUI = layerListUI;
}
public SortLayerListUI getSortLayerListUI() {
if (sortLayerListUI == null) {
sortLayerListUI = new SortLayerListUI(this);
}
return sortLayerListUI;
}
public void setSortLayerListUI(SortLayerListUI sortLayerListUI) {
this.sortLayerListUI = sortLayerListUI;
}
/**
* @return the selectedLayerList
*/
public Vector getSelectedLayerList() {
return getLayerListUI().getSelectedLayerList();
}
public ProgressObserverUI getProgressObserverUI() {
if (progressObserverUI == null) {
progressObserverUI = new ProgressObserverUI(this);
}
return progressObserverUI;
}
public PromptDialog getPromptDialog() {
if (promptDialog == null) {
promptDialog = new PromptDialog(this);
}
return promptDialog;
}
public ConfirmDialogUI getConfirmDialogUI() {
if (confirmDialogUI == null) {
confirmDialogUI = new ConfirmDialogUI(this);
}
return confirmDialogUI;
}
/**
* @return the fileSystemBrowserUI
*/
public FileSystemBrowserUI getFileSystemBrowserUI() {
if (fileSystemBrowserUI == null) {
fileSystemBrowserUI = new FileSystemBrowserUI(this);
}
return fileSystemBrowserUI;
}
/**
* @return the fileSystemCreatorUI
*/
public FileSystemCreatorUI getFileSystemCreatorUI() {
if (fileSystemCreatorUI == null) {
fileSystemCreatorUI = new FileSystemCreatorUI(this);
}
return fileSystemCreatorUI;
}
public void commandAction(Command command, Displayable displayable) {
if (command == mainMenuCommand) {
mainMenuRequested();
} else if (command == aboutCommand) {
aboutRequested();
} else if (command == exitCommand) {
exitRequested();
}
}
public void showErrorAlert(Exception e) {
showErrorAlert(new ApplicationException(e), getMainMenuUI());
}
public void showErrorAlert(ApplicationException ae, Displayable d) {
showErrorAlert(ae.getMessage(), d);
}
public void showErrorAlert(String message) {
showErrorAlert(message, display.getCurrent());
}
public void showErrorAlert(String message, Displayable d) {
Alert alert = new Alert(getString(UIConstants.ERROR));
alert.setImage(getImage(UIConstants.ICON_ERROR));
alert.setType(AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
alert.setString(message);
display.setCurrent(alert, d);
}
public void showInfoAlert(String message, Displayable d) {
showInfoAlert(null, message, d);
}
public void showInfoAlert(String title, String message, Displayable d) {
Alert alert = new Alert(
(title == null) ? getString(UIConstants.MOBILEGIS_CLIENT)
: title);
alert.setImage(getImage(UIConstants.ICON_INFO));
alert.setType(AlertType.INFO);
alert.setTimeout(Alert.FOREVER);
alert.setString(message);
display.setCurrent(alert, d);
}
private void runWithProgress(Thread thread, String title, boolean stoppable) {
// currentThread = (EventDispatcher)thread;
if (thread instanceof EventDispatcher) {
currentFallBackUI = ((EventDispatcher) thread).fallbackUI;
}
getProgressObserverUI().init(title, stoppable);
getDisplay().setCurrent(getProgressObserverUI());
thread.start();
}
private void runWithoutProgress(Thread thread) {
if (thread instanceof EventDispatcher) {
currentFallBackUI = ((EventDispatcher) thread).fallbackUI;
}
thread.start();
}
/**
* Try to stop all threads
*/
public void stopRequested() {
// if (currentThread.isAlive()) {
// how to kill a Thread?
// }
display.setCurrent(getCurrentFallBackUI());
}
public void mainMenuRequested() {
display.setCurrent(getMainMenuUI());
}
public void aboutRequested() {
try {
showInfoAlert(
getString(UIConstants.ABOUT),
getString(UIConstants.MOBILEGIS_CLIENT)
+ " version "
+ (null == midlet
.getAppProperty(JVNMobileGISMIDlet.PROPERTY_MIDLET_VERSION) ? ""
: midlet
.getAppProperty(JVNMobileGISMIDlet.PROPERTY_MIDLET_VERSION))
+ " \n" + getString(UIConstants.COPYRIGHT) + " \n"
+ getString(UIConstants.DOWNLOADED_DATA_SIZE)
+ ": " + model.getDownloadedDataSize(), display
.getCurrent());
} catch (ApplicationException ae) {
}
}
public void preferencesUIRequested() {
try {
getPreferencesUI().init(model.getPreferences());
} catch (ApplicationException e) {
e.printStackTrace();
showErrorAlert(getString(UIConstants.UNKNOWN_ERROR) + ":\n"
+ e.getMessage());
}
display.setCurrent(getPreferencesUI());
}
public void savePreferencesRequested() {
try {
Preferences preferences = model.getPreferences();
switch (getPreferencesUI().getSelectedLanguage()) {
case 0:
preferences.setDefaultLocale("en-US");
break;
case 1:
preferences.setDefaultLocale("vi");
break;
case 2:
preferences.setDefaultLocale("nl-NL");
default:
break;
}
preferences.setWmsServerURL(getPreferencesUI().getServerURL());
preferences.setWebGISURL(getPreferencesUI().getWebGISURL());
// preferences.setFindPathLayer(preferencesUI.getFindPathLayer());
model.setPreferences(preferences);
// apply new language and reload
if (!model.getLocale().equals(preferences.getDefaultLocale())) {
// reload when the locale changed
model.setLocale(preferences.getDefaultLocale());
init();
} else {
// just return to main menu
mainMenuRequested();
}
} catch (ApplicationException e) {
e.printStackTrace();
showErrorAlert(getString(UIConstants.UNKNOWN_ERROR) + ":\n"
+ e.getMessage());
}
}
public void checkUpdateRequested() {
runWithProgress(new EventDispatcher(EventIds.EVENT_ID_CHECKUPDATE,
getMainMenuUI()), getString(UIConstants.PROCESSING), true);
}
public void mapServerRequested() {
try {
getMapServerUI().setServerURL(
model.getPreferences().getWmsServerURL());
} catch (ApplicationException e) {
e.printStackTrace();
showErrorAlert(getString(UIConstants.UNKNOWN_ERROR) + ":\n"
+ e.getMessage());
}
display.setCurrent(getMapServerUI());
}
public void layerListRequested() {
display.setCurrent(getLayerListUI());
}
public void sortLayerListRequested() {
try {
getSortLayerListUI().init(this.getSelectedLayerList());
display.setCurrent(sortLayerListUI);
} catch (ApplicationException ae) {
showErrorAlert(ae.getMessage(), layerListUI);
}
}
public void backToSortLayerListUI() {
display.setCurrent(sortLayerListUI);
}
public void viewMapRequested() {
display.setCurrent(getMapViewUI());
// mapViewUI.repaint();
}
/*
* public void findPathResultRequested() { display.setCurrent(findPathUI); }
*/
public void lbsInfoRequested() {
display.setCurrent(getLBSMainForm());
}
public void helpRequested() {
display.setCurrent(getHelpUI());
}
public void getMapRequested() {
runWithProgress(new EventDispatcher(EventIds.EVENT_ID_GETMAPWMS,
getLayerListUI()), getString(UIConstants.PROCESSING), true);
}
public void getFeatureInfoRequested() {
runWithProgress(new EventDispatcher(EventIds.EVENT_ID_GETFEATUREINFO,
getMapViewUI()), getString(UIConstants.PROCESSING), true);
}
public void selectInfoLayerRequested() {
if (getLayerSelectUI().isAskNextTime()) {
display.setCurrent(getLayerSelectUI());
} else {
getFeatureInfoRequested();
}
}
/*
* public void findPathRequested() { runWithProgress(new
* EventDispatcher(EventIds.EVENT_ID_FINDPATHWMS, mapViewUI),
* getString(UIConstants.PROCESSING), true); }
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -