org.qriterium.dogma.gui
Class DogmaDBCommComponent

java.lang.Object
  extended by org.qriterium.dogma.gui.DogmaDBCommComponent

public class DogmaDBCommComponent
extends java.lang.Object

Used for containing the communication between resourcebase and other components. Keeps also track of the modified resources so that we can save only the modifications.


Field Summary
static ResourceBase resourceBase
           
 
Constructor Summary
DogmaDBCommComponent()
          Initiates the component and automatically searches for resources with "LAST_VIEW" in their tag.
DogmaDBCommComponent(boolean loadContent)
          Initiates the component without searching for a tag.
DogmaDBCommComponent(ResourceBase rb)
          Initiates the component with the given resourcebase and loads the last viewed resources to it.
DogmaDBCommComponent(ResourceBase base, boolean loadContent)
          Creates a new resourceComponent
 
Method Summary
 void addLastView()
          Adds "LAST_VIEW" - tags to the resources in the current resourcevector.
 void addResource(DogmaResource resource)
          Inserts a resource to the current vector.
 void cleanLastView()
          Cleans the "LAST_VIEW" - tags from the resourcebase.
 void close()
          Close the resourcebase and saves modifications.
 ResourceBase getResourceBase()
          Returns the current database in use.
 java.util.Vector<DogmaResource> getResourceVector()
          Gets the current Vector of DogmaResources in the DogmaDBCommComponent
 void insertQuerySet(java.util.Vector<DogmaResource> vector)
          Inserts the set of resources we got from a query to the vector and initiates the component with the new data.
 void insertResourcesFromTextFile(java.lang.String textFile)
          Uses DogmaQDUpdateParser to parse data from a textFile to resourceVector.
 void insertResourceVector(java.util.Vector<DogmaResource> vector)
          Inserts a vectorString to the current set
 void insertSet(java.util.Vector<DogmaResource> vector)
          Inserts the set of resources we got from a query to the vector and initiates the component.
 void setResourceBase(ResourceBase rb)
          Sets the resourcebase to rb
 int size()
          Returns the amount of resources in the component.
 void updateResource(DogmaResource resource)
          Update a resource to the resourceVector
 void updateResources()
          Saves the modifications to the database and clears the modified - vector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceBase

public static ResourceBase resourceBase
Constructor Detail

DogmaDBCommComponent

public DogmaDBCommComponent(ResourceBase base,
                            boolean loadContent)
Creates a new resourceComponent


DogmaDBCommComponent

public DogmaDBCommComponent(ResourceBase rb)
Initiates the component with the given resourcebase and loads the last viewed resources to it. content

Parameters:
rb -

DogmaDBCommComponent

public DogmaDBCommComponent(boolean loadContent)
Initiates the component without searching for a tag.


DogmaDBCommComponent

public DogmaDBCommComponent()
Initiates the component and automatically searches for resources with "LAST_VIEW" in their tag.

Method Detail

addLastView

public void addLastView()
Adds "LAST_VIEW" - tags to the resources in the current resourcevector.


cleanLastView

public void cleanLastView()
Cleans the "LAST_VIEW" - tags from the resourcebase.


size

public int size()
Returns the amount of resources in the component.

Returns:

insertQuerySet

public void insertQuerySet(java.util.Vector<DogmaResource> vector)
Inserts the set of resources we got from a query to the vector and initiates the component with the new data.


insertSet

public void insertSet(java.util.Vector<DogmaResource> vector)
Inserts the set of resources we got from a query to the vector and initiates the component. Saves modifications from the old vector.


insertResourceVector

public void insertResourceVector(java.util.Vector<DogmaResource> vector)
Inserts a vectorString to the current set

Parameters:
vector -

addResource

public void addResource(DogmaResource resource)
Inserts a resource to the current vector. (Inserts it to the modified - vector also, just in case.)


updateResource

public void updateResource(DogmaResource resource)
Update a resource to the resourceVector

Parameters:
resource -

updateResources

public void updateResources()
Saves the modifications to the database and clears the modified - vector.


insertResourcesFromTextFile

public void insertResourcesFromTextFile(java.lang.String textFile)
Uses DogmaQDUpdateParser to parse data from a textFile to resourceVector.

Parameters:
textFile -

getResourceVector

public java.util.Vector<DogmaResource> getResourceVector()
Gets the current Vector of DogmaResources in the DogmaDBCommComponent

Returns:

getResourceBase

public ResourceBase getResourceBase()
Returns the current database in use.

Returns:

setResourceBase

public void setResourceBase(ResourceBase rb)
Sets the resourcebase to rb

Parameters:
rb -

close

public void close()
Close the resourcebase and saves modifications. Adds also tags "LAST_VIEW" to the resources that were shown when the window was closing. IMPORTANT: Should only be used when the whole dogma-program closes since it also adds tags to the view so that they can be shown during the next startup.