Gridarta Editor
net.sf.gridarta.gui.utils.JFileField Class Reference

A component for selecting files. More...

+ Inheritance diagram for net.sf.gridarta.gui.utils.JFileField:
+ Collaboration diagram for net.sf.gridarta.gui.utils.JFileField:

Public Member Functions

void addDocumentListener (@NotNull final DocumentListener documentListener)
 Adds a DocumentListener to the text input field. More...
 
void fileChooserButton ()
 The action method for the button. More...
 
File getFile ()
 Returns the currently selected file. More...
 
 JFileField (@NotNull final Component parent, @NotNull final String key, @Nullable final File baseDir, @NotNull final File file, final int fileSelectionMode)
 Creates a new instance. More...
 
void setFile (@NotNull final File file)
 Sets the currently selected file. More...
 

Private Member Functions

String getRelativeFile (@NotNull final File file)
 Returns the contents for the text input field for a file. More...
 

Private Attributes

final File baseDir
 The base directory. More...
 
final JFileChooser fileChooser = new JFileChooser()
 The JFileChooser for selecting the file. More...
 
final Component parent
 The parent component. More...
 
final JTextField textField
 The text file that contains the currently selected file. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 The ActionBuilder. More...
 
static final long serialVersionUID = 1L
 The serial version UID. More...
 

Detailed Description

A component for selecting files.

It consists of a text field and a button which pops up a file chooser.

Author
Andreas Kirschbaum

Definition at line 45 of file JFileField.java.

Constructor & Destructor Documentation

◆ JFileField()

net.sf.gridarta.gui.utils.JFileField.JFileField ( @NotNull final Component  parent,
@NotNull final String  key,
@Nullable final File  baseDir,
@NotNull final File  file,
final int  fileSelectionMode 
)

Creates a new instance.

Parameters
parentthe parent component
keythe resource key for showing tooltips
baseDirthe base directory; when non-
null
the contents of the text input field are relative to this directory
filethe currently selected file
fileSelectionModethe file selection mode for the file chooser

Definition at line 92 of file JFileField.java.

References net.sf.gridarta.gui.utils.JFileField.baseDir, net.sf.gridarta.gui.utils.JFileField.fileChooserButton(), net.sf.gridarta.gui.utils.JFileField.getRelativeFile(), net.sf.gridarta.utils.ActionBuilderUtils.getString(), and net.sf.gridarta.gui.utils.JFileField.parent.

+ Here is the call graph for this function:

Member Function Documentation

◆ addDocumentListener()

void net.sf.gridarta.gui.utils.JFileField.addDocumentListener ( @NotNull final DocumentListener  documentListener)

Adds a DocumentListener to the text input field.

Parameters
documentListenerthe document listener to add

Definition at line 144 of file JFileField.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.parameter.MapPathParameterView< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MapPathParameterView().

+ Here is the caller graph for this function:

◆ fileChooserButton()

void net.sf.gridarta.gui.utils.JFileField.fileChooserButton ( )

The action method for the button.

It shows the file chooser.

Definition at line 152 of file JFileField.java.

References net.sf.gridarta.gui.utils.JFileField.getFile(), and net.sf.gridarta.gui.utils.JFileField.setFile().

Referenced by net.sf.gridarta.gui.utils.JFileField.JFileField().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFile()

◆ getRelativeFile()

String net.sf.gridarta.gui.utils.JFileField.getRelativeFile ( @NotNull final File  file)
private

Returns the contents for the text input field for a file.

Parameters
filethe file
Returns
the contents

Definition at line 136 of file JFileField.java.

References net.sf.gridarta.model.io.PathManagerUtils.getMapPath().

Referenced by net.sf.gridarta.gui.utils.JFileField.JFileField(), and net.sf.gridarta.gui.utils.JFileField.setFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFile()

void net.sf.gridarta.gui.utils.JFileField.setFile ( @NotNull final File  file)

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.gui.utils.JFileField.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

The ActionBuilder.

Definition at line 56 of file JFileField.java.

◆ baseDir

final File net.sf.gridarta.gui.utils.JFileField.baseDir
private

The base directory.

When non-

null

, the contents of textField are relative to this directory.

Definition at line 69 of file JFileField.java.

Referenced by net.sf.gridarta.gui.utils.JFileField.getFile(), and net.sf.gridarta.gui.utils.JFileField.JFileField().

◆ fileChooser

final JFileChooser net.sf.gridarta.gui.utils.JFileField.fileChooser = new JFileChooser()
private

The JFileChooser for selecting the file.

Definition at line 81 of file JFileField.java.

◆ parent

final Component net.sf.gridarta.gui.utils.JFileField.parent
private

The parent component.

Definition at line 62 of file JFileField.java.

Referenced by net.sf.gridarta.gui.utils.JFileField.JFileField().

◆ serialVersionUID

final long net.sf.gridarta.gui.utils.JFileField.serialVersionUID = 1L
staticprivate

The serial version UID.

Definition at line 50 of file JFileField.java.

◆ textField

final JTextField net.sf.gridarta.gui.utils.JFileField.textField
private

The text file that contains the currently selected file.

Definition at line 75 of file JFileField.java.


The documentation for this class was generated from the following file: