symplik.flower
Class ConsoleDirectoryBrowser
java.lang.Object
symplik.flower.ConsoleDirectoryBrowser
public class ConsoleDirectoryBrowser
- extends java.lang.Object
Directory Browser running in Console mode
This class can be used in any program which requires text-based operation of
selecting a directory.
ConsoleDirectoryBrowser cdb = new ConsoleDirectoryBrowser();
cdb.setDirPerPage(10); // how many directories will be shown in each page
cdb.setShowExit(false); // add an option [X] Exit
String dir = cdb.selectDirectory();
The default directory is "user.dir" for the first time it is invoked.
The last directory selected will be saved as system property
symplik.flower.ConsoleDirectoryBrowser.currentDirectory
.
Any new instance will use this value again when it starts.
So, in order to set the default directory, you need to
System.setProperty(ConsoleDirectoryBrowser.CURR_DIR, [you dir]);
- Version:
- $Revision: 2 $
- Author:
- $Author: Christopher Ho $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CURR_DIR
public static final java.lang.String CURR_DIR
- See Also:
- Constant Field Values
DIR_ROOT
private static final java.lang.String DIR_ROOT
- See Also:
- Constant Field Values
ACTION_LAST_PAGE
private static final java.lang.String ACTION_LAST_PAGE
- See Also:
- Constant Field Values
ACTION_NEXT_PAGE
private static final java.lang.String ACTION_NEXT_PAGE
- See Also:
- Constant Field Values
ACTION_UP_DIR
private static final java.lang.String ACTION_UP_DIR
- See Also:
- Constant Field Values
ACTION_DOWN_DIR
private static final java.lang.String ACTION_DOWN_DIR
- See Also:
- Constant Field Values
ACTION_SELECT_DIR
private static final java.lang.String ACTION_SELECT_DIR
- See Also:
- Constant Field Values
ACTION_EXIT
private static final java.lang.String ACTION_EXIT
- See Also:
- Constant Field Values
answerKey
private java.util.ArrayList<java.lang.String> answerKey
action
private java.lang.String action
pageNo
private int pageNo
dirPerPage
private int dirPerPage
showExit
private boolean showExit
ConsoleDirectoryBrowser
public ConsoleDirectoryBrowser()
main
public static void main(java.lang.String[] args)
selectDirectory
public java.lang.String selectDirectory()
browser
private java.lang.String browser()
showQuestion
private void showQuestion()
showChoices
private void showChoices()
response
private java.lang.String response()
downDir
private void downDir(java.lang.String dir)
upDir
private void upDir()
getCurrDir
private java.lang.String getCurrDir()
getPageNo
private int getPageNo()
nextPage
private void nextPage()
lastPage
private void lastPage()
setShowExit
public void setShowExit(boolean showExit)
isShowExit
public boolean isShowExit()
setDirPerPage
public void setDirPerPage(int dirPerPage)
getDirPerPage
public int getDirPerPage()
Copyright © 2010 Symplik Tech. Co. Ltd. All Rights Reserved.