com.im.ijc.widgets/1 5.9.1

com.im.ijc.widgets.abstractwidget
Class AbstractBindingWidget<CS extends CommonWidgetSettings>

java.lang.Object
  extended by com.im.ijc.widgets.abstractwidget.AbstractWidget<CS>
      extended by com.im.ijc.widgets.abstractwidget.AbstractBindingWidget<CS>
All Implemented Interfaces:
IJCWidget, IJCWidget.Customizable<CS>, IJCWidget.DesignerHandle, IJCWidget.Releaseable, IJCWidget.Updateable
Direct Known Subclasses:
AbstractSingleFieldWidget

public abstract class AbstractBindingWidget<CS extends CommonWidgetSettings>
extends AbstractWidget<CS>
implements IJCWidget.Updateable, IJCWidget.Releaseable

A common superclass for widgets bound to some field(s).


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.im.ijc.core.api.views.IJCWidget
IJCWidget.Breakable, IJCWidget.Cacheable, IJCWidget.Configurable, IJCWidget.Customizable<S>, IJCWidget.DesignerHandle, IJCWidget.Editable, IJCWidget.GroupCustomizable<N extends Node>, IJCWidget.HyperlinkAble, IJCWidget.Popupable, IJCWidget.Queryable, IJCWidget.Releaseable, IJCWidget.RendererCallback, IJCWidget.RendererProvider, IJCWidget.Updateable, IJCWidget.Viewable, IJCWidget.WidgetContainerHandle<S>
 
Field Summary
protected  BorderSupport borderSupport
           
 
Fields inherited from interface com.im.ijc.core.api.views.IJCWidget
PROP_BOUND_FIELDS, PROP_SELECTED_FIELDS, PROP_VERTEX_STATE, PROP_VIEW, PROP_VIEW_MODE
 
Fields inherited from interface com.im.ijc.core.api.views.IJCWidget.Customizable
PROP_SETTINGS
 
Constructor Summary
AbstractBindingWidget(String factoryId, DFView view, CS settings)
           
 
Method Summary
protected  Dimension adjustPreferredSizeForTitledBorder(JComponent comp, boolean extend)
          Adjust preferred size of the given component by delta equal to 2*title-border-spacing.
protected abstract  void changingSelection(SelectionDescription from, SelectionDescription to)
           Notifies about change in selection from from selection to to selection.
protected  boolean confirmSuitableWidgetUsed(DFDataTree dataTree, List<DFField> fields)
           
protected abstract  BindFieldAcceptor createBindAcceptor()
          Returns fields to which this widget is able to bind.
protected  boolean doBind(DFDataTree dataTree, BindFieldPanel.BackgroundCheck backgroundCheck)
           
 boolean doBindSingleField(DFDataTree dataTree, BindFieldPanel.BackgroundCheck backgroundCheck)
           
protected  WidgetBorder getBorder()
           
 JComponent getBrowseModeComponent()
           
protected  JPanel getBrowseModePanel()
           
protected  Lookup.Provider getBrowseModeRenderer()
           
 DFField getFirstField()
           
protected  Set<DFRelationship.Type> getInappropriateRelationships()
          It doesn't make sense to bind field from detailed entity with these relationships.
protected  JPanel getQueryModePanel()
           
 List<? extends DFField> getSelectedFields()
           
 String getTitle()
           
protected  List<? extends DFField> getTitleFields()
          Allows widget to use different fields then bound fields to be used for title composition.
 Font getTitleFont()
           
protected  Pair<String,Font> getTitlePair()
           
protected  String getTitleSeparator()
          Title separator which is used for compounding title for widgets with multiple bound fields.
protected  String getUseMoreSuitableWidgetMessage(String widgetName)
           
 DFResultSet.VertexState getVertexState()
          Return widget's active DFResultSet.VertexState.
protected static String getWidgetTypeDisplayName(String factoryId)
           
protected  boolean ignoreQueryUpdateFromRS()
          Can suppress widget update after change in working query.
protected abstract  boolean isBeingEdited()
           
protected  boolean isConsistentVertexState(DFField field, DFResultSet.VertexState vertexState)
           
protected  boolean isConsistentVertexState(List<? extends DFField> fields, DFResultSet.VertexState vs)
           
 boolean isFocusable()
           
 boolean isRebindable()
           
