Ontimize Document Management 0.032EN

com.ontimize.dms.client.gui.viewer.component
Class DefaultViewerComponent

java.lang.Object
  extended by IdentifiedAbstractFormComponent
      extended by com.ontimize.dms.client.gui.viewer.component.DefaultViewerComponent
All Implemented Interfaces:
ContextValues, ComponentContext, java.awt.event.ActionListener, java.util.EventListener

public class DefaultViewerComponent
extends IdentifiedAbstractFormComponent
implements ComponentContext, java.awt.event.ActionListener

Image / Thumbnail viewer.

Since:
28/01/2010, 29/01/2010 Refresh internal viewer. Current name., 01/02/2010 Component creation refactoring. Improved design., 02/02/2010 Improved component layout., 03/02/2010 Filter query with document types. Create recursive query., 04/02/2010 Removed constraints. Set minimun size in viewer viewport. Open file on 2click., 11/02/2010 DnD to drop new files., 04/03/2010 Disable internal components form current Form Manager., 05/03/2010 New parameters: - controls: Shows or hides the current file name and the buttons. - editable: Enables or disables the open and add action. Set Document and image to view.

Field Summary
protected static java.awt.Font CONTROL_LABEL_FONT
           
protected static java.awt.Color CONTROLS_BOX_BG_COLOR
           
static java.lang.String CONTROLS_KEY
           
protected static java.awt.Color CONTROLS_LABEL_BG_COLOR
           
protected static java.awt.Color CONTROLS_LABEL_FG_COLOR
           
protected static java.awt.Dimension DEFAULT_CONTROL_DIMENSION
           
protected static java.awt.Dimension DEFAULT_CONTROL_LABEL_DIMENSION
           
protected static java.awt.Dimension DEFAULT_NAME_DIMENSION
           
protected static java.lang.String DEFAULT_PREVIEWER_CLASS
           
protected static java.util.List DEFAULT_TYPES
           
protected static java.awt.Dimension DEFAULT_VIEWER_DIMENSION
           
protected static java.awt.Dimension DEFAULT_VIEWER_VIEWPORT_DIMENSION
           
protected static java.lang.String END_ICON
           
protected static java.lang.String END_KEY
           
protected static java.lang.String FIRST_ICON
           
protected static java.lang.String FIRST_KEY
           
protected static int MAX_NAME_LENGTH
           
protected static java.lang.String MSG_ADD_CONFLICT
           
protected static java.lang.String MSG_ADD_DIR_DISABLED
           
protected static java.lang.String MSG_ADD_FILE_DISABLED
           
protected static java.lang.String MSG_ADD_LIST
           
protected static java.lang.String MSG_ADD_LIST_ERROR
           
protected static java.lang.String MSG_ADD_LIST_EXCEED
           
protected static java.lang.String MSG_ADD_LOCAL_CALL
           
protected static java.lang.String MSG_ADD_LOCAL_REFRESH
           
protected static java.lang.String MSG_ADD_REMOTE_CALL
           
protected static java.lang.String MSG_ADD_REMOTE_CALL_ERROR
           
protected static java.lang.String MSG_ADD_TITLE
           
protected static java.lang.String MSG_DIRECTORY_INVALID
           
protected static java.lang.String MSG_DIRECTORY_MSG
           
protected static java.lang.String MSG_DIRECTORY_TITLE
           
protected static java.lang.String MSG_DOWNLOAD_ERROR
           
protected static java.lang.String MSG_DOWNLOAD_VERSION_ERROR
           
protected static java.lang.String MSG_DOWNLOAD_VERSION_TEMP
           
protected static java.lang.String MSG_LINK_DIR
           
protected static java.lang.String MSG_LINK_EMPTY
           
protected static java.lang.String MSG_LINK_FILE
           
protected static java.lang.String MSG_LINK_MSG
           
protected static java.lang.String MSG_LINK_TITLE
           
protected static java.lang.String MSG_PASTE_SAME_TARGET
           
protected static java.lang.String MSG_PREVIEW_ERROR
           
protected static java.lang.String MSG_PROPERTY_RESERVED
           
protected static java.lang.String MSG_REMOVE_FILE_EMPTY
           
protected static java.lang.String MSG_SELECT
           
protected static java.lang.String MSG_SELECT_FILE
           
protected static java.awt.Color NAME_BOX_BG_COLOR
           
protected static java.awt.Color NAME_BOX_FG_COLOR
           
protected static java.awt.Font NAME_BOX_FONT
           
protected static java.lang.String NEXT_ICON
           
protected static java.lang.String NEXT_KEY
           
