com.miginfocom.beans
Class DemoDataBean

java.lang.Object
  extended by com.miginfocom.calendar.category.Category
      extended by com.miginfocom.beans.DemoDataBean
All Implemented Interfaces:
AdjustingPropertyConsumer, PropertyConsumer, PropertyObservable, PropertyProvider, java.io.Serializable, java.lang.Comparable, javax.swing.tree.TreeNode

public class DemoDataBean
extends Category
implements java.io.Serializable

A JavaBean that can be used to create some random demo activities.

This class should only be used to test activity handling. Performance is sub-par for anything else since the demo data will be recreated for every setXxx method called.

The algorithm start from the earliest time (set in the propertis of this class) and the randomizing values (normally between some min/max value) for all properties of the activity until the end time is reached.

See Also:
ActivityHelper#createActivities(com.miginfocom.util.dates.DateRangeI, String[], String[], Object[], Object[][], int, int, int, int, int, int), Serialized Form

Field Summary
 
Fields inherited from class com.miginfocom.calendar.category.Category
ALL_PROPERTIES_CHANGED_NAME, ICON, oo, PROP_ALLOWS_CHILDREN, PROP_CATEGORY_SORTER, PROP_CHILDREN_IDS, PROP_ICON, PROP_ID, PROP_IS_HIDDEN, PROP_IS_LEAF, PROP_LAST_MODIFIED_MILLIS, PROP_NAME, PROP_PARENT_IDS, PROP_STATUS
 
Constructor Summary
DemoDataBean()
           
 
Method Summary
 void createDemoData()
          This method will create the demo data.
 ImmutableDateRange geDataDateRange()
          Property: The date range that the demo data will be created for.
 java.lang.String getActivityCategories()
          Property: A comma separated list of main categories that all activities will get one (random) of.
 java.lang.String getActivityDepositoryContext()
          Property: The context used to get the depository to put all generated demo activities in.
 java.lang.String getCategories()
          Property: A comma separated list with special chars of main categories that will be created in the CategoryDepository.
 java.lang.String getDescriptionTexts()
          Property: A comma separated list of description texts that will randomly be selected from for every created activity.
 int getGapMinutesMax()
          Property: The maximum minutes that should pass between two generated activities.
 int getGapMinutesMin()
          Property: The minimum minutes that has to pass between two generated activities.
 int getLengthMinutesMax()
          Property: The maximum number of minutes that an activity should span.
 int getLengthMinutesMin()
          Property: The minimum number of minutes that an activity should span.
 java.util.Locale getLocale()
          Property: The locale to set for every created Activity.
 int getMaxActivityCount()
          Property: The maximum number of activities generated.
 int getRoundToMinutes()
          Property: The number of minutes to round to.
 java.lang.String getSummaryTexts()
          Property: A comma separated list of summaries that will randomly be selected from for every created activity.
 java.util.TimeZone getTimeZone()
          Property: The time zone to set for every created Activity.
 boolean isDemoDataCreated()
          Returns if this bean should generate demo data or not.
 boolean isEnabled()
          Property: If the demo data bean is enabled or not.
 boolean isOnlyDesignTime()
          Property: If the demo date should only be created in a design time environment.
 void removeDemoData()
          This method will remove the demo data.
 void setActivityCategories(java.lang.String actCats)
          Property: A comma separated list of main categories that all activities will get one (random) of.
 void setActivityDepositoryContext(java.lang.String ctx)
          Property: The context used to get the depository to put all generated demo activities in.
 void setCategories(java.lang.String cats)
          Property: A comma separated list with special chars of main categories that will be created in the CategoryDepository.
 void setDataDateRange(ImmutableDateRange dateRange)
          Property: The date range that the demo data will be created for.
 void setDescriptionTexts(java.lang.String descrTexts)
          Property: A comma separated list of description texts that will randomly be selected from for every created activity.
 void setEnabled(boolean b)
          Property: If the demo data bean is enabled or not.
 void setGapMinutesMax(int minutes)
          Property: The maximum minutes that should pass between two generated activities.
 void setGapMinutesMin(int minutes)
          Property: The minimum minutes that has to pass between two generated activities.
 void setLengthMinutesMax(int minutes)
          Property: The maximum number of minutes that an activity should span.
 void setLengthMinutesMin(int minutes)
          Property: The minimum number of minutes that an activity should span.
 void setLocale(java.util.Locale locale)
          Property: The locale to set for every created Activity.
 void setMaxActivityCount(int count)
          Property: The maximum number of activities generated.
 void setOnlyDesignTime(boolean b)
          Property: If the demo date should only be created in a design time environment.
 void setRoundToMinutes(int minutes)
          Property: The number of minutes to round to.
 void setSummaryTexts(java.lang.String sumTexts)
          Property: A comma separated list of summaries that will randomly be selected from for every created activity.
 void setTimeZone(java.util.TimeZone timeZone)
          Property: The time zone to set for every created Activity.
 
Methods inherited from class com.miginfocom.calendar.category.Category
addParent, addPropertyListener, addPropertyListener, addStaticPropertyChangeListener, addSubCategory, addSubCategory, children, compareTo, containsProperty, createSubCategory, endAdjusting, equals, findCategoryByName, firePropertyChangeEvent, fireStaticPropertyChangeEvent, getAllowsChildren, getChildAt, getChildCount, getChildren, getChildrenDeep, getChildrenDeep, getChildrenIDs, getDeepDownwards, getDeepUpwards, getId, getIndex, getLastModified, getMaxDepth, getName, getParent, getParentCategory, getParentIDs, getParents, getProperty, getPropertyDeep, getPropertyDeep, getPropertyMap, getPropertyValidator, getSubCategoryAt, hashCode, isAdjusting, isIgnorePropertyEvents, isLeaf, isRoot, removeProperty, removePropertyListener, removePropertySilent, removeStaticPropertyChangeListener, removeSubCategory, removeSubCategoryDeep, rollbackAdjusting, setId, setIgnorePropertyEvents, setLastModified, setLeaf, setName, setParentID, setParents, setProperty, setPropertyDeep, setPropertyDeep, setPropertyMap, setPropertySilent, setPropertyValidator, sort, sort, sortDeep, startAdjusting, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DemoDataBean

public DemoDataBean()
Method Detail

isEnabled

public boolean isEnabled()
Property: If the demo data bean is enabled or not. If not enabled the demo data will never be created.

Returns:
If the demo data bean is enabled or not.

setEnabled

public void setEnabled(boolean b)
Property: If the demo data bean is enabled or not. If not enabled the demo data will never be created.

Parameters:
b - If the demo data bean should be enabled or not.

isDemoDataCreated

public boolean isDemoDataCreated()
Returns if this bean should generate demo data or not.

Returns:
true is demo data has been generated.

createDemoData

public void createDemoData()
This method will create the demo data.

See Also:
ActivityDepository.getInstance(String), setEnabled(boolean)

removeDemoData

public void removeDemoData()
This method will remove the demo data.

See Also:
ActivityDepository.getInstance(String)

getActivityDepositoryContext

public java.lang.String getActivityDepositoryContext()
Property: The context used to get the depository to put all generated demo activities in.

Returns:
The current context. May be null.
See Also:
ActivityDepository.getInstance(String)

setActivityDepositoryContext

public void setActivityDepositoryContext(java.lang.String ctx)
Property: The context used to get the depository to put all generated demo activities in.

This method will recreated the demo data which may take some time.

Parameters:
ctx - The new context. May be null.
See Also:
ActivityDepository.getInstance(String), ActivityHelper#createActivities(com.miginfocom.util.dates.DateRangeI, String[], String[], Object[], Object[][], int, int, int, int, int, int)

getCategories

public java.lang.String getCategories()
Property: A comma separated list with special chars of main categories that will be created in the CategoryDepository.

Returns:
The current comma separeted list with categories (and special chars).
See Also:
setCategories(String)

setCategories

public void setCategories(java.lang.String cats)
Property: A comma separated list with special chars of main categories that will be created in the CategoryDepository.

The list can be used to create a hierarchy (tree) of categories.

This method will recreated the demo data which may take some time.

Parameters:
cats - The comma separated category ids. For every element, if first char is a "+" the category catIDs[catIx] will be a folder beneath addToNode and the rest will be added to this new fonder. If the first char is one or more "-" the category catIDs[catIx] will be added to the parent that many levels up from addToNode. If not "+" or "-" then catIDs[catIx] will just be added to addToNode.

"-" and "+" can be combined but "-" must always be first if so. For instacne "-+Folder" creates a folder in the parent category.


getActivityCategories

public java.lang.String getActivityCategories()
Property: A comma separated list of main categories that all activities will get one (random) of.

Returns:
The current comma separated list. May be null.
See Also:
ActivityHelper#createActivities(com.miginfocom.util.dates.DateRangeI, String[], String[], Object[], Object[][], int, int, int, int, int, int)

setActivityCategories

public void setActivityCategories(java.lang.String actCats)
Property: A comma separated list of main categories that all activities will get one (random) of.

This method will recreated the demo data which may take some time.

Parameters:
actCats - The new comma separated list. May be null in which case the activities will get no categories.
See Also:
ActivityHelper#createActivities(com.miginfocom.util.dates.DateRangeI, String[], String[], Object[], Object[][], int, int, int, int, int, int)

getSummaryTexts

public java.lang.String getSummaryTexts()
Property: A comma separated list of summaries that will randomly be selected from for every created activity.

Returns:
The current list. Never null but may be "":

setSummaryTexts

public void setSummaryTexts(java.lang.String sumTexts)
Property: A comma separated list of summaries that will randomly be selected from for every created activity.

This method will recreated the demo data which may take some time.

Parameters:
sumTexts - The new list. null is converted to "":

getDescriptionTexts

public java.lang.String getDescriptionTexts()
Property: A comma separated list of description texts that will randomly be selected from for every created activity.

Returns:
The current list. Never null but may be "":

setDescriptionTexts

public void setDescriptionTexts(java.lang.String descrTexts)
Property: A comma separated list of description texts that will randomly be selected from for every created activity.

This method will recreated the demo data which may take some time.

Parameters:
descrTexts - The new list. null is converted to "":

getTimeZone

public java.util.TimeZone getTimeZone()
Property: The time zone to set for every created Activity.

Returns:
The current time zone used. May be null.

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
Property: The time zone to set for every created Activity.

This method will recreated the demo data which may take some time.

Parameters:
timeZone - The new time zone to use. May be null.

getLocale

public java.util.Locale getLocale()
Property: The locale to set for every created Activity.

Returns:
The current locale used. May be null.

setLocale

public void setLocale(java.util.Locale locale)
Property: The locale to set for every created Activity.

This method will recreated the demo data which may take some time.

Parameters:
locale - The new time zone to use. May be null.

geDataDateRange

public ImmutableDateRange geDataDateRange()
Property: The date range that the demo data will be created for. Not null.

Returns:
The current range. Not null.

setDataDateRange

public void setDataDateRange(ImmutableDateRange dateRange)
Property: The date range that the demo data will be created for. Not null.

The demo data will not be recreated. Call recreateDemoData() for that.

Parameters:
dateRange - The new range. Not null.

getGapMinutesMin

public int getGapMinutesMin()
Property: The minimum minutes that has to pass between two generated activities. If a negative value they may sometimes overlap.

Returns:
The current number of minutes. May be negative.

setGapMinutesMin

public void setGapMinutesMin(int minutes)
Property: The minimum minutes that has to pass between two generated activities. If a negative value they may sometimes overlap.

This method will recreated the demo data which may take some time.

Parameters:
minutes - The new number of minutes. May be negative.

getGapMinutesMax

public int getGapMinutesMax()
Property: The maximum minutes that should pass between two generated activities. Should not be negative.

Returns:
The current number of minutes. Not negative.

setGapMinutesMax

public void setGapMinutesMax(int minutes)
Property: The maximum minutes that should pass between two generated activities. Should not be negative.

This method will recreated the demo data which may take some time.

Parameters:
minutes - The new number of minutes. Not negative.

getRoundToMinutes

public int getRoundToMinutes()
Property: The number of minutes to round to. For instance if 5 all activities start and end times will be rounded to five minutes intervals (0, 5, 10, 15 etc..).

Returns:
The current value.

setRoundToMinutes

public void setRoundToMinutes(int minutes)
Property: The number of minutes to round to. For instance if 5 all activities start and end times will be rounded to five minutes intervals (0, 5, 10, 15 etc..).

This method will recreated the demo data which may take some time.

Parameters:
minutes - The new value.

getLengthMinutesMin

public int getLengthMinutesMin()
Property: The minimum number of minutes that an activity should span.

Returns:
The current value.

setLengthMinutesMin

public void setLengthMinutesMin(int minutes)
Property: The minimum number of minutes that an activity should span.

This method will recreated the demo data which may take some time.

Parameters:
minutes - The new value.

getLengthMinutesMax

public int getLengthMinutesMax()
Property: The maximum number of minutes that an activity should span.

Returns:
The current value.

setLengthMinutesMax

public void setLengthMinutesMax(int minutes)
Property: The maximum number of minutes that an activity should span.

This method will recreated the demo data which may take some time.

Parameters:
minutes - The new value.

getMaxActivityCount

public int getMaxActivityCount()
Property: The maximum number of activities generated. This is mostly to avoid creation of too many due to choosing the the properties for this bean badly. It's a fail safe...

Returns:
The current value. Default is 200.

setMaxActivityCount

public void setMaxActivityCount(int count)
Property: The maximum number of activities generated. This is mostly to avoid creation of too many due to choosing the the properties for this bean badly. It's a fail safe...

This method will recreated the demo data which may take some time.

Parameters:
count - The new value. Default is 200.

isOnlyDesignTime

public boolean isOnlyDesignTime()
Property: If the demo date should only be created in a design time environment. This usually means in the designer of the IDE.

Returns:
The current value. Default is false.

setOnlyDesignTime

public void setOnlyDesignTime(boolean b)
Property: If the demo date should only be created in a design time environment. This usually means in the designer of the IDE.

This method will recreated the demo data which may take some time.

Parameters:
b - The new value.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.