com.groovemanager.gui.custom
Class ChooseFormatDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TitleAreaDialog
              extended by com.groovemanager.gui.custom.ChooseFormatDialog

public class ChooseFormatDialog
extends org.eclipse.jface.dialogs.TitleAreaDialog

This class represents a dialog in which the user can select some attributes of an AudioFormat

Author:
Manu Robledo

Nested Class Summary
private static class ChooseFormatDialog.PseudoAudioFormat
          A Pseudo-class that is needed for accessing the AudioFormat.Encoding constructor in versions prior to 1.4
 
Nested classes inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
private  boolean bigEndian
          Current value of the endianess of the AudioFormat
private  int channels
          Current number of channels of the AudioFormat
static int CHANNELS
          Constant for the AudioFormat attributes
private  org.eclipse.swt.widgets.Combo channelSelect
          Drop-Down Menu for user selection of the number of channels.
private  javax.sound.sampled.AudioFormat.Encoding encoding
          Current value for the encoding of the AudioFormat
static int ENCODING
          Constant for the AudioFormat attributes
private  javax.sound.sampled.AudioFormat.Encoding[] encodings
          Possible values for Encoding selection
private  org.eclipse.swt.widgets.Combo encodingSelect
          Drop-Down Menu for user selection of the encoding.
static int ENDIAN
          Constant for the AudioFormat attributes
private  org.eclipse.swt.widgets.Combo endianSelect
          Drop-Down Menu for user selection of the endianess.
private  javax.sound.sampled.AudioFormat format
          The pre-defined or the last selected AudioFormat
private  int maxChannels
          Maximum value that can be selected as channels
private  java.lang.String msg
          The message of this dialog
static int SAMPLE_SIZE
          Constant for the AudioFormat attributes
private  float sampleRate
          Current value for the sample rate of the AudioFormat
private  float[] sampleRates
          Possible values for sampleRate selection
private  org.eclipse.swt.widgets.Combo sampleRateSelect
          Drop-Down Menu for user selection of the sample rate.
private  org.eclipse.swt.widgets.Text sampleRateValue
          Text field for user input of the sample rate.
private  int sampleSize
          Current value for the sample size of the AudioFormat
private  org.eclipse.swt.widgets.Combo sampleSizeSelect
          Drop-Down Menu for user selection of the sample size.
private  org.eclipse.swt.widgets.Text sampleSizeValue
          Text field for user input of the sample size.
static int SAMPLING_RATE
          Constant for the AudioFormat attributes
private  int showWhat
          The constants of all attributes that should be selectable by the user combined with |, for example CHANNELS | SAMPLING_RATE.
private  int[] sizes
          Possible values for Sample size selection
 
Fields inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
buttonBar, dialogArea, DLG_IMG_ERROR, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Constructor Summary
ChooseFormatDialog(org.eclipse.swt.widgets.Shell parentShell, javax.sound.sampled.AudioFormat format, java.lang.String message, int showWhat, int[] sizes, float[] sampleRates, javax.sound.sampled.AudioFormat.Encoding[] encodings, int maxChannels)
          Constructs a new ChooseFormatDialog
 
Method Summary
 void create()
           
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
           
 javax.sound.sampled.AudioFormat getFormat()
          Get the current AudioFormat of this dialog.
protected  void okPressed()
           
 void setFormat(javax.sound.sampled.AudioFormat format)
          Set the AudioFormat of this dialog
 
Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
createContents, getInitialSize, getTitleArea, getTitleImageLabel, setErrorMessage, setMessage, setMessage, setTitle, setTitleAreaColor, setTitleImage
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, close, configureShell, constrainShellSize, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, createButtonBar, createButtonsForButtonBar, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getOKButton, initializeBounds, initializeDialogUnits, setButtonLayoutData, setButtonLayoutFormData
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, createShell, getContents, getDefaultImage, getInitialLocation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setExceptionHandler, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bigEndian

private boolean bigEndian
Current value of the endianess of the AudioFormat


channels

private int channels
Current number of channels of the AudioFormat


CHANNELS

public static final int CHANNELS
Constant for the AudioFormat attributes

See Also:
Constant Field Values

channelSelect

private org.eclipse.swt.widgets.Combo channelSelect
Drop-Down Menu for user selection of the number of channels. Will only be used, if showWhat & CHANNELS > 0.


encoding

private javax.sound.sampled.AudioFormat.Encoding encoding
Current value for the encoding of the AudioFormat


