|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--com.japisoft.resourcebrowser.ResourceBrowserPanel
This is the main panel for selected or acting on a remote resource. This
panel works with a ResourceManager
which is the delegate for
managing a set of resources. This delegate provides connection, listing and
actions. For sample the user can have a delegate for FTP, WebDAV or
ZIP/JAR resource.
Sample of usage :
JFrame frame = new JFrame(); frame.getContentPane().add( new ResourceBrowserPanel(new FTPBrowser()) );
For initializing/getting the user interface state, the State
object is available through the setState
and the
getState
methods. This state is "serializable"
meaning, the user can store/read it with a java.io.ObjectOutputStream
or a
java.io.ObjectInputStream
.
Sample of usage
dialog = new JDialog(); dialog.setTitle( "FTP Editor " ); // We initialize a default FTP server and user account State state = new State(); state.putValue( State.HOST_KEY, "MyHost" ); state.putValue( State.USER_KEY, "MyUserName" ); state.putValue( State.PASSWORD_KEY, "MyPassword" ); dialog.getContentPane().add( browser = new FTPBrowser( state ) );
ResourceManager
,
State
,
Serialized FormField Summary | |
static int |
DIRECTORY_SELECTION_MODE
|
static int |
FILE_DIRECTORY_SELECTION_MODE
|
static int |
FILE_SELECTION_MODE
|
Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
ResourceBrowserPanel(ResourceManager manager)
|
|
ResourceBrowserPanel(ResourceManager manager,
State state)
|
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Inner usage. |
void |
addNotify()
|
boolean |
connect()
Connect to a server or a resource container. |
void |
deleteFile()
Delete the selected file |
void |
disconnect()
Close the current conection |
ActionModel |
getActionModel()
|
ResourceManager |
getResourceManager()
|
byte[] |
getSelectedContentFile(boolean autoDisconnect)
|
java.lang.String |
getSelectedPathFile()
|
ResourceItem |
getSelectedResource()
|
int |
getSelectionMode()
|
State |
getState()
|
void |
lockUnlockFile()
Lock or unlock the selected file |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
newFile()
Create a new file |
void |
removeNotify()
|
void |
renameFile()
Rename the selected file |
void |
setFileResourceView(FileResourceView view)
This is a UI delegate for displaying a file while browsing |
boolean |
setSelectedContentFile(byte[] content,
boolean autoDisconnect)
Reset the content of the selected file |
void |
setSelectionMode(int selectionMode)
Reset the selection mode. |
void |
setState(State state)
Reset the state for the UI part |
void |
valueChanged(javax.swing.event.ListSelectionEvent e)
For inner usage. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FILE_SELECTION_MODE
public static final int DIRECTORY_SELECTION_MODE
public static final int FILE_DIRECTORY_SELECTION_MODE
Constructor Detail |
public ResourceBrowserPanel(ResourceManager manager)
manager
- The manager of a dedicated resource container/protocol like
FTP..public ResourceBrowserPanel(ResourceManager manager, State state)
manager
- The manager of a dedicated resource container/protocol like
FTP...state
- The state of the User interface like the host name...Method Detail |
public void setState(State state)
public State getState()
public ActionModel getActionModel()
public void setSelectionMode(int selectionMode)
selectionMode
- public int getSelectionMode()
public void setFileResourceView(FileResourceView view)
public void addNotify()
addNotify
in class javax.swing.JComponent
public void removeNotify()
removeNotify
in class javax.swing.JComponent
public ResourceManager getResourceManager()
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public ResourceItem getSelectedResource()
public java.lang.String getSelectedPathFile()
public boolean setSelectedContentFile(byte[] content, boolean autoDisconnect)
content
- A file contentautoDisconnect
- if true
, the connection will be closed at the
end of the method
false
if the operation is not possiblepublic byte[] getSelectedContentFile(boolean autoDisconnect)
autoDisconnect
- if true
the connection will be closed at the
end of the method
null
if the
operation is not possible or if there's no selected filepublic void newFile()
public void deleteFile()
public void renameFile()
public void lockUnlockFile()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged
in interface javax.swing.event.ListSelectionListener
public boolean connect()
false
if the connection cannot be establishedpublic void disconnect()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |