net.aerith.misao.gui.dialog
Class LevelAdjustmentDialog

java.lang.Object
  |
  +--net.aerith.misao.gui.dialog.LevelAdjustmentDialog

public class LevelAdjustmentDialog
extends java.lang.Object

The LevelAdjustmentDialog represents a dialog to ajudst image level to view.


Inner Class Summary
protected  class LevelAdjustmentDialog.AdjustCommanderThread
          The AdjustCommanderThread is a thread to control the adjust command to the target.
protected  class LevelAdjustmentDialog.ApplyListener
          The ApplyListener is a listener class of button push to apply the level to the image component.
protected  class LevelAdjustmentDialog.AutoListener
          The AutoListener is a listener class of button push to set the proper level automatically.
protected  class LevelAdjustmentDialog.SliderChangeListener
          The SliderChangeListener is a listener class of slider motion.
 
Field Summary
private  javax.swing.JCheckBox checkbox_adjust_all
          The check box to adjust all images.
private  boolean disable_update
          True if the it is disabled to update text fields and repaint the image.
private  HistogramComponent histogram
          The histogram.
private  Statisticable image
          The target image.
private  javax.swing.JTextField max_field
          Text field to input maximum value.
private  javax.swing.JTextField min_field
          Text field to input minimum value.
private  java.lang.Object[] objects
          Array of objects to show in the dialog.
private  double range_maximum
          The maximum value of the slider range.
private  double range_minimum
          The minimum value of the slider range.
protected  boolean running
          True if the adjust command controller thead is running.
private  javax.swing.JSlider slider_maximum
          The slider for maximum value.
private  javax.swing.JSlider slider_minimum
          The slider for minimum value.
private  LevelAdjustmentSet stat
          The image level and statistics.
private  LevelAdjustable target
          The target image component.
private  boolean textfield_integer
          True if the minimum and maximum value should be printed as integer value in the text fields.
private  LevelAdjustmentDialog.AdjustCommanderThread thread
          The thread to control the adjust command to the target.
 
Constructor Summary
LevelAdjustmentDialog(Statisticable image, LevelAdjustable target, LevelAdjustmentSet stat)
          Constructs a LevelAdjustmentDialog.
 
Method Summary
 void addAllImagesAdjustmentCheckbox()
          Adds a check box to adjust all images at one time.
 void adjustLevel(double new_minimum, double new_maximum)
          Adjusts the level of the target.
protected  double convertLevelToValue(int level)
          Converts the level to the pixel value based on the specified minimum and maximum value.
protected  int convertValueToLevel(double value)
          Converts the pixel value to the level based on the specified minimum and maximum value.
private  void resetSlider()
          Resets the slider position so that the current minimum value will be 0.25 and the current maximum value will be 0.75.
 int show(java.awt.Component pane)
          Shows the dialog.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

image

private Statisticable image
The target image.

target

private LevelAdjustable target
The target image component.

thread

private LevelAdjustmentDialog.AdjustCommanderThread thread
The thread to control the adjust command to the target.

stat

private LevelAdjustmentSet stat
The image level and statistics.

range_minimum

private double range_minimum
The minimum value of the slider range.

range_maximum

private double range_maximum
The maximum value of the slider range.

slider_minimum

private javax.swing.JSlider slider_minimum
The slider for minimum value.

slider_maximum

private javax.swing.JSlider slider_maximum
The slider for maximum value.

checkbox_adjust_all

private javax.swing.JCheckBox checkbox_adjust_all
The check box to adjust all images.

objects

private java.lang.Object[] objects
Array of objects to show in the dialog.

min_field

private javax.swing.JTextField min_field
Text field to input minimum value.

max_field

private javax.swing.JTextField max_field
Text field to input maximum value.

histogram

private HistogramComponent histogram
The histogram.

disable_update

private boolean disable_update
True if the it is disabled to update text fields and repaint the image.

textfield_integer

private boolean textfield_integer
True if the minimum and maximum value should be printed as integer value in the text fields.

running

protected boolean running
True if the adjust command controller thead is running.
Constructor Detail

LevelAdjustmentDialog

public LevelAdjustmentDialog(Statisticable image,
                             LevelAdjustable target,
                             LevelAdjustmentSet stat)
Constructs a LevelAdjustmentDialog.
Parameters:
image - the target image.
target - the target image component.
stat - the image level and statistics.
Method Detail

addAllImagesAdjustmentCheckbox

public void addAllImagesAdjustmentCheckbox()
Adds a check box to adjust all images at one time.

show

public int show(java.awt.Component pane)
Shows the dialog. When closed, the current minimum and maximum values are updated.
Parameters:
pane - the parent window.
Returns:
the code of selected button.

resetSlider

private void resetSlider()
Resets the slider position so that the current minimum value will be 0.25 and the current maximum value will be 0.75.

convertValueToLevel

protected int convertValueToLevel(double value)
Converts the pixel value to the level based on the specified minimum and maximum value.
Parameters:
value - the pixel value.
Returns:
the level.

convertLevelToValue

protected double convertLevelToValue(int level)
Converts the level to the pixel value based on the specified minimum and maximum value.
Parameters:
level - the level.
Returns:
the pixel value.

adjustLevel

public void adjustLevel(double new_minimum,
                        double new_maximum)
Adjusts the level of the target.
Parameters:
new_minimum - the minimum level.
new_maximum - the maximum level.