static java.lang.String PERMISSION_MESSAGE_ERROR
           
protected static java.lang.String PREV_ICON
           
protected static java.lang.String PREV_KEY
           
static java.lang.String RECURSIVE_KEY
           
protected static java.lang.String SEPARATOR_ICON
           
protected static java.lang.String TAG_DISABLED
           
protected static java.lang.String TAG_SEARCH
           
static java.lang.String TYPES_KEY
           
protected static java.awt.Color VIEWER_BOX_BG_COLOR_1
           
protected static java.awt.Color VIEWER_BOX_BORDER_COLOR
           
protected static java.awt.Color VIEWER_BOX_GB_COLOR_2
           
 
Constructor Summary
DefaultViewerComponent(java.util.Hashtable h)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
protected  void checkList(Document[] documents, java.util.Hashtable result)
           
protected  boolean checkResult(java.lang.String action, java.util.Hashtable result)
           
 void create()
           
protected  javax.swing.JButton createBeginingButton()
           
protected  javax.swing.JButton createButton(java.util.Hashtable params)
           
protected  javax.swing.JPanel createButtonsPanel()
           
 java.util.Map createContext()
           
 java.util.Map createContext(javax.swing.tree.TreePath path)
          Creates a Map with the information that needs server to execute operations.
protected  javax.swing.JButton createEndButton()
           
protected  javax.swing.JLabel createLabel(java.lang.String text)
           
protected  java.awt.event.MouseListener createMouseListener()
           
protected  javax.swing.JLabel createNamePanel()
           
protected  javax.swing.JButton createNextButton()
           
protected  javax.swing.JButton createPrevButton()
           
protected  java.awt.Component createPreview()
           
protected  RefreshEvent createRefreshEvent(Document current, java.util.Map data)
           
protected  javax.swing.TransferHandler createTransferHandler()
           
protected  java.awt.Component createVerticalBar()
           
 void deleteData()
           
 void doAdd(java.io.File[] files)
           
protected  java.lang.Object doOperation(int code, Document[] documents, java.util.Map params)
           
 int getAction()
           
 java.util.List getActions(ComponentSelection parent)
          Returns a list with all available actions.
 java.util.List getAllowedActions()
          Returns a list with the enabled actions.
 java.lang.Object getAttribute()
           
 java.lang.String getBase()
           
 InternalConfigModel getConfiguration()
           
 java.util.Hashtable getCurrentExtraFields()
           
 java.util.Hashtable getCurrentFields()
           
 java.util.Hashtable getCurrentKeys()
           
 java.util.Map getCurrentNode()
           
 Document getDocument(java.util.Map node)
           
 java.lang.String getEntity()
           
 java.util.List getExtraFields()
           
 java.util.List getFields()
           
 java.util.List getHiddenFields()
           
 java.util.List getKeys()
           
 java.lang.String getLabelComponentText()
           
 java.lang.String getName()
           
 java.util.List getParentFields()
           
 Document[] getSelectedDocument()
           
 TreeNode getSelectedLeaf()
           
 javax.swing.tree.TreePath getSelectedPath()
           
 int getSQLDataType()
           
 java.util.Properties getTableColumnRenderName()
           
 java.util.Properties getTableColumnRenderType()
           
 java.util.List getTypes()
           
 java.lang.Object getValue()
           
 java.util.List getVersionColumns()
           
 Document getWorkingDirectory()
           
 boolean hasControls()
           
 void init(java.util.Hashtable parameters)
           
 boolean isEditable()
           
 boolean isEmpty()
           
 boolean isFileNameGenerationEnabled()
           
 boolean isHidden()
           
 boolean isModifiable()
           
 boolean isModified()
           
 boolean isRecursive()
           
 boolean isRequired()
           
protected  void message(java.lang.String key, java.util.List l, java.lang.Object parameter)
           
protected  void putState(int state)
           
 void refresh()
           
 void setEnabled(boolean enabled)
           
 void setModifiable(boolean modifiable)
           
 void setRequired(boolean required)
           
 void setValue(Document document)
          Set model to viewer component.
 void setValue(Document document, BytesBlock image)
           
 void setValue(Document document, javax.swing.ImageIcon image)
           
 void setValue(java.lang.Object value)
           
