org.zaval.lw
Class LwFilePanel
java.lang.Object
|
+--org.zaval.lw.LwCanvas
|
+--org.zaval.lw.LwPanel
|
+--org.zaval.lw.LwFilePanel
- All Implemented Interfaces:
- java.util.EventListener, Layoutable, LayoutContainer, LwActionListener, LwChildrenListener, LwComponent, LwContainer, Validationable
- public class LwFilePanel
- extends LwPanel
- implements LwActionListener, LwChildrenListener
This panel provides ability to select a file in the files tree hierarchy.
Register an action listener to be notified whenever a selected file has been changed.
The panel reads fields titles as the following LwVCL resources:
| fld.path | path field title |
| fld.mask | mask combo box title |
| fld.file | file field title |
| Fields inherited from class org.zaval.lw.LwCanvas |
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y |
|
Constructor Summary |
LwFilePanel(java.lang.String root)
Constructs the file panel with the specified root directory. |
LwFilePanel(java.lang.String root,
java.lang.String[][] ext)
Constructs the file panel with the specified root directory and the given file mask. |
| Methods inherited from class org.zaval.lw.LwPanel |
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, getPreferredSize, indexOf, insert, insert, invalidate, isInvalidatedByChild, laidout, paintOnTop, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate |
| Methods inherited from class org.zaval.lw.LwCanvas |
calcInsets, canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwParent, getOrigin, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isValid, isVisible, paint, recalc, repaint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setViewMan, setVisible, update, viewManChanged, vrp |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.zaval.lw.LwComponent |
canHaveFocus, getBackground, getLwParent, getOrigin, getViewMan, getVisiblePart, isEnabled, isOpaque, paint, repaint, repaint, repaint, setEnabled, setInsets, setLwParent, setViewMan, setVisible, update |
LwFilePanel
public LwFilePanel(java.lang.String root)
- Constructs the file panel with the specified root directory. The constructor
setups a filter to list all available files and directories.
- Parameters:
root - the specified root directory. The directory tree will be created
relatively the root directory.
LwFilePanel
public LwFilePanel(java.lang.String root,
java.lang.String[][] ext)
- Constructs the file panel with the specified root directory and the given file mask.
- Parameters:
root - the specified root directory. The directory tree will be created
relatively the root directory.ext - the file filter. The filter is a two-dimensional array
where the first element corresponds to the extension filter title and the second
element specifies a file extension filter.
getFileTree
public LwTree getFileTree()
- Gets the tree component that represents the file tree.
- Returns:
- a tree component.
getSelectedFile
public java.io.File getSelectedFile()
- Gets the selected file.
- Returns:
- a selected file.
lookup
public java.io.File lookup(java.lang.String path)
- Search a file by the specified path.
- Parameters:
path - the specified file path.- Returns:
- a file if it has been found, otherwise the method returns
null.
addActionListener
public void addActionListener(LwActionListener l)
- Adds the action listener to get events whenever a new file has been selected.
- Parameters:
l - the specified action listener.
removeActionListener
public void removeActionListener(LwActionListener l)
- Removes the action listener.
- Parameters:
l - the specified action listener.
childPerformed
public void childPerformed(LwVCLEvent e)
- Description copied from interface:
LwChildrenListener
- Invoked whenever the child event has been performed.
- Specified by:
childPerformed in interface LwChildrenListener
- Following copied from interface:
org.zaval.lw.event.LwChildrenListener
- Parameters:
e - the child event.
actionPerformed
public void actionPerformed(java.lang.Object target,
java.lang.Object data)
- Description copied from interface:
LwActionListener
- Invoked when an action event occurred.
- Specified by:
actionPerformed in interface LwActionListener
- Following copied from interface:
org.zaval.lw.event.LwActionListener
- Parameters:
src - the specified source where the event has been originated.data - the event data.
getDefaultLayout
protected LwLayout getDefaultLayout()
- Description copied from class:
LwPanel
- Gets the default layout manager that is set with the container during initialization.
This implementation of the method returns LwRastLayout as the default layout manager, the
layout manager is got as a static object by "def.lay" key.
- Overrides:
getDefaultLayout in class LwPanel
- Following copied from class:
org.zaval.lw.LwPanel
- Returns:
- a layout manager.
createTreeModel
public static TreeModel createTreeModel(java.lang.String root,
java.io.FilenameFilter f)
- Creates and returns the tree model basing on the specified root directory and the given file filter.
- Parameters:
root - the specified root directory.f - the specified file filter.- Returns:
- a tree model that represents the a hierarchy of the files.
|