SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A phrase whose children are all components of a given type-name. More...
#include <NodeGroupPhraseContent.h>
Public Member Functions | |
smtkTypeMacro (smtk::view::NodeGroupPhraseContent) | |
smtkSharedPtrCreateMacro (PhraseContent) | |
std::string | childType () const |
Return the class type-name of the type of component that should be listed in our subphrases. | |
Ptr | setup (smtk::view::DescriptivePhrasePtr parent, const std::string &childType, const std::string &singular=std::string(), const std::string &plural=std::string(), int mutability=0) |
Initialize this list with an iterable container of subphrases. More... | |
bool | displayable (ContentType attr) const override |
Should attr be present in the visual display of the phrase? | |
bool | editable (ContentType attr) const override |
Is attr editable or fixed (for information/display only)? | |
std::string | stringValue (ContentType attr) const override |
Return a string that reflects the given attr value. | |
int | flagValue (ContentType attr) const override |
Return an integer bit-flag that reflects the given attr value. | |
bool | editStringValue (ContentType attr, const std::string &val) override |
Edit the attr value to become the given string (or returns false if no-change/invalid). | |
bool | editFlagValue (ContentType attr, int val) override |
Edit the attr value to become the given flag (or returns false if no-change/invalid). | |
smtk::resource::ComponentArray | relatedComponents () const |
A convenience method for obtaining related components for each of the phrases in the list. More... | |
template<typename T > | |
T | relatedComponentsAs () const |
A convenience method for obtaining related components in a user-specified container. More... | |
void | setMutability (int whatsMutable) |
void | setCustomTitle (const std::string &title) |
This method is for subphrase generators that wish to customize the list title. More... | |
bool | operator== (const PhraseContent &other) const override |
Public Member Functions inherited from smtk::view::PhraseContent | |
smtkTypeMacroBase (PhraseContent) | |
virtual smtk::resource::ResourcePtr | relatedResource () const |
Return the resource related to this phrase (or nullptr if not well defined). | |
virtual smtk::resource::Resource * | relatedRawResource () const |
virtual smtk::resource::ComponentPtr | relatedComponent () const |
Return the resource component related to this phrase (or nullptr if not well defined). | |
virtual smtk::resource::Component * | relatedRawComponent () const |
virtual smtk::resource::PersistentObjectPtr | relatedObject () const |
Return the persistent object related to this phrase (or nullptr if not well defined). More... | |
virtual smtk::operation::OperationPtr | relatedOperation () const |
Return an operator related to this phrase (or nullptr if not well defined). | |
bool | equalTo (const PhraseContent &other) const |
Test for use in derived-class equality operators. | |
DescriptivePhrasePtr | location () const |
Return the location of this content in a DescriptivePhrase hierarchy. More... | |
bool | setLocation (DescriptivePhrasePtr locn) |
Set the descriptive phrase that will present this content. More... | |
Static Public Member Functions | |
static smtk::view::DescriptivePhrasePtr | createPhrase (smtk::view::DescriptivePhrasePtr parent, const std::string &childType, const std::string &singular=std::string(), const std::string &plural=std::string(), int mutability=0, const smtk::view::DescriptivePhrases &children=smtk::view::DescriptivePhrases()) |
Create a descriptive phrase whose content is a NodeGroupPhraseContent instance. More... | |
Protected Member Functions | |
void | defaultSingularPlural () |
std::string | generateTitle () const |
Protected Attributes | |
int | m_mutability { 0 } |
std::string | m_childType |
std::string | m_singular |
std::string | m_plural |
std::string | m_title |
Protected Attributes inherited from smtk::view::PhraseContent | |
WeakDescriptivePhrasePtr | m_location |
Additional Inherited Members | |
Public Types inherited from smtk::view::PhraseContent | |
enum | ContentType { TITLE = 0x01, EDITABLE_TITLE = 0x02, SUBTITLE = 0x04, COLOR = 0x08, VISIBILITY = 0x10, ICON_LIGHTBG = 0x20, ICON_DARKBG = 0x40, EVERYTHING = 0xff } |
Accepted types of content. More... | |
A phrase whose children are all components of a given type-name.
Subphrase generators create instances of this class when they wish to aggregate nodes of a given type.
Instances of this class generate their titles based on the number of child items they have and the singular/plural form of the type name you provide. If no singular/plural type-names are provided, the childType() will be truncated to just text beyond the last double-colon and downcased. For example, if a NodeGroupPhraseContent has a childType() of "smtk::foo::Bar" and 3 children, its title will be "3 bars". If a single child exists, the title will be "1 bar."
|
static |
Create a descriptive phrase whose content is a NodeGroupPhraseContent instance.
This creates a phrase that a subphrase generator can expand on by calling parent->parent()->relatedResource()->filter(childType)
.
smtk::resource::ComponentArray smtk::view::NodeGroupPhraseContent::relatedComponents | ( | ) | const |
A convenience method for obtaining related components for each of the phrases in the list.
The list of entities to be presented.
|
inline |
A convenience method for obtaining related components in a user-specified container.
This method dynamically casts each phrase's relatedComponent() to the given container's type and back-inserts it into a new container of the templated type. Use this method when you know the components of interest in the array are a given subclass of smtk::resource::Component (e.g., smtk::model::Entity) by passing in a container of that type (e.g., relatedComponentsAs<smtk::model::EntityArray>()).
|
inline |
This method is for subphrase generators that wish to customize the list title.
This method is only intended for setup and ignores the mutability of the title, unlike setTitle(). Generally, this method should only be called when the title is not mutable.
NodeGroupPhraseContent::Ptr smtk::view::NodeGroupPhraseContent::setup | ( | smtk::view::DescriptivePhrasePtr | parent, |
const std::string & | childType, | ||
const std::string & | singular = std::string() , |
||
const std::string & | plural = std::string() , |
||
int | mutability = 0 |
||
) |
Initialize this list with an iterable container of subphrases.
This templated method is provided so that arrays of shared-pointers to subclasses of DescriptivePhrase are also accepted. It is mostly intended for use by SubphraseGenerator and its subclasses.