public class IlvGanttDocumentWriter extends Object implements IlvSDXLConstants
IlvGanttDocumentWriter
class writes an IlvGanttModel
to an XML document. The document writer uses an IlvActivityWriter
, an
IlvResourceWriter
, an IlvConstraintWriter
, and an
IlvReservationWriter
to write the activities, resources, constraints,
and reservations, respectively. The usual sequence of writing an XML document
is:
IlvGanttDocumentWriter docWriter = new IlvGanttDocumentWriter(); docWriter.writeGanttModel(anXMLDocument, aGanttModel);If the root activity of the Gantt model is an instanceof
IlvNullActivity
, then the root activity will
be omitted from the XML document. Similarly, if the
root resource of the Gantt
model is an instanceof IlvNullResource
, then the root resource will
be omitted from the XML document.Modifier and Type | Class and Description |
---|---|
static class |
IlvGanttDocumentWriter.Context
The
IlvGanttDocumentWriter.Context class is the context object
passed to the IlvActivityWriter , IlvResourceWriter ,
IlvConstraintWriter , and IlvReservationWriter when a Gantt
model is being
written
to an XML document. |
ACTIVITIES_ELEMENT, ACTIVITY_ELEMENT, CONSTRAINT_ELEMENT, CONSTRAINTS_ELEMENT, DATE_FORMAT_ATTRIBUTE, LANGUAGE_ATTRIBUTE, RESERVATION_ELEMENT, RESERVATIONS_ELEMENT, RESOURCE_ELEMENT, RESOURCES_ELEMENT, SCHEDULE_ELEMENT
Constructor and Description |
---|
IlvGanttDocumentWriter()
Deprecated.
Please use the constructor that takes a
Locale
argument. |
IlvGanttDocumentWriter(Locale locale)
Creates an
IlvGanttDocumentWriter that uses an
IlvGeneralActivityWriter , an IlvGeneralResourceWriter ,
an IlvGeneralConstraintWriter , and an
IlvGeneralReservationWriter to write the activities, resources,
constraints, and reservations, respectively. |
Modifier and Type | Method and Description |
---|---|
IlvActivityWriter |
getActivityWriter()
Returns the activity writer.
|
IlvConstraintWriter |
getConstraintWriter()
Returns the constraint writer.
|
String |
getDateFormat()
Returns the date format used to write date variables of
the activities.
|
String |
getDescription()
Returns the description to be written for the Gantt model.
|
Locale |
getLocale()
Returns the locale used to convert dates to a textual representation.
|
PropertyEditor |
getPropertyEditor(Class type)
Returns the specified property editor for a type of properties.
|
IlvReservationWriter |
getReservationWriter()
Returns the reservation writer.
|
IlvResourceWriter |
getResourceWriter()
Returns the resource writer.
|
String |
getTitle()
Returns the title to be written for the Gantt model.
|
String |
getVersion()
Returns the version of the writer.
|
void |
setActivityWriter(IlvActivityWriter writer)
Sets the activity writer.
|
void |
setConstraintWriter(IlvConstraintWriter writer)
Sets the constraint writer.
|
void |
setDateFormat(String format)
Specifies the date format used to write date variables of
the activities.
|
void |
setDescription(String desc)
Sets the description to be written for the Gantt model.
|
void |
setLocale(Locale locale)
Sets the locale used to convert dates to a textual representation.
|
void |
setPropertyEditor(Class type,
PropertyEditor pe)
Specifies a property editor for a type of properties.
|
void |
setReservationWriter(IlvReservationWriter writer)
Sets the reservation writer.
|
void |
setResourceWriter(IlvResourceWriter writer)
Sets the resource writer.
|
void |
setTitle(String title)
Sets the title to be written for the Gantt model.
|
void |
setVersion(String version)
Returns the version of the writer.
|
void |
writeGanttModel(Document document,
IlvGanttModel model)
Writes the specified Gantt model to the given XML document.
|
void |
writeGanttModel(Element schedule,
IlvGanttModel model)
Writes the content of an
IlvGanttModel to the given
Element . |
@Deprecated public IlvGanttDocumentWriter()
Locale
argument.IlvGanttDocumentWriter
that doesn't write a locale
designator into the XML file.public IlvGanttDocumentWriter(Locale locale)
IlvGanttDocumentWriter
that uses an
IlvGeneralActivityWriter
, an IlvGeneralResourceWriter
,
an IlvGeneralConstraintWriter
, and an
IlvGeneralReservationWriter
to write the activities, resources,
constraints, and reservations, respectively.
Note that before the JViews 6.0 version, the writers used to be
IlvSimple*Writer
locale
- The locale used to convert dates to a textual representation,
see setLocale(java.util.Locale)
. Usually the value passed here is
IlvLocaleUtil.getCurrentLocale()
.setLocale(java.util.Locale)
public String getTitle()
writeGanttModel(Document, IlvGanttModel)
public void setTitle(String title)
title
- The title to be written for the Gantt model.writeGanttModel(Document, IlvGanttModel)
public String getDescription()
writeGanttModel(Document, IlvGanttModel)
public void setDescription(String desc)
desc
- The description to be written for the Gantt model.writeGanttModel(Document, IlvGanttModel)
public String getVersion()
writeGanttModel(Document, IlvGanttModel)
public void setVersion(String version)
version
- The version of the writer.writeGanttModel(Document, IlvGanttModel)
public Locale getLocale()
null
setLocale(java.util.Locale)
public void setLocale(Locale locale)
If the given locale is non-null
, it is used to convert dates
to a textual representation, and is designated through an
xml:lang
attribute. Such XML files can then be read in any
locale.
If the given locale is null
, the current locale is used to
convert dates to a textual representation, and no locale designator is
written into the XML file. Such XML files can only be read is the same
locale as the one in which they were written.
locale
- A locale, or null
.getLocale()
public String getDateFormat()
setDateFormat(java.lang.String)
,
getActivityWriter()
public void setDateFormat(String format)
format
- The new date format.getActivityWriter()
public IlvActivityWriter getActivityWriter()
public void setActivityWriter(IlvActivityWriter writer)
writer
- The new activity writer.public IlvResourceWriter getResourceWriter()
public void setResourceWriter(IlvResourceWriter writer)
writer
- The new resource writer.public IlvConstraintWriter getConstraintWriter()
public void setConstraintWriter(IlvConstraintWriter writer)
writer
- The new constraint writer.public IlvReservationWriter getReservationWriter()
public void setReservationWriter(IlvReservationWriter writer)
writer
- The new reservation writer.public PropertyEditor getPropertyEditor(Class type)
type
- A type of some properties.null
if none has been set.setPropertyEditor(Class, PropertyEditor)
public void setPropertyEditor(Class type, PropertyEditor pe)
type
- A type of some properties.pe
- A property editor for the given type.getPropertyEditor(Class)
public void writeGanttModel(Element schedule, IlvGanttModel model) throws Exception
IlvGanttModel
to the given
Element
. This method also writes the version,
the title and the description of the Gantt model. These parameters
are obtained by calling getVersion()
, getTitle()
,
and getDescription()
respectively.schedule
- The element to write to. Typically, this will be a
<schedule> element. The element must be already added to a
Document
. In other words, the
element.getOwnerDocument()
method must return a valid Document
.model
- The source Gantt model.Exception
- if an error occurs while writing the Gantt data model.public void writeGanttModel(Document document, IlvGanttModel model) throws Exception
document
- The document to write to.model
- The source Gantt model.Exception
- if an error occurs while writing the Gantt data model.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.