-
Bug
-
Resolution: Incomplete
-
P4
-
7u45
-
WindowsXP sp3 32bit
jdk1.7.0_45
I have had a problem to reuse ColorPicker because there is no way to reset its view (color box and text) to state matched value property.
My scema is:
1. MyPane is used on some form of dialog.
2. User might want to pick some color but finally click Cancel on the form to dismiss dialog with no color applied.
3. When I reopen the dialog, I reset it by calling myPaneInstance.setColor( originalColor );
4. MyPane opens with ColorPicker showing last user selection rather then re-setted color. It also contradicts to color used by application and used by MyPreview class.
{code}
class MyPane extends Pane
{
private final ColorPicker colorPicker = new ColorPicker();
private final MyPreview preview = new MyPreview();
MyPane()
{
// next line is shown just for illustration purposes, implementation is different
preview.colorProperty().bind( colorPicker.valueProperty() );
}
void setColor( Color color )
{
// colorPicker.setColor( color ); // does not update property
colorPicker.valueProperty().setValue( color );
}
}
{code}
See alsoRT-22538 . Unfortunately, it was mixed with two issues and "resolved".
My scema is:
1. MyPane is used on some form of dialog.
2. User might want to pick some color but finally click Cancel on the form to dismiss dialog with no color applied.
3. When I reopen the dialog, I reset it by calling myPaneInstance.setColor( originalColor );
4. MyPane opens with ColorPicker showing last user selection rather then re-setted color. It also contradicts to color used by application and used by MyPreview class.
{code}
class MyPane extends Pane
{
private final ColorPicker colorPicker = new ColorPicker();
private final MyPreview preview = new MyPreview();
MyPane()
{
// next line is shown just for illustration purposes, implementation is different
preview.colorProperty().bind( colorPicker.valueProperty() );
}
void setColor( Color color )
{
// colorPicker.setColor( color ); // does not update property
colorPicker.valueProperty().setValue( color );
}
}
{code}
See also