专业化管理 > 定制业务对象 > 对象初始化规则管理 > 使用对象初始化规则 > 规则算法 > 文件夹位置字段约束算法的使用
  
文件夹位置字段约束算法的使用
为了控制用户选择文件夹路径时所显示的文件夹位置选项,Windchill 用户界面允许您在 AttrConstraints 标记中为 folder.id 属性指定约束算法的组合。
* 
在将约束与 folder.id 属性结合使用时,假定同时设置了默认值 (如设置默认文件夹路径示例中所述)。
下列文件夹位置选项可用:
通过指定 GetServerPreGeneratedValue 算法 (该算法显示为 folder.id 属性设置的默认值) 将位置显示为预生成的只读值。
要自动使用该选项,还需指定 GetImmutableConstraint 算法。例如:
<AttrValue id="folder.id"
algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Arg>/Default</Arg>
</AttrValue>
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
</AttrConstraint>
如下所示:
在此示例中,folder.id 属性的默认值为 /GOLF_CART。
通过指定 GetServerAssignedConstraint 算法将位置显示为自动从为 folder.id 属性所设置的默认值生成的只读值。
要自动使用该选项,还需指定 GetImmutableConstraint 算法。例如:
<AttrValue id="folder.id"
algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Arg>/Default</Arg>
</AttrValue>
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
</AttrConstraint>
如下所示:
显示位置,这样用户就可以使用显示在字段中的文件夹位置,或者浏览不同的文件夹来选择文件夹。
用来确定最初显示在字段中的文件夹位置的逻辑将用户界面中的所有不同位置均考虑在内,用户可以从这些位置选择文件夹,并为每个文件夹显示最适合的位置。例如,当用户在与“设计”文件夹关联的“文件夹内容”表中单击图标来创建对象时,在字段中显示的文件夹位置就是在其中单击图标的文件夹 (在本例中是 /GOLF_CART/Design)。
如果您指定了空的约束算法列表,则该选项可自动运行。例如:
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"\>
如下所示:
通过分配 GetServerAssignedConstraint 算法或 GetServerPreGeneratedValue 算法,该选项也可与其他选项搭配使用。
* 
要显示该选项,您不得在约束列表中指定 GetImmutableConstraint 算法。
有关显示文件夹位置字段的受支持用户界面选项与用于生成显示的约束算法的组合的示例,请参阅“基本自定义”部分中的位置