ENCODING

public static final int ENCODING
Constant for the AudioFormat attributes

See Also:
Constant Field Values

encodings

private javax.sound.sampled.AudioFormat.Encoding[] encodings
Possible values for Encoding selection


encodingSelect

private org.eclipse.swt.widgets.Combo encodingSelect
Drop-Down Menu for user selection of the encoding. Will only be used, if showWhat & ENCODING > 0 and if possible values for user selection of the encoding are given.


ENDIAN

public static final int ENDIAN
Constant for the AudioFormat attributes

See Also:
Constant Field Values

endianSelect

private org.eclipse.swt.widgets.Combo endianSelect
Drop-Down Menu for user selection of the endianess. Will only be used, if showWhat & ENDIAN > 0.


format

private javax.sound.sampled.AudioFormat format
The pre-defined or the last selected AudioFormat


maxChannels

private int maxChannels
Maximum value that can be selected as channels


msg

private java.lang.String msg
The message of this dialog


SAMPLE_SIZE

public static final int SAMPLE_SIZE
Constant for the AudioFormat attributes

See Also:
Constant Field Values

sampleRate

private float sampleRate
Current value for the sample rate of the AudioFormat


sampleRates

private float[] sampleRates
Possible values for sampleRate selection


sampleRateSelect

private org.eclipse.swt.widgets.Combo sampleRateSelect
Drop-Down Menu for user selection of the sample rate. Will only be used, if showWhat & SAMPLING_RATE > 0 and if possible values for user selection of the sample rate are given.


sampleRateValue

private org.eclipse.swt.widgets.Text sampleRateValue
Text field for user input of the sample rate. Will only be used, if showWhat & SAMPLING_RATE > 0 and if no possible values for user selection of the sample rate are given.


sampleSize

private int sampleSize
Current value for the sample size of the AudioFormat


sampleSizeSelect

private org.eclipse.swt.widgets.Combo sampleSizeSelect
Drop-Down Menu for user selection of the sample size. Will only be used, if showWhat & SAMPLE_SIZE > 0 and if possible values for user selection of the sample size are given.


sampleSizeValue

private org.eclipse.swt.widgets.Text sampleSizeValue
Text field for user input of the sample size. Will only be used, if showWhat & SAMPLE_SIZE > 0 and if no possible values for user selection of the sample size are given.


SAMPLING_RATE

public static final int SAMPLING_RATE
Constant for the AudioFormat attributes

See Also:
Constant Field Values

showWhat

private int showWhat
The constants of all attributes that should be selectable by the user combined with |, for example CHANNELS | SAMPLING_RATE.


sizes

private int[] sizes
Possible values for Sample size selection

Constructor Detail

ChooseFormatDialog

public ChooseFormatDialog(org.eclipse.swt.widgets.Shell parentShell,
                          javax.sound.sampled.AudioFormat format,
                          java.lang.String message,
                          int showWhat,
                          int[] sizes,
                          float[] sampleRates,
                          javax.sound.sampled.AudioFormat.Encoding[] encodings,
                          int maxChannels)
Constructs a new ChooseFormatDialog

Parameters:
parentShell - The Shell to be used as parent Shell of the dialog
format - The initial AudioFormat value
message - The message shown to the user
showWhat - Mask of attributes that should be selectable for the user. For example: CHANNELS | SAMPLING_RATE
sizes - Array of possible values for the sample size. If this parameter is null, a text input will be shown for the user to input any sample size
sampleRates - Array of possible values for the sample rate. If this parameter is null, a text input will be shown for the user to input any sample rate
encodings - Array of possible Encodings foir user selection
maxChannels - The maximum number of channels
Method Detail

create

public void create()
Overrides:
create in class org.eclipse.jface.window.Window

createDialogArea

protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
Overrides:
createDialogArea in class org.eclipse.jface.dialogs.TitleAreaDialog

getFormat

public javax.sound.sampled.AudioFormat getFormat()
Get the current AudioFormat of this dialog. If the dialog has not yet been opened, the format given to the Constructor will be returned. Otherwise the result of the user selection will be returned.

Returns:
The AudioFormat represented by this dialog

okPressed

protected void okPressed()
Overrides:
okPressed in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.okPressed()

setFormat

public void setFormat(javax.sound.sampled.AudioFormat format)
Set the AudioFormat of this dialog

Parameters:
format - The current AudioFormat value of this dialog