protected  boolean keepFormSpaceWhenBorderChanges()
          Whether to keep the form space the widget occupies when its border is changed.
protected  void lastExecQueryUpdateWidgetFromRS(DFTermExpression lastExecutedQuery)
          This method is invoked when PROP_LAST_EXECUTED_QUERY property is fired from DFResultSet which is this widget bound to.
protected  void modeChanged(ViewMode oldMode, ViewMode newMode)
           
protected  void queryUpdateWidgetFromRS(DFTermExpression workingQuery)
          This method is invoked when PROP_WORKING_QUERY property is fired from DFResultSet which is this widget bound to.
 void releaseWidget()
           
protected  void setSettings(CS settings)
           
protected  boolean setVertexState(DFEntity entity)
           
 void setVertexState(DFResultSet.VertexState vertexState)
           
protected  boolean showSortDirectiveInBorder()
          Determines whether to show sort directive when the border is of WidgetBorder.BorderType.TITLE_WITH_SORT type.
protected  void updateBorders()
          Updates border according to the WidgetBorder border info returned from the getBorder().
protected  void updatePanelBorder(JComponent panel, String title)
          Override with empty body if widget doesn't support border.
 void updateValue()
           
protected abstract  void updateValues()
           
 
Methods inherited from class com.im.ijc.widgets.abstractwidget.AbstractWidget
addPropertyChangeListener, firePropertyChange, getFactoryId, getForm, getFormData, getLookup, getView, getViewMode, getWidgetSettings, instanceContent, putUniquelyIntoLookup, removePropertyChangeListener, setViewMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.im.ijc.core.api.views.IJCWidget.DesignerHandle
bind, doBind, getBuildModeRenderer
 
Methods inherited from interface com.im.ijc.core.api.views.IJCWidget
getBoundFields, isMultipleRow
 
Methods inherited from interface com.im.ijc.core.api.views.IJCWidget.Customizable
customizeUISettings
 

Field Detail

borderSupport

protected final BorderSupport borderSupport
Constructor Detail

AbstractBindingWidget

public AbstractBindingWidget(String factoryId,
                             DFView view,
                             CS settings)
Method Detail

changingSelection

protected abstract void changingSelection(SelectionDescription from,
                                          SelectionDescription to)

Notifies about change in selection from from selection to to selection. Widget is supposed to react accordingly to the change.

The method might be called from any thread.

Parameters:
from - old selection
to - new selection

updateValues

protected abstract void updateValues()

createBindAcceptor

protected abstract BindFieldAcceptor createBindAcceptor()
Returns fields to which this widget is able to bind.

Returns:
fields accepted by the widget

isBeingEdited

protected abstract boolean isBeingEdited()

adjustPreferredSizeForTitledBorder

protected Dimension adjustPreferredSizeForTitledBorder(JComponent comp,
                                                       boolean extend)
Adjust preferred size of the given component by delta equal to 2*title-border-spacing. Sign of the delta depends on the given extend parameter.

Parameters:
comp - component to be adjusted
extend - if true the size is extended; if false the size is shrunk by the given delta
Returns:
resulting dimension delta

keepFormSpaceWhenBorderChanges

protected boolean keepFormSpaceWhenBorderChanges()
Whether to keep the form space the widget occupies when its border is changed. E.g. when the border is changed to be hidden and this method returns true the actual widget size is expanded about the size of the previously set border insets to fill up kept original form space.

Returns:
true to keep the space; false to let it change on border change

showSortDirectiveInBorder

protected boolean showSortDirectiveInBorder()
Determines whether to show sort directive when the border is of WidgetBorder.BorderType.TITLE_WITH_SORT type.

Returns:
true unless overridden by subclass.

getBorder

protected WidgetBorder getBorder()
Overrides:
getBorder in class AbstractWidget<CS extends CommonWidgetSettings>

releaseWidget

public void releaseWidget()
Specified by:
releaseWidget in interface IJCWidget.Releaseable

setSettings

protected void setSettings(CS settings)
Overrides:
setSettings in class AbstractWidget<CS extends CommonWidgetSettings>

setVertexState

public void setVertexState(DFResultSet.VertexState vertexState)
Specified by:
setVertexState in interface IJCWidget.DesignerHandle

