net.pandoragames.far.ui.model
Class TargetFile

java.lang.Object
  extended by net.pandoragames.far.ui.model.TargetFile
All Implemented Interfaces:
java.lang.Cloneable, MessageBox

public class TargetFile
extends java.lang.Object
implements MessageBox, java.lang.Cloneable

Data container for the files in a result list. Files in that list may have errors, be subject to name changes and selection or be excluded from a subset.

Author:
Olivier Wehner at 26.02.2008

Constructor Summary
TargetFile(java.io.File file)
          Constructor requires a non null file object.
 
Method Summary
 void clear()
          Clears all messages.
 java.lang.Object clone()
          Returns a copy of this object.
 boolean equals(java.lang.Object o)
          Two target files are equal if the wraped files are equal.
 void error(java.lang.String errorMessage)
          Sets an error message for this file.
 java.nio.charset.Charset getCharacterset()
          Returns the character set of this file, if any was specified.
 java.lang.String getErrorMessage()
          Returns the error message if any.
 java.io.File getFile()
          Returns the underlying java.io.File object.
 java.lang.String getInfoMessage()
          Returns the info message if any.
 java.lang.String getName()
          Returns the file name.
 java.lang.String getNewName()
          Returns a planned new name if any was set.
 java.lang.String getPath()
          Returns the files directory path.
 int hashCode()
          
 void info(java.lang.String message)
          Sets an info message for this file.
 boolean isIncluded()
          Returns true if this file should be considdered part of a subset in the same collection.
 boolean isSelected()
          Returns true (the default) if this file object has bee selected.
 void setCharacterset(java.nio.charset.Charset charaset)
          Specifies a character set for this file.
 void setIncluded(boolean included)
          Includes or excludes this object in a subset of the same collection this instance was taken from.
 void setNewName(java.lang.String newName)
          Sets the new name property of this object.
 void setSelected(boolean select)
          Selects or deselects this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetFile

public TargetFile(java.io.File file)
Constructor requires a non null file object.

Parameters:
file - not null
Method Detail

getName

public java.lang.String getName()
Returns the file name. This is a read only property.

Returns:
file name

getPath

public java.lang.String getPath()
Returns the files directory path. This is a read only property.

Returns:
directory path

getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message if any.

Returns:
error message or null

getInfoMessage

public java.lang.String getInfoMessage()
Returns the info message if any.

Returns:
informative message or null

error

public void error(java.lang.String errorMessage)
Sets an error message for this file.

Specified by:
error in interface MessageBox
Parameters:
errorMessage - error message

info

public void info(java.lang.String message)
Sets an info message for this file.

Specified by:
info in interface MessageBox
Parameters:
message - informative message

clear

public void clear()
Clears all messages.

Specified by:
clear in interface MessageBox

getFile

public java.io.File getFile()
Returns the underlying java.io.File object.

Returns:
underlying File object

isSelected

public boolean isSelected()
Returns true (the default) if this file object has bee selected.

Returns:
true if selected

setSelected

public void setSelected(boolean select)
Selects or deselects this object. By dafault a TargetFile is selected.

Parameters:
select - true if this file object should be selected.

getNewName

public java.lang.String getNewName()
Returns a planned new name if any was set.

Returns:
new name property

setNewName

public void setNewName(java.lang.String newName)
Sets the new name property of this object. This has no direct programatic consequences.

Parameters:
newName - property value

isIncluded

public boolean isIncluded()
Returns true if this file should be considdered part of a subset in the same collection. Returns true by default.

Returns:
true if part of subset

setIncluded

public void setIncluded(boolean included)
Includes or excludes this object in a subset of the same collection this instance was taken from.

Parameters:
included - set to false to excluide

getCharacterset

public java.nio.charset.Charset getCharacterset()
Returns the character set of this file, if any was specified. Returns null if the default character set should be used.

Returns:
character set or null

setCharacterset

public void setCharacterset(java.nio.charset.Charset charaset)
Specifies a character set for this file.


clone

public java.lang.Object clone()
Returns a copy of this object.

Overrides:
clone in class java.lang.Object
See Also:
Object.clone()

equals

public boolean equals(java.lang.Object o)
Two target files are equal if the wraped files are equal.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object