protected  void showImage(java.util.Map node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPES_KEY

public static final java.lang.String TYPES_KEY
See Also:
Constant Field Values

RECURSIVE_KEY

public static final java.lang.String RECURSIVE_KEY
See Also:
Constant Field Values

CONTROLS_KEY

public static final java.lang.String CONTROLS_KEY
See Also:
Constant Field Values

FIRST_KEY

protected static final java.lang.String FIRST_KEY
See Also:
Constant Field Values

PREV_KEY

protected static final java.lang.String PREV_KEY
See Also:
Constant Field Values

NEXT_KEY

protected static final java.lang.String NEXT_KEY
See Also:
Constant Field Values

END_KEY

protected static final java.lang.String END_KEY
See Also:
Constant Field Values

FIRST_ICON

protected static final java.lang.String FIRST_ICON
See Also:
Constant Field Values

PREV_ICON

protected static final java.lang.String PREV_ICON
See Also:
Constant Field Values

NEXT_ICON

protected static final java.lang.String NEXT_ICON
See Also:
Constant Field Values

END_ICON

protected static final java.lang.String END_ICON
See Also:
Constant Field Values

SEPARATOR_ICON

protected static final java.lang.String SEPARATOR_ICON
See Also:
Constant Field Values

PERMISSION_MESSAGE_ERROR

public static final java.lang.String PERMISSION_MESSAGE_ERROR
See Also:
Constant Field Values

TAG_DISABLED

protected static final java.lang.String TAG_DISABLED
See Also:
Constant Field Values

TAG_SEARCH

protected static final java.lang.String TAG_SEARCH
See Also:
Constant Field Values

MSG_SELECT

protected static final java.lang.String MSG_SELECT
See Also:
Constant Field Values

MSG_SELECT_FILE

protected static final java.lang.String MSG_SELECT_FILE
See Also:
Constant Field Values

MSG_ADD_FILE_DISABLED

protected static final java.lang.String MSG_ADD_FILE_DISABLED
See Also:
Constant Field Values

MSG_ADD_DIR_DISABLED

protected static final java.lang.String MSG_ADD_DIR_DISABLED
See Also:
Constant Field Values

MSG_ADD_TITLE

protected static final java.lang.String MSG_ADD_TITLE
See Also:
Constant Field Values

MSG_ADD_LIST

protected static final java.lang.String MSG_ADD_LIST
See Also:
Constant Field Values

MSG_ADD_LIST_ERROR

protected static final java.lang.String MSG_ADD_LIST_ERROR
See Also:
Constant Field Values

MSG_ADD_LIST_EXCEED

protected static final java.lang.String MSG_ADD_LIST_EXCEED
See Also:
Constant Field Values

MSG_ADD_CONFLICT

protected static final java.lang.String MSG_ADD_CONFLICT
See Also:
Constant Field Values

MSG_ADD_REMOTE_CALL

protected static final java.lang.String MSG_ADD_REMOTE_CALL
See Also:
Constant Field Values

MSG_ADD_REMOTE_CALL_ERROR

protected static final java.lang.String MSG_ADD_REMOTE_CALL_ERROR
See Also:
Constant Field Values

MSG_ADD_LOCAL_CALL

protected static final java.lang.String MSG_ADD_LOCAL_CALL
See Also:
Constant Field Values

MSG_ADD_LOCAL_REFRESH

protected static final java.lang.String MSG_ADD_LOCAL_REFRESH
See Also:
Constant Field Values

MSG_LINK_DIR

protected static final java.lang.String MSG_LINK_DIR
See Also:
Constant Field Values

MSG_LINK_FILE

protected static final java.lang.String MSG_LINK_FILE
See Also:
Constant Field Values

MSG_LINK_TITLE

protected static final java.lang.String MSG_LINK_TITLE
See Also:
Constant Field Values

MSG_LINK_MSG

protected static final java.lang.String MSG_LINK_MSG
See Also:
Constant Field Values

MSG_LINK_EMPTY

protected static final java.lang.String MSG_LINK_EMPTY
See Also:
Constant Field Values

MSG_PROPERTY_RESERVED

protected static final java.lang.String MSG_PROPERTY_RESERVED
See Also:
Constant Field Values

MSG_DIRECTORY_TITLE

protected static final java.lang.String MSG_DIRECTORY_TITLE
See Also:
Constant Field Values

MSG_DIRECTORY_MSG

protected static final java.lang.String MSG_DIRECTORY_MSG
See Also:
Constant Field Values

MSG_DIRECTORY_INVALID

protected static final java.lang.String MSG_DIRECTORY_INVALID
See Also:
Constant Field Values

MSG_DOWNLOAD_ERROR

protected static final java.lang.String MSG_DOWNLOAD_ERROR
See Also:
Constant Field Values

MSG_DOWNLOAD_VERSION_TEMP

protected static final java.lang.String MSG_DOWNLOAD_VERSION_TEMP
See Also:
Constant Field Values

MSG_DOWNLOAD_VERSION_ERROR

protected static final java.lang.String MSG_DOWNLOAD_VERSION_ERROR
See Also:
Constant Field Values

MSG_REMOVE_FILE_EMPTY

protected static final java.lang.String MSG_REMOVE_FILE_EMPTY
See Also:
Constant Field Values

MSG_PASTE_SAME_TARGET

protected static final java.lang.String MSG_PASTE_SAME_TARGET
See Also:
Constant Field Values

MSG_PREVIEW_ERROR

protected static final java.lang.String MSG_PREVIEW_ERROR
See Also:
Constant Field Values

DEFAULT_PREVIEWER_CLASS

protected static final java.lang.String DEFAULT_PREVIEWER_CLASS
See Also:
Constant Field Values

DEFAULT_TYPES

protected static final java.util.List DEFAULT_TYPES

DEFAULT_VIEWER_DIMENSION

protected static final java.awt.Dimension DEFAULT_VIEWER_DIMENSION

DEFAULT_VIEWER_VIEWPORT_DIMENSION

protected static final java.awt.Dimension DEFAULT_VIEWER_VIEWPORT_DIMENSION

DEFAULT_NAME_DIMENSION

protected static final java.awt.Dimension DEFAULT_NAME_DIMENSION

DEFAULT_CONTROL_DIMENSION

protected static final java.awt.Dimension DEFAULT_CONTROL_DIMENSION

DEFAULT_CONTROL_LABEL_DIMENSION

protected static final java.awt.Dimension DEFAULT_CONTROL_LABEL_DIMENSION

NAME_BOX_FONT

protected static final java.awt.Font NAME_BOX_FONT

CONTROL_LABEL_FONT

protected static final java.awt.Font CONTROL_LABEL_FONT

VIEWER_BOX_BG_COLOR_1

protected static final java.awt.Color VIEWER_BOX_BG_COLOR_1

VIEWER_BOX_GB_COLOR_2

protected static final java.awt.Color VIEWER_BOX_GB_COLOR_2

VIEWER_BOX_BORDER_COLOR

protected static final java.awt.Color VIEWER_BOX_BORDER_COLOR

NAME_BOX_BG_COLOR

protected static final java.awt.Color NAME_BOX_BG_COLOR

NAME_BOX_FG_COLOR

protected static final java.awt.Color NAME_BOX_FG_COLOR

CONTROLS_BOX_BG_COLOR

protected static final java.awt.Color CONTROLS_BOX_BG_COLOR

CONTROLS_LABEL_BG_COLOR

protected static final java.awt.Color CONTROLS_LABEL_BG_COLOR

CONTROLS_LABEL_FG_COLOR

protected static final java.awt.Color CONTROLS_LABEL_FG_COLOR

MAX_NAME_LENGTH

protected static final int MAX_NAME_LENGTH
See Also:
Constant Field Values
Constructor Detail

DefaultViewerComponent

public DefaultViewerComponent(java.util.Hashtable h)
Method Detail

init

public void init(java.util.Hashtable parameters)

create

public void create()

getTableColumnRenderType

public java.util.Properties getTableColumnRenderType()

getTableColumnRenderName

public java.util.Properties getTableColumnRenderName()

createPreview

protected java.awt.Component createPreview()

createNamePanel

protected javax.swing.JLabel createNamePanel()

createButtonsPanel

protected javax.swing.JPanel createButtonsPanel()

createButton

protected javax.swing.JButton createButton(java.util.Hashtable params)

createBeginingButton

protected javax.swing.JButton createBeginingButton()

createPrevButton

protected javax.swing.JButton createPrevButton()

createNextButton

protected javax.swing.JButton createNextButton()

createEndButton

protected javax.swing.JButton createEndButton()

createVerticalBar

protected java.awt.Component createVerticalBar()

createLabel

protected javax.swing.JLabel createLabel(java.lang.String text)

createMouseListener

protected java.awt.event.MouseListener createMouseListener()

createTransferHandler

protected javax.swing.TransferHandler createTransferHandler()

getName

public java.lang.String getName()
Specified by:
getName in interface ComponentContext

getEntity

public java.lang.String getEntity()

getBase

public java.lang.String getBase()
Specified by:
getBase in interface ContextValues

getKeys

public java.util.List getKeys()
Specified by:
getKeys in interface ComponentContext

getFields

public java.util.List getFields()
Specified by:
getFields in interface ComponentContext

getTypes

public java.util.List getTypes()

isRecursive

public boolean isRecursive()

isEditable

public boolean isEditable()

hasControls

public boolean hasControls()

getAttribute

public java.lang.Object getAttribute()
Specified by:
getAttribute in interface ComponentContext

getCurrentNode

public java.util.Map getCurrentNode()

getDocument

public Document getDocument(java.util.Map node)
Specified by:
getDocument in interface ComponentContext

getLabelComponentText

public java.lang.String getLabelComponentText()

getValue

public java.lang.Object getValue()

isEmpty

public boolean isEmpty()

isModifiable

public boolean isModifiable()

isHidden

public boolean isHidden()

getSQLDataType

public int getSQLDataType()

isRequired

public boolean isRequired()

isModified

public boolean isModified()

setModifiable

public void setModifiable(boolean modifiable)

setRequired

public void setRequired(boolean required)

setEnabled

public void setEnabled(boolean enabled)

setValue

public void setValue(Document document)

Set model to viewer component.

Note: the given document must contains a valid thumbnail saved in the remote repository.

Parameters:
document - Document with a existing thumbnail in the repository.

setValue

public void setValue(Document document,
                     javax.swing.ImageIcon image)

setValue

public void setValue(Document document,
                     BytesBlock image)

setValue

public void setValue(java.lang.Object value)

deleteData

public void deleteData()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

putState

protected void putState(int state)

showImage

protected void showImage(java.util.Map node)

createRefreshEvent

protected RefreshEvent createRefreshEvent(Document current,
                                          java.util.Map data)

doAdd

public void doAdd(java.io.File[] files)

message

protected void message(java.lang.String key,
                       java.util.List l,
                       java.lang.Object parameter)

checkList

protected void checkList(Document[] documents,
                         java.util.Hashtable result)

checkResult

protected boolean checkResult(java.lang.String action,
                              java.util.Hashtable result)

doOperation

protected java.lang.Object doOperation(int code,
                                       Document[] documents,
                                       java.util.Map params)

createContext

public final java.util.Map createContext()
Specified by:
createContext in interface ContextValues

createContext

public java.util.Map createContext(javax.swing.tree.TreePath path)
Description copied from interface: ComponentContext

Creates a Map with the information that needs server to execute operations.

Context is given as a parameter in all server operations.

Specified by:
createContext in interface ComponentContext
Parameters:
path - The current selected path in the tree.
Returns:
Map with the component context keys.

getWorkingDirectory

public Document getWorkingDirectory()
Specified by:
getWorkingDirectory in interface ContextValues

getCurrentFields

public java.util.Hashtable getCurrentFields()
Specified by:
getCurrentFields in interface ContextValues

getCurrentKeys

public java.util.Hashtable getCurrentKeys()
Specified by:
getCurrentKeys in interface ContextValues

getAction

public int getAction()
Specified by:
getAction in interface ContextValues

getActions

public java.util.List getActions(ComponentSelection parent)
Description copied from interface: ComponentContext

Returns a list with all available actions.

Specified by:
getActions in interface ComponentContext
Returns:
List
See Also:
ComponentPopupItem

getAllowedActions

public java.util.List getAllowedActions()
Description copied from interface: ComponentContext

Returns a list with the enabled actions.

Specified by:
getAllowedActions in interface ComponentContext
Returns:
List with the enabled actions.
See Also:
ComponentActions

getConfiguration

public InternalConfigModel getConfiguration()
Specified by:
getConfiguration in interface ComponentContext

getCurrentExtraFields

public java.util.Hashtable getCurrentExtraFields()
Specified by:
getCurrentExtraFields in interface ContextValues

getExtraFields

public java.util.List getExtraFields()
Specified by:
getExtraFields in interface ComponentContext

getHiddenFields

public java.util.List getHiddenFields()
Specified by:
getHiddenFields in interface ComponentContext

getParentFields

public java.util.List getParentFields()
Specified by:
getParentFields in interface ContextValues

getVersionColumns

public java.util.List getVersionColumns()
Specified by:
getVersionColumns in interface ComponentContext

getSelectedLeaf

public TreeNode getSelectedLeaf()
Specified by:
getSelectedLeaf in interface ComponentContext

getSelectedPath

public javax.swing.tree.TreePath getSelectedPath()
Specified by:
getSelectedPath in interface ComponentContext

getSelectedDocument

public Document[] getSelectedDocument()
Specified by:
getSelectedDocument in interface ComponentContext

isFileNameGenerationEnabled

public boolean isFileNameGenerationEnabled()
Specified by:
isFileNameGenerationEnabled in interface ContextValues

refresh

public void refresh()

Ontimize Document Management