getVertexState

public DFResultSet.VertexState getVertexState()
Return widget's active DFResultSet.VertexState.

Specified by:
getVertexState in interface IJCWidget
Returns:
active VertexState. Might return null e.g. in the case the widget instance was released.

getBrowseModeRenderer

protected Lookup.Provider getBrowseModeRenderer()

isConsistentVertexState

protected boolean isConsistentVertexState(DFField field,
                                          DFResultSet.VertexState vertexState)

isConsistentVertexState

protected boolean isConsistentVertexState(List<? extends DFField> fields,
                                          DFResultSet.VertexState vs)

queryUpdateWidgetFromRS

protected void queryUpdateWidgetFromRS(DFTermExpression workingQuery)
This method is invoked when PROP_WORKING_QUERY property is fired from DFResultSet which is this widget bound to.

Can be overridden in subclasses.

Parameters:
workingQuery - The query

ignoreQueryUpdateFromRS

protected boolean ignoreQueryUpdateFromRS()
Can suppress widget update after change in working query. Overwrite this to return true while editing is performed.


getFirstField

public final DFField getFirstField()

doBind

protected boolean doBind(DFDataTree dataTree,
                         BindFieldPanel.BackgroundCheck backgroundCheck)

lastExecQueryUpdateWidgetFromRS

protected void lastExecQueryUpdateWidgetFromRS(DFTermExpression lastExecutedQuery)
This method is invoked when PROP_LAST_EXECUTED_QUERY property is fired from DFResultSet which is this widget bound to.

Can be overridden in subclasses.

Parameters:
lastExecutedQuery - The query

modeChanged

protected void modeChanged(ViewMode oldMode,
                           ViewMode newMode)
Specified by:
modeChanged in class AbstractWidget<CS extends CommonWidgetSettings>

isFocusable

public boolean isFocusable()
Specified by:
isFocusable in interface IJCWidget.DesignerHandle

getSelectedFields

public List<? extends DFField> getSelectedFields()
Specified by:
getSelectedFields in interface IJCWidget

isRebindable

public boolean isRebindable()
Specified by:
isRebindable in interface IJCWidget.DesignerHandle

updateValue

public void updateValue()
Specified by:
updateValue in interface IJCWidget.Updateable

confirmSuitableWidgetUsed

protected boolean confirmSuitableWidgetUsed(DFDataTree dataTree,
                                            List<DFField> fields)

getInappropriateRelationships

protected Set<DFRelationship.Type> getInappropriateRelationships()
It doesn't make sense to bind field from detailed entity with these relationships.

Returns:
Relationships for detailed entities which are useless for this widget.

getUseMoreSuitableWidgetMessage

protected String getUseMoreSuitableWidgetMessage(String widgetName)

doBindSingleField

public boolean doBindSingleField(DFDataTree dataTree,
                                 BindFieldPanel.BackgroundCheck backgroundCheck)

setVertexState

protected boolean setVertexState(DFEntity entity)

getWidgetTypeDisplayName

protected static String getWidgetTypeDisplayName(String factoryId)

getTitleSeparator

protected String getTitleSeparator()
Title separator which is used for compounding title for widgets with multiple bound fields. It is equal to ", " by default.

Returns:
separator

getTitleFields

protected List<? extends DFField> getTitleFields()
Allows widget to use different fields then bound fields to be used for title composition.

Returns:
fields for title composition; null is not permitted

getTitle

public String getTitle()

getTitleFont

public Font getTitleFont()

getTitlePair

protected Pair<String,Font> getTitlePair()

updatePanelBorder

protected void updatePanelBorder(JComponent panel,
                                 String title)
Override with empty body if widget doesn't support border.

Parameters:
panel - The browse or query panel
title - The title

updateBorders

protected void updateBorders()
Updates border according to the WidgetBorder border info returned from the getBorder().

If the method is not called from EDT it will be forked into it.


getBrowseModeComponent

public JComponent getBrowseModeComponent()
Specified by:
getBrowseModeComponent in interface IJCWidget.DesignerHandle

getBrowseModePanel

protected JPanel getBrowseModePanel()

getQueryModePanel

protected JPanel getQueryModePanel()

com.im.ijc.widgets/1 5.9.1