|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jv.object.PsObject
|
+--jv.number.PuDouble
Basic double class with update functionality and panel containing a slider.
This class may always be used when a double instance variable shall be
modifiable by a slider in the info panel of its parent class. See the class
PjExprOde as a sample application.
Usage demonstrated in a sample class:
public class PjExprOde
{
protected PuDouble m_length;
public PjExprOde() {
// Create a new instance of PuDouble and register 'this' as parent
// to receive update events whenever user has modified the slider.
m_length = new PuDouble("Length", this);
}
public void init() {
// Set default value to be assigned when user resets slider
// using a call m_length.init().
m_length.setDefValue(15.);
// Set default min/max values and increments of slider.
m_length.setDefBounds(1., 50., 0.1, 1.0);
// Reset to default values.
m_length.init();
}
public boolean update(Object event) {
// Catch update events sent whenever user has modifed slider.
if (event == m_length) {
// Do something application depended
solve();
return true;
}
}
public void solve() {
// Access current value
System.out.println("Current value = "+m_length.getValue());
}
}
PuInteger,
PjExprOde, Serialized Form| Field Summary | |
protected boolean |
m_enabled
Flag determining whether slider is enabled or disabled. modified using the config panel. |
protected static int |
m_iLineIncr
Integer equivalent of line increment. |
protected int |
m_iPageIncr
Integer equivalent of block increment. |
protected int |
m_iValue
Integer representation of current double value to be used in slider. |
protected double |
m_lineIncr
Line increment as double value supplied by user. |
protected double |
m_maximum
Maximal allowed value of double variable. |
protected double |
m_minimum
Minimal allowed value of double variable. |
protected int |
m_numOfIncrements
Integer equivalent of maximal double value. |
protected double |
m_pageIncr
Block increment as double value supplied by user. |
protected double |
m_shownAccuracy
Accuracy shown in text fields. |
protected double |
m_value
Current value of double variable. |
| Fields inherited from class jv.object.PsObject |
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS |
| Constructor Summary | |
PuDouble(java.lang.String aName,
PsUpdateIf aParent)
Create new instance with given name and parent. |
|
| Method Summary | |
void |
blend(double a,
PuDouble v,
double b,
PuDouble w)
Blend with other doubles using this = a*v + b*w. |
void |
copy(PuDouble num)
Copy all instance variables of argument source into 'this'. |
double |
getLineIncr()
Get line increment of slider. |
double |
getMax()
Get maximal value allowed in slider. |
double |
getMin()
Get minimal value allowed in slider. |
double |
getPageIncr()
Get block increment of slider. |
double |
getValue()
Get current double value. |
void |
init()
Assign default values, and may be used to reset instance. |
boolean |
isEnabled()
Check whether slider is enabled or disabled. |
void |
setBounds(double aMin,
double aMax)
Set current min/max values and adjust value if current value lies outside the new min/max bounds. |
void |
setBounds(double aMin,
double aMax,
double aLineIncr,
double aPageIncr)
Set current min/max values and slider increments. |
void |
setDefBounds(double aMin,
double aMax,
double aLineIncr,
double aPageIncr)
Set default min/max values and slider increments to be assigned when init() is called as reset. |
void |
setDefValue(double value)
Set default value to be assigned when init() is called as reset. |
void |
setEnabled(boolean flag)
Enable or disable the slider for interactive use. |
protected void |
setIntValue(int aValue)
Set value of double, but do not adjust slider. |
void |
setValue(double aValue)
Set value of double, and adjust slider if visible. |
protected void |
setValueFromPanel(double aValue,
java.lang.Object event)
Set value of double, but do not adjust slider. |
boolean |
update(java.lang.Object anObject)
Catch update events sent from info panel. |
| Methods inherited from class jv.object.PsObject |
addInspector, addUpdateListener, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, toString, updatePanels |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int m_iValue
protected int m_numOfIncrements
protected static final int m_iLineIncr
protected int m_iPageIncr
protected double m_shownAccuracy
protected double m_value
protected double m_minimum
protected double m_maximum
protected double m_lineIncr
protected double m_pageIncr
protected boolean m_enabled
setValue(double), and the slider
is always updated.| Constructor Detail |
public PuDouble(java.lang.String aName,
PsUpdateIf aParent)
aParent.update(this).aName - Name of double to appear as label in slider.aParent - Parent of double to receive update events.| Method Detail |
public void init()
init in class PsObjectpublic void copy(PuDouble num)
public void setDefValue(double value)
init() is called as reset.
public void setDefBounds(double aMin,
double aMax,
double aLineIncr,
double aPageIncr)
init() is called as reset.protected void setIntValue(int aValue)
public void setValue(double aValue)
protected void setValueFromPanel(double aValue,
java.lang.Object event)
public double getValue()
public double getMin()
public double getMax()
public double getLineIncr()
public double getPageIncr()
public void setBounds(double aMin,
double aMax,
double aLineIncr,
double aPageIncr)
init().aMin, - aMax Minimal and maximal values in slider.aLineIncr - Line increment used in slider.aPageIncr - Block increment used in slider.
public void setBounds(double aMin,
double aMax)
init().
Line and block increments of slider are set to default values.aMin, - aMax Minimal and maximal values in slider.public boolean isEnabled()
public void setEnabled(boolean flag)
setValue(double), and the slider
is always updated.public boolean update(java.lang.Object anObject)
update in class PsObjectjv.object.PsObjectPsObject.setParent(PsUpdateIf),
PsObject.getFather(),
PsObject.addUpdateListener(PsUpdateIf)
public void blend(double a,
PuDouble v,
double b,
PuDouble w)
this = a*v + b*w.
|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||