public class SetAttributeValueFragment extends com.sodius.mdw.internal.metamodel.doors.io.commands.SetAttributeFragmentImpl implements ShareModuleFragment
The attribute value might contains rich text formatting and might also include attachment content (to be inserted as OLE objects in DOORS). Refer to the constructors of this class for details.
This fragment is intended to be combined into an EditModuleCommand
instance.
Below is a snippet illustrating how to use this fragment (see CommandRunner
for a full snippet):
ModuleRef module = ModuleRef.qualifiedName("/MyFolder/MyModule"); EditModuleCommand command = new EditModuleCommand(module, TerminationMode.SAVE_AND_CLOSE); ObjectRef object = ObjectRef.absoluteNumber(4); command.add(new SetAttributeValueFragment(object, "Object Heading", "test")); RichText text = RichText.valueOf("<html><body><p>Some <b>formatted</b> <i>text</id></p></body></html>"); command.add(new SetAttributeValueFragment(object, "Object Text", text)); myCommandRunner.run(command);
This class is not intended to be subclassed by clients but may be instantiated.
CommandRunner
,
EditModuleCommand
Constructor and Description |
---|
SetAttributeValueFragment(LinkRef link,
String attributeName,
boolean value)
Instantiates a fragment to update the attribute boolean value of specified link.
|
SetAttributeValueFragment(LinkRef link,
String attributeName,
Date value)
Instantiates a fragment to update the attribute Date value of specified link.
|
SetAttributeValueFragment(LinkRef link,
String attributeName,
float value)
Instantiates a fragment to update the attribute real value of specified link.
|
SetAttributeValueFragment(LinkRef link,
String attributeName,
int value)
Instantiates a fragment to update the attribute integer value of specified link.
|
SetAttributeValueFragment(LinkRef link,
String attributeName,
List<String> literals)
Instantiates a fragment to update the attribute enumerated value of specified link.
|
SetAttributeValueFragment(LinkRef link,
String attributeName,
RichText value)
Instantiates a fragment to update the attribute string value of specified link.
|
SetAttributeValueFragment(LinkRef link,
String attributeName,
String value)
Instantiates a fragment to update the attribute string value of specified link.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
boolean value)
Instantiates a fragment to update the attribute boolean value of specified object.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
Date value)
Instantiates a fragment to update the attribute Date value of specified object.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
float value)
Instantiates a fragment to update the attribute real value of specified object.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
int value)
Instantiates a fragment to update the attribute integer value of specified object.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
List<String> literals)
Instantiates a fragment to update the attribute enumerated value of specified object.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
RichText value)
Instantiates a fragment to update the attribute textual value of specified object.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
RichText value,
AttachmentResolver attachmentResolver)
Instantiates a fragment to update the attribute textual value of specified object,
textual value which may contain attachments to be included as OLE objects.
|
SetAttributeValueFragment(ObjectRef object,
String attributeName,
String value)
Instantiates a fragment to update the attribute string value of specified object.
|
SetAttributeValueFragment(String attributeName,
boolean value)
Instantiates a fragment to update the attribute boolean value of the edited module.
|
SetAttributeValueFragment(String attributeName,
Date value)
Instantiates a fragment to update the attribute Date value of the edited module.
|
SetAttributeValueFragment(String attributeName,
float value)
Instantiates a fragment to update the attribute real value of the edited module.
|
SetAttributeValueFragment(String attributeName,
int value)
Instantiates a fragment to update the attribute integer value of the edited module.
|
SetAttributeValueFragment(String attributeName,
List<String> literals)
Instantiates a fragment to update the attribute enumerated value of the edited module.
|
SetAttributeValueFragment(String attributeName,
RichText value)
Instantiates a fragment to update the attribute textual value of the edited module.
|
SetAttributeValueFragment(String attributeName,
String value)
Instantiates a fragment to update the attribute string value of the edited module.
|
public SetAttributeValueFragment(String attributeName, RichText value)
The value might contains formatting, like the following one:
RichText text = RichText.valueOf("<html><body><p>Some <b>formatted</b> <i>text</id></p></body></html>");
attributeName
- the name of the module attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(String attributeName, int value)
attributeName
- the name of the module attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(String attributeName, float value)
attributeName
- the name of the module attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(String attributeName, boolean value)
attributeName
- the name of the module attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(String attributeName, Date value)
attributeName
- the name of the module attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(String attributeName, String value)
attributeName
- the name of the module attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(String attributeName, List<String> literals)
attributeName
- the name of the module attribute to update.literals
- the new literals to assign to the enumerated attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, RichText value)
The value might contains formatting, like the following one:
RichText text = RichText.valueOf("<html><body><p>Some <b>formatted</b> <i>text</id></p></body></html>");
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, RichText value, AttachmentResolver attachmentResolver)
The value might contains formatting, like the following one:
"<html><body><p>Some <b>formatted</b> <i>text</id></p></body></html>"
The value might also contain an embedded attachment, like the following one:
"<html><body><p>Attachment: <object data="myFile.docx"/></p></body></html>"
When an attachment is detected, attachment content is obtained using the specified AttachmentResolver
instance.
Picture attachment
If the attachment content is a picture (*.bmp
, *.gif
, *.png
, *.jpg
or *.jpeg
),
the behavior of the command depends on the existing object content:
OLE attachment
If the attachment content is not already embedded in RTF, DOORS client will activate the corresponding application to create an OLE wrapper for
the content (e.g. use Microsoft Word to import an *.docx
file). When running in a non interactive mode (e.g. running a Windows
Service or a Windows Scheduled Task), some applications are known to behave incorrectly for such use (e.g. Microsoft Word and Microsoft Excel).
In this case, setting the Java System property to -Ddoors.zipFileExtensions=docx,xlsx
can help to workaround the problem. Refer to
Common.OPTION_ZIP_FILE_EXTENSIONS
for details.
OLE preview image
By default, the DOORS client generates a preview image of the OLE object to insert and displays this preview in the attribute. There are some
types of OLE objects for which the DOORS client is not able to generate a preview image, in which case the OLE object is displayed as an icon
in the attribute. Since 3.8.4, you can force inserting an OLE object as an icon using an attachment with a asIcon
parameter, like
in the following snippet:
<html><body><p>OLE without preview: <object data="myFile.docx"><param name="asIcon" value="true"/></object></p></body></html>
Inline RTF attachment
The default behavior is to insert an RTF attachment as an OLE object. Since 3.8.1, an RTF attachment can be set as "inline" so that the RTF
content is inserted directly as is inside the attribute text instead of being inserted as an OLE object.
An inline RTF attachment is declared with a dedicated <param/>
element, like in the following snippet:
<html><body><p>Inline attachment: <object data="myFile.rtf"><param name="inline" value="true"/></object></p></body></html>
Nested attachments
Since 3.8.1, each RTF inline attachment is scanned to discover potential nested attachments. A nested attachment is declared with the following
RTF construct:
{\*\attachment myNestedAttachmentPath.rtf}
An nested attachment can also be set as inline with the following construct:
{\*\attachment\inline myNestedAttachmentPath.rtf}
This command recursively inserts nested attachments in the attribute text. Nested attachments can be handy to compose a complex attribute text.
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.attachmentResolver
- the resolver that enables to get access to the bytes of the logical attachments
that may exist in the inserted textual value.value
- the new value to assign to the attribute.Common.OPTION_ZIP_FILE_EXTENSIONS
public SetAttributeValueFragment(ObjectRef object, String attributeName, int value)
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, float value)
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, boolean value)
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, Date value)
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, String value)
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(ObjectRef object, String attributeName, List<String> literals)
object
- the object containing the attribute to update.attributeName
- the name of the object attribute to update.literals
- the new literals to assign to the enumerated attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, int value)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, float value)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, boolean value)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, Date value)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, String value)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, RichText value)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.value
- the new value to assign to the attribute.public SetAttributeValueFragment(LinkRef link, String attributeName, List<String> literals)
link
- the link containing the attribute to update.attributeName
- the name of the object attribute to update.literals
- the new literals to assign to the enumerated attribute.