|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.gnogno.gui.dataset.binder.AbstractPropertyToComponentBinder<T>
public abstract class AbstractPropertyToComponentBinder<T>
This class binds to a property of a ResourceDataSet. It listens for changes in the model, the resource or values of the property and fires the dataChanged event if these events occur. You can derive your own propertybinders and implemnet dataChanged as you like. $Id: AbstractPropertyToComponentBinder.java,v 1.1 2005/02/02 08:48:34 sauermann Exp $
| Nested Class Summary | |
|---|---|
protected class |
AbstractPropertyToComponentBinder.Listener
|
| Field Summary | |
|---|---|
protected T |
component
the visual component that is bound. |
private ResourceDataSet |
dataset
|
private org.ontoware.rdf2go.model.node.URI |
datatype
the datatype of the property. |
private boolean |
datatypeDetected
true, when the datatype was already detected. |
private boolean |
detectDatatype
before getting/setting values, detect the correct datatype to use based on the ontology |
private AbstractPropertyToComponentBinder.Listener |
listener
|
protected Logger |
log
dynamic logger, depends on the implementing class |
private org.ontoware.rdf2go.model.node.URI |
property
|
private int |
updatingComponent
|
private int |
updatingRdf
|
private boolean |
useOntology
if true, information from the ontology (the RDFS Comment) may be used on the control. |
| Constructor Summary | |
|---|---|
AbstractPropertyToComponentBinder()
|
|
AbstractPropertyToComponentBinder(T component)
|
|
AbstractPropertyToComponentBinder(T component,
ResourceDataSet dataset,
org.ontoware.rdf2go.model.node.URI property)
generate a new AbstractPropertyBinder. |
|
| Method Summary | |
|---|---|
protected void |
addListenerOnDataSet()
remove listeners on the dataset, if the dataset is ! |
protected void |
beginDataUpdate()
subclasses can use this to set the binder into updating state. |
protected abstract void |
bindComponent(T component)
bind a listener to the component to listen for changes. |
protected void |
componentToResource()
write the data from the component to the resource |
void |
dispose()
dispose the object, set all related objects to null, unregister listeners. |
protected abstract void |
enableComponent(boolean enabled)
set the component to enabled or disabled. |
protected void |
endDataUpdate()
subclasses can use this to set the binder into updating state. |
protected void |
fireOntologyToComponent()
update the tooltip and other properties of the component, if the useOntology is set |
T |
getComponent()
|
org.ontoware.rdf2go.model.node.URI |
getDatatype()
read the datatype of this property from the range value, from the ontology. |
GnoFactory |
getGnoFactory()
convenience method getting the GnoFactory of the ModelDataSet |
ModelDataSet |
getModelDataSet()
convenience method to access the modeldataset of the resourcedataset. |
org.ontoware.rdf2go.model.node.URI |
getProperty()
get the property that this thing does visualize |
String |
getPropertyAsString()
get property URI as String. |
ResourceDataSet |
getResourceDataSet()
retrieve the resource data set that is the source of data of this component. |
boolean |
getUseOntology()
true, when the rdfs-comment from the ontology should be used to set the tooltip of the component. |
boolean |
isDetectDatatype()
before getting/setting values, detect the correct datatype to use based on the ontology |
boolean |
isOpen()
return true, when all the necessary data is there to show something in the gui |
protected void |
ontologyToComponent(org.ontoware.rdf2go.model.node.URI prop)
update the component based on the ontology info. |
protected abstract org.ontoware.rdf2go.model.node.Node |
readFromComponent(org.ontoware.rdf2go.model.Model model)
The value in the control has changed, return the actual value from the control. |
protected void |
removeListenerOnDataSet()
remove listeners on the dataset, if the dataset is ! |
protected void |
resourceToComponent()
write the data from the resource to the component Also enables/disables the component using enableComponent(boolean). |
void |
setComponent(T component)
|
void |
setDatatype(org.ontoware.rdf2go.model.node.URI datatype)
the datatype of the property. |
void |
setDetectDatatype(boolean detectDatatype)
before getting/setting values, detect the correct datatype to use based on the ontology |
void |
setProperty(org.ontoware.rdf2go.model.node.URI property)
set the property that this thing does visualise. |
void |
setPropertyAsString(String uri)
set the property as String. |
void |
setResourceDataSet(ResourceDataSet dataset)
set the resource data set. |
abstract void |
setToolTipTextOnComponent(String string)
override this implementing the tooltip text on the component. |
void |
setUseOntology(boolean useOntology)
set the value to true, so that the binder keeps the tooltip with the rdfs:comment of the property |
protected org.ontoware.rdf2go.model.node.Node |
stringToNode(String text,
org.ontoware.rdf2go.model.node.URI dt)
convert a string to a node, guessing the correct way using the datatype |
protected abstract void |
unbindComponent(T component)
unbind previously registered change listeners |
protected abstract void |
writeToComponent(org.ontoware.rdf2go.model.node.Node node)
The property of the resource has changed or is initalised. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private AbstractPropertyToComponentBinder.Listener listener
protected Logger log
private ResourceDataSet dataset
private org.ontoware.rdf2go.model.node.URI property
protected T component
private boolean useOntology
private int updatingComponent
private int updatingRdf
private boolean datatypeDetected
private boolean detectDatatype
private org.ontoware.rdf2go.model.node.URI datatype
| Constructor Detail |
|---|
public AbstractPropertyToComponentBinder()
public AbstractPropertyToComponentBinder(T component)
public AbstractPropertyToComponentBinder(T component,
ResourceDataSet dataset,
org.ontoware.rdf2go.model.node.URI property)
component - dataset - property - | Method Detail |
|---|
protected void addListenerOnDataSet()
protected void beginDataUpdate()
endDataUpdate()
in a try ... finally statement, otherwise the property binder
will be broken.
protected abstract void bindComponent(T component)
componentToResource()
component - the component to bind (is not null)protected void componentToResource()
public void dispose()
set methods but
calls removeListenerOnDataSet and unbindComponent directly.
protected abstract void enableComponent(boolean enabled)
enabled - true, if the component should be enabled, false if it should be disabledprotected void endDataUpdate()
protected void fireOntologyToComponent()
public T getComponent()
public org.ontoware.rdf2go.model.node.URI getDatatype()
public GnoFactory getGnoFactory()
public ModelDataSet getModelDataSet()
public org.ontoware.rdf2go.model.node.URI getProperty()
PropertyAware
getProperty in interface PropertyAwarepublic String getPropertyAsString()
public ResourceDataSet getResourceDataSet()
ResourceDataSetAware
getResourceDataSet in interface ResourceDataSetAwarepublic boolean getUseOntology()
public boolean isDetectDatatype()
public boolean isOpen()
protected void ontologyToComponent(org.ontoware.rdf2go.model.node.URI prop)
protected abstract org.ontoware.rdf2go.model.node.Node readFromComponent(org.ontoware.rdf2go.model.Model model)
getDatatype() if you wish to work with datatypes.
component - the component from which to read the valuemodel - the model in which the node should be created
protected void removeListenerOnDataSet()
protected void resourceToComponent()
enableComponent(boolean).
public void setComponent(T component)
component - The component to set.public void setDatatype(org.ontoware.rdf2go.model.node.URI datatype)
datatype - the datatype of the property.public void setDetectDatatype(boolean detectDatatype)
detectDatatype - detect the datatype from the ontologypublic void setProperty(org.ontoware.rdf2go.model.node.URI property)
PropertyAware
setProperty in interface PropertyAwareproperty - the propertyPropertyAware.setProperty(org.ontoware.rdf2go.model.node.URI)public void setPropertyAsString(String uri)
uri - the uri to use as property.public void setResourceDataSet(ResourceDataSet dataset)
ResourceDataSetAware
setResourceDataSet in interface ResourceDataSetAwaredataset - the datasetResourceDataSetAware.setResourceDataSet(org.gnogno.gui.dataset.ResourceDataSet)public abstract void setToolTipTextOnComponent(String string)
string - this is extracted from the property's rdfs comment.public void setUseOntology(boolean useOntology)
useOntology - The useOntology to set.
protected org.ontoware.rdf2go.model.node.Node stringToNode(String text,
org.ontoware.rdf2go.model.node.URI dt)
text - the text to convertdt - the datatype to use (usually retrieved using getDatatype())
protected abstract void unbindComponent(T component)
component - the component to unbind (is not null)protected abstract void writeToComponent(org.ontoware.rdf2go.model.node.Node node)
getDatatype() if you wish to work with datatypes.
The component can be retrieved via getComponent().
node - the node value to write, attention: the value may be null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||