org.ChinaVO.FITSManager.FListViewOperator
Class FListViewOperator

java.lang.Object
  extended by org.ChinaVO.FITSManager.FListViewOperator.FListViewOperator
All Implemented Interfaces:
FListViewDataRequestInterface

public class FListViewOperator
extends java.lang.Object
implements FListViewDataRequestInterface

A utility class, help programmer using the FListView.
In FListViewOperator, FListView's items all suppose to be File object.
FListViewOperator use a Singleton design pattern, in this application there will be only one FListViewOperator instance exists.
Examples:
Global.getFListViewOperator().loadData(filelist);

If someone want to listen to FListViewOpeator's events he/she should extens the FListViewOperateListener.
And call Global.getFListViewOperator().addFListViewOperatListener( yourListener) to listen to the event.

If someone want to contribute his/her Icons to FListView he/she should extends the FListViewGetIconListener.
And call Global.getFListViewOperator().setIconCreator(yourListener) to set the Icon creator.

Version:
v1.0.0 2009-11-16 14:44:54
Author:
Fany

Constructor Summary
FListViewOperator()
          Constructor.
 
Method Summary
 void activeDoubleClick(java.io.File f)
          Active double click event.
 void addFListViewOperatListener(FListViewOperateListener l)
          add a new FListViewOperateListener.
 void clearData()
           
 FListViewItemCell getCellValue(int row, int col)
          Provide the information in detail view.
The information should be construct in a FListViewItemCell instance.
 java.util.List<java.io.File> getFiles()
          Get the files showing in FListView.
 FListView getFListView()
          Get the FListView instance which is used by FListViewOperator.
 javax.swing.Icon getIcon(int mIconType, int i)
          Provide a Icon.
 FListViewPopupMenu getPopupMenu()
          Get FListViewOperator's popupmenu.
 java.io.File getSelectedFile()
          Get the file which is selected in FListView.
 java.io.File[] getSelectedFiles()
          Get selected files in FListView.
 int getViewType()
          Get current view type of FListView.
 void insertIntoPopupMenu(java.awt.Component c)
          insert a new component into FListViewOperator's Popupmenu.
 boolean isFilesSelected()
          Check if any file selected in FListView.
 void loadData(java.util.List<java.io.File> list)
          Clear the items in FListView and load these new files.
 void refresh()
          Refresh the FListView.
FListViewOperator do nothing at here, just announce FListViewOperateListeners the Refresh event occur.
 void reLoadData(boolean isReSort)
           
 void removeFListViewOperateListener(FListViewOperateListener l)
          remove a FListViewOperateListener.
 void setIconCreator(FListViewGetIconListener l)
          Set the Icon creator for items in FListView.
There will only exists one icon creator in these application.
 void setRefreshListener(FListViewRefreshListener l)
           
 void setView(int viewType)
          Change the view type of FListView.
 void sortList(int type)
           
 void viewFileProperty()
          Show the FileProperty dialog.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FListViewOperator

public FListViewOperator()
Constructor.

Method Detail

getFiles

public java.util.List<java.io.File> getFiles()
Get the files showing in FListView.

Returns:
list of files.

reLoadData

public void reLoadData(boolean isReSort)
Specified by:
reLoadData in interface FListViewDataRequestInterface

addFListViewOperatListener

public void addFListViewOperatListener(FListViewOperateListener l)
add a new FListViewOperateListener.

Parameters:
l - a FListViewOperateListener

removeFListViewOperateListener

public void removeFListViewOperateListener(FListViewOperateListener l)
remove a FListViewOperateListener.

Parameters:
l - a FListViewOperateListener;

setRefreshListener

public void setRefreshListener(FListViewRefreshListener l)

activeDoubleClick

public void activeDoubleClick(java.io.File f)
Active double click event.

Parameters:
f - a file which is selected.

getFListView

public FListView getFListView()
Get the FListView instance which is used by FListViewOperator.

Returns:
a instance of FListView.

getCellValue

public FListViewItemCell getCellValue(int row,
                                      int col)
Description copied from interface: FListViewDataRequestInterface
Provide the information in detail view.
The information should be construct in a FListViewItemCell instance.

Specified by:
getCellValue in interface FListViewDataRequestInterface
Parameters:
row - row position in detail view.
col - column position in detail view.
Returns:
a FListViewItemCell instance.

getIcon

public javax.swing.Icon getIcon(int mIconType,
                                int i)
Description copied from interface: FListViewDataRequestInterface
Provide a Icon.

Specified by:
getIcon in interface FListViewDataRequestInterface
Parameters:
mIconType - type of icon.
FCommonList.BIGICON=1 Big Icon
FCommonList.NormalICON=2 Normal Icon
FCommonList.SMALLICON=3 Small Icon
FCommonList.THUMBNAIL=4 Thumbnails
i - index of the item, which needs an icon.
Returns:
a Icon instance.

setIconCreator

public void setIconCreator(FListViewGetIconListener l)
Set the Icon creator for items in FListView.
There will only exists one icon creator in these application.

Parameters:
l - a instance of FListViewGetIconListener.

clearData

public void clearData()

loadData

public void loadData(java.util.List<java.io.File> list)
Clear the items in FListView and load these new files.

Parameters:
list - a list of file.

sortList

public void sortList(int type)

setView

public void setView(int viewType)
Change the view type of FListView. And record the setting in global setting map.

Parameters:
viewType - type of view in FListView.
FListView.VIEWDETAILS=1 details view
FListView.VIEWLIST=2 list view
FListView.VIEWICONS=3 icons view
FListView.VIEWTILES=4 tiles view
FListView.VIEWTHUMBNAILS=5 thumbnails view

getPopupMenu

public FListViewPopupMenu getPopupMenu()
Get FListViewOperator's popupmenu.

Returns:
instance of popupmenu.

insertIntoPopupMenu

public void insertIntoPopupMenu(java.awt.Component c)
insert a new component into FListViewOperator's Popupmenu.

Parameters:
c - component you want to insert.

getViewType

public int getViewType()
Get current view type of FListView.

Returns:
FListView.VIEWDETAILS or FListView.VIEWLIST or FListView.VIEWICONS or FListView.VIEWTILES or FListView.VIEWTHUMBNAILS

getSelectedFile

public java.io.File getSelectedFile()
Get the file which is selected in FListView. When multiple items are selected, it is simply the smallest selected index file. Returns null if there is no selection.

Returns:
list of files.

isFilesSelected

public boolean isFilesSelected()
Check if any file selected in FListView.

Returns:
if one or more files are selected return true, else return false.

getSelectedFiles

public java.io.File[] getSelectedFiles()
Get selected files in FListView.

Returns:
file array.

viewFileProperty

public void viewFileProperty()
Show the FileProperty dialog.


refresh

public void refresh()
Refresh the FListView.
FListViewOperator do nothing at here, just announce FListViewOperateListeners the Refresh event occur.