cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when trying to disable "remove" button

fmeynard
1-Newbie

Problem when trying to disable "remove" button

Hi everyone,

I have to make a custom filter to deactivate some buttons when the root part (here the green/yellow cog) was on a specific state.

And when I select the other sub part (pink cog) the button will be disabled because of the root part.

As you can see on the picture, I successfully disable "Insert existing", "Insert new" (and the drop down actions), but I'm still stuck to disable "Remove" action.

image2016-4-27 14-8-39.png

What I know :

Create a new custom class filter : (It works !)

public class FilterEditStandartPart extends DefaultSimpleValidationFilter {

...

     if (root_part.getLifeCycleState().equals(States.RELEASED)) { // I do my test with this state, not the final state I need to use

          status = UIValidationStatus.DISABLED;

     }

...

}

Create a service on my "properties.xconf" file and propagate it : (service working)

<Service context="default" name="com.ptc.core.ui.validation.SimpleValidationFilter">

  <Option requestor="null" serviceClass="ext.sogerma.pbs.filters.FilterEditStandartPart" selector="filterEditStandartPart"/>

</Service>

Sample of my "custom-actions.xml" file :

<objecttype name="psb" resourceBundle="com.ptc.windchill.enterprise.part.psb.psbActionsRB">

     <!-- This one works perfectly -->

     <action name="insertExistingPartStructureGWT">

          <command class="com.ptc.cat.gxt.client.action.AdvancedAddAction"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.OneSelectionFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotUnspecifiedIterationFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.OriginalCopyFilter"/>

          <includeFilter name="disableForAdminLocked"/>

          <includeFilter name="disableForPartToCadBuildAdminLocked"/>

          <includeFilter name="disableForNewObjectInWorkspace"/>

          <includeFilter name="insertExistingPartImplementationChooser"/>

          <includeFilter name="filterEditStandartPart"></includeFilter>

            <supportedTypes>

                <type value="wt.part.WTPart"/>

                <type value="wt.part.WTPartUsageLink"/>

                <type value="wt.part.PartUsesOccurrence"/>

                <type value="wt.part.RTPartPathOccurrence"/>

            </supportedTypes>

    </action>

    <!-- This is my problem, it seem not working or maybe it's override by something else -->

    <action name="removeGWT">

          <command class="com.ptc.windchill.enterprise.part.psb.client.action.PSBRemoveAction"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.OneOrMoreSelectionFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotRootStructureModelFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotSummaryRowFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.ParentOriginalCopyFilter"/>

          <includeFilter name="com.ptc.windchill.enterprise.part.psb.client.action.ReplacementPartTypeFilter"/>

          <includeFilter name="disableForNewObjectInWorkspace"/>

          <includeFilter name="disableForParentInTreeAdminLocked"/>

          <includeFilter name="disableForPartToCadBuildParentInTreeAdminLocked"/>

          <includeFilter name="disableForNewParentObjectInWorkspace"/>

          <includeFilter name="filterEditStandartPart"></includeFilter>

          <supportedTypes>

              <type value="wt.part.WTPart"/>

              <type value="wt.part.WTPartMaster"/>

              <type value="wt.part.WTPartUsageLink"/>

              <type value="wt.part.PartUsesOccurrence"/>

              <type value="wt.doc.WTDocument"/>

              <type value="wt.doc.WTDocumentMaster"/>

              <type value="wt.part.WTPartDescribeLink"/>

              <type value="wt.part.WTPartReferenceLink"/>

              <type value="wt.part.RTPartPathOccurrence"/>

          </supportedTypes>

    </action>

    <!-- This one works great to disable "Remove" button on the "Uses" tab -->

    <action name="removeChildPartGWT">

          <command class="com.ptc.windchill.enterprise.part.psb.client.action.PSBRemoveAction"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.OneOrMoreSelectionFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotRootStructureModelFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.ParentOriginalCopyFilter"/>

          <includeFilter name="disableForNewObjectInWorkspace"/>

          <includeFilter name="disableForTableContextAdminLocked"/>

          <includeFilter name="disableForPartToCadBuildParentInTreeAdminLocked"/>

          <includeFilter name="disableForNewParentObjectInWorkspace"/>

          <includeFilter name="filterEditStandartPart"></includeFilter>

          <supportedTypes>

              <type value="wt.part.WTPart"/>

              <type value="wt.part.WTPartMaster"/>

              <type value="wt.part.WTPartUsageLink"/>

              <type value="wt.part.PartUsesOccurrence"/>

              <type value="wt.doc.WTDocument"/>

              <type value="wt.doc.WTDocumentMaster"/>

              <type value="wt.part.WTPartDescribeLink"/>

              <type value="wt.part.WTPartReferenceLink"/>

              <type value="wt.part.RTPartPathOccurrence"/>

          </supportedTypes>

    </action>

