com.togethersoft.openapi.util.ui
Class URLChooser


public class URLChooser
implements ActionListener

Represents dialog which text field for input some text and button for call file chooser.
Example of usage:


private String chooseURL(String url){
String rezult = null;
URLChooser chooser = new URLChooser(url, lastDirectory);
if (chooser.show()){
rezult = chooser.getUrl();
if(rezult != null && rezult.length() > 0) {
lastDirectory = chooser.getDirectory();
lastURL = rezult;
}
}
return rezult;
}

Author:
TogetherSoft
Since: Together 5.0

Field Summary
 private final static StringABSOLUTE_RBUTTON_COMMAND
           
 private final static StringABSOLUTE_RBUTTON_LABEL
           
 private booleanisCanceled
           
 private JRadioButtonmyAbsoluteButton
           
 private IdeConfigmyConfig
           
 private StringmyCurrentDirectory
           
 private JDialogmyDialog
           
 private ExtendedControlmyExtendedControl
           
 private ButtonGroupmyRButtonGroup
           
 private JRadioButtonmyRelativeButton
           
 private JTextFieldmyTextField
           
 private StringmyTitle
           
 private StringmyUrl
           
 private VirtualFileManagermyVirtualFileManager
           
 private final static StringRELATIVE_PATHS_CONFIG_PROPERTY
           
 private final static StringRELATIVE_RBUTTON_COMMAND
           
 private final static StringRELATIVE_RBUTTON_LABEL
           

Constructor Summary
URLChooser(String title, String url, String currentDirectory)
          Creates new URLChooser.
URLChooser(String url, String currentDirectory)
          Creates new URLChooser with title - "Choose URL".

Method Summary
 voidactionPerformed(ActionEvent evt)
          Implements ActionListener interface.
 private JPanelcreateButtonPane()
           
 private JPanelcreateContentPane()
           
 private JPanelcreateRadioButtonGroup()
           
 private voiddispose()
           
 private voiddoCancel()
           
 private voidenableRadioButtons(boolean state)
           
 private StringgetAbsolutePath(String fileName)
           
 StringgetDirectory()
           
 private VirtualFilegetProjectFileParent()
           
 private StringgetRelativePath(String fileName)
           
 StringgetUrl()
           
 private booleanisFile(String url)
           
 private voidselectRadioButton(String url)
           
 booleanshow()
          Shows URLChooser and returns rezult of view.

Field Detail

ABSOLUTE_RBUTTON_COMMAND

private final static String ABSOLUTE_RBUTTON_COMMAND

ABSOLUTE_RBUTTON_LABEL

private final static String ABSOLUTE_RBUTTON_LABEL

isCanceled

private boolean isCanceled

myAbsoluteButton

private JRadioButton myAbsoluteButton

myConfig

private IdeConfig myConfig

myCurrentDirectory

private String myCurrentDirectory

myDialog

private JDialog myDialog

myExtendedControl

private ExtendedControl myExtendedControl

myRButtonGroup

private ButtonGroup myRButtonGroup

myRelativeButton

private JRadioButton myRelativeButton

myTextField

private JTextField myTextField

myTitle

private String myTitle

myUrl

private String myUrl

myVirtualFileManager

private VirtualFileManager myVirtualFileManager

RELATIVE_PATHS_CONFIG_PROPERTY

private final static String RELATIVE_PATHS_CONFIG_PROPERTY

RELATIVE_RBUTTON_COMMAND

private final static String RELATIVE_RBUTTON_COMMAND

RELATIVE_RBUTTON_LABEL

private final static String RELATIVE_RBUTTON_LABEL
Constructor Detail

URLChooser

public URLChooser(String title, String url, String currentDirectory)
Creates new URLChooser.
Parameters:
title String - title for chooser dialog.
url String - initialization string.
currentDirectory String - current path reflected by file chooser.

URLChooser

public URLChooser(String url, String currentDirectory)
Creates new URLChooser with title - "Choose URL".
Parameters:
url String - initialization string.
currentDirectory String - current path reflected by file chooser.
Method Detail

actionPerformed

public void actionPerformed(ActionEvent evt)
Implements ActionListener interface.

createButtonPane

private JPanel createButtonPane()

createContentPane

private JPanel createContentPane()

createRadioButtonGroup

private JPanel createRadioButtonGroup()

dispose

private void dispose()

doCancel

private void doCancel()

enableRadioButtons

private void enableRadioButtons(boolean state)

getAbsolutePath

private String getAbsolutePath(String fileName)

getDirectory

public String getDirectory()
Returns: String path from file chooser.

getProjectFileParent

private VirtualFile getProjectFileParent()

getRelativePath

private String getRelativePath(String fileName)

getUrl

public String getUrl()
Returns: String choosed url.

isFile

private boolean isFile(String url)

selectRadioButton

private void selectRadioButton(String url)

show

public boolean show()
Shows URLChooser and returns rezult of view.
Returns: boolean true if pressed Ok button or false if pressed Cancel.

Association Links

to Class com.togethersoft.openapi.ide.config.IdeConfig

to Class com.togethersoft.openapi.vfs.VirtualFileManager

to Class com.togethersoft.openapi.util.ui.ExtendedControl

to Class javax.swing.JTextField

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class javax.swing.JDialog

to Class javax.swing.JRadioButton

to Class javax.swing.JRadioButton

to Class javax.swing.ButtonGroup

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String