</objecttype>

I try to debug the method used on "DefaultSimpleValidationFilter" : public UIValidationStatus preValidateAction(UIValidationKey aValKey, UIValidationCriteria aValCrit) {...}

When I refresh the page or clic on another part, I don't see the "removeGWT" in "aValKey" param.

I see some other I configure and I see the "removeChildPartGWT" when I click on a "Uses" part.

I really need to deactivate this button when the root part was on a specific state, my customer need it to prevent removing part ! (and I can't say him to no click on it )

Do you have an idea of why this not work with "removeGWT" and/or a solution to disable it ?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

So with my colleagues, we try to debug "DisableForNewObjectInWorkspaceFilter" to find a "remove" action.

We found "removeServiceModelGWT" and so that the solution.

THE solution : You need to add in your "custom-actions.xml" this part to "catch" the remove structure button in your filter class :

<objecttype name="rulespartseditor" resourceBundle="com.ptc.arbortext.windchill.rulespartseditor.RulesPartsEditorActionsRB">

     <action name="removeServiceModelGWT">

          <command class="com.ptc.arbortext.windchill.rulespartseditor.structure.client.action.RemoveMetaServiceModelAction"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.OneOrMoreSelectionFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotRootStructureModelFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotSummaryRowFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.ParentOriginalCopyFilter"/>

          <includeFilter name="com.ptc.windchill.enterprise.part.psb.client.action.ReplacementPartTypeFilter"/>

          <includeFilter name="com.ptc.arbortext.windchill.rulespartseditor.structure.client.action.OneTreeNodeSelectionFilter"/>

          <includeFilter name="disableForNewObjectInWorkspace"/>

          <includeFilter name="disableForParentInTreeAdminLocked"/>

          <includeFilter name="disableForNewParentObjectInWorkspace"/>

          <includeFilter name="your_Filter_Service_Here"/>

          <supportedTypes>

               <type value="wt.part.WTPart"/>

               <type value="wt.part.WTPartMaster"/>

               <type value="wt.part.WTPartUsageLink"/>

               <type value="wt.part.PartUsesOccurrence"/>

               <type value="wt.doc.WTDocument"/>

               <type value="wt.doc.WTDocumentMaster"/>

               <type value="wt.part.WTPartDescribeLink"/>

               <type value="wt.part.WTPartReferenceLink"/>

               <type value="wt.part.RTPartPathOccurrence"/>

          </supportedTypes>

     </action>

</objecttype>

Greetings

View solution in original post

1 REPLY 1

So with my colleagues, we try to debug "DisableForNewObjectInWorkspaceFilter" to find a "remove" action.

We found "removeServiceModelGWT" and so that the solution.

THE solution : You need to add in your "custom-actions.xml" this part to "catch" the remove structure button in your filter class :

<objecttype name="rulespartseditor" resourceBundle="com.ptc.arbortext.windchill.rulespartseditor.RulesPartsEditorActionsRB">

     <action name="removeServiceModelGWT">

          <command class="com.ptc.arbortext.windchill.rulespartseditor.structure.client.action.RemoveMetaServiceModelAction"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.OneOrMoreSelectionFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotRootStructureModelFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.IsNotSummaryRowFilter"/>

          <includeFilter name="com.ptc.cat.ui.client.internal.action.ParentOriginalCopyFilter"/>

          <includeFilter name="com.ptc.windchill.enterprise.part.psb.client.action.ReplacementPartTypeFilter"/>

          <includeFilter name="com.ptc.arbortext.windchill.rulespartseditor.structure.client.action.OneTreeNodeSelectionFilter"/>

          <includeFilter name="disableForNewObjectInWorkspace"/>

          <includeFilter name="disableForParentInTreeAdminLocked"/>

          <includeFilter name="disableForNewParentObjectInWorkspace"/>

          <includeFilter name="your_Filter_Service_Here"/>

          <supportedTypes>

               <type value="wt.part.WTPart"/>

               <type value="wt.part.WTPartMaster"/>

               <type value="wt.part.WTPartUsageLink"/>

               <type value="wt.part.PartUsesOccurrence"/>

               <type value="wt.doc.WTDocument"/>

               <type value="wt.doc.WTDocumentMaster"/>

               <type value="wt.part.WTPartDescribeLink"/>

               <type value="wt.part.WTPartReferenceLink"/>

               <type value="wt.part.RTPartPathOccurrence"/>

          </supportedTypes>

     </action>

</objecttype>

Greetings

View solution in original post

Announcements