camac / Swiper

Swiper Metadata Filter for Domino Designer Source Control
Apache License 2.0
16 stars 5 forks source link

Context menu Swiper\Filter Issue #20

Open sladeswan opened 7 years ago

sladeswan commented 7 years ago

It would seem that using the context menu option Swiper\Filter selected does not obey a configured Custom XSLT Filter. This is observed as there is different "Swipe" behaviour depending upon whether you save a design element or use the context menu option.

Unfortunately turning on logging does not show which xsl file is being used.

sladeswan commented 7 years ago

@camac , The following issues were exerperienced while creating a baseline version of existing applications for push to a GIT repositiory before subsequent work. I have attempted to understand why and try and work around the problems but without forking your code I haven't been able to take this any further. Maybe if and when you have time you could look to resolve the first issue as it is preventing me from using Swiper for any database with a button on a form. I have included a before and after file attachments and attached this as a comment to the above issue as it is all related to the actions of the Swiper\Filter Selected. I am using 9.0.1 FP8 SHF216 with the current version of Swiper.

  1. Use of appears to interfere with the subsequent rendering of buttons. A bunch of spaces are injected before the button label presumably due to the <font> tag not containing the label text in what might be subjectively described as well formed XML. I tried using a custom XSL file but upon further investigation I found that even setting indent="no" made no effect. I found that the custom XSL setting was being overwritten on the following lines of FilterMetadataAction.java.

140 transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 141 transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); Before: before swiper After: after swiper

  1. Upon using "Swiper\Filter Selected" of a "Page" from a traditional Notes application (ie non-xpages) with a computed image reference for the background image the following error is raised against the Page.

Description Resource Path Location Type background element is not allowed to have text content EXAMPLE.page EXAMPLE.ntf/Pages line 15 dxl.parse.problem

However, if I make a small change to the design element, save and open and close the application in designer the error disappears. I have not been able to trace this further. I thought I had noticed the issue to be related to a combination of the version, designerversion and maintenanceversion properties being swiped from the Page tag but I could not get consistent results. It appears to be directly related to the use of "Swiper\Filter Selected" rather than what's in the XSL file.

  1. Selecting only one element and then choosing Swiper\Filter Selected appears to update multiple ODP files. I don't know if this is meant to be the intended action.
camac commented 7 years ago

Thanks for the detailed Issue report. I'm sorry to hear the Swiper isn't quite working for you yet but hopefully I can help find a solution.

In regards to the Indent=No being overridden, I have some ideas of what I might be able to do. One option is to introduce a new preference option, which could be used to disable these OutputProperties from setting the indent="yes". It's possible that this might be a good idea for many of the classic notes elements

In regards to the Computed Page background I will do a test myself and see if I can replicate the error and come up with a solution

In regards to 3. 'Filter Selected' should run on whichever elements are selected in the Left application navigator. So I am not sure what is going on if it is filtering more that you expect. are you using the right-click context menu to trigger it? If you have selected a parent container option like 'Views' or 'Custom Controls' or something like that, it may filter all the elements beneath that type. Do you have build automatically on?

I have had a pretty busy couple of weeks so probably have a little break from computers this weekend but I will try to have a look at it one night next week. I might post a 'beta' release for you to test out as well.

sladeswan commented 7 years ago

@camac thanks for the quick reply. I know what you mean by needing a weekend off the tools, so to speak.

I don't profess to be an XSLT expert but would it not be possible to move the indent-amount configured from the within the code to the xslt file? Like ...

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xslt="http://xml.apache.org/xslt">

    <xsl:output method="xml" xslt:indent-amount="2" indent="yes"/>

If this worked then using a custom xslt filter could override the default. IMHO a good feature to add would be a "add swiper custom" action to a database with the configured custom xslt perhaps when the custom xsl file was configured. Of course this could be challenging as a "remove swiper custom" may also be necessary so you could realise which xsl type (custom/default) was used. I certainly see the benefit of indenting for easier merge comparisons for some databases.

Regards issue 3. The only reason I noticed this was during investigation of the above issue I had a number of ODP files open in notepad++. Having selected only one element for the right click "Filter Selected" (pretty sure I only selected one element), switching to notepad++ multiple alert dialogs saying files have been updated prompting to reload (which is standard for notepad++).

Again thanks in advance for anything you can manage to fit in. I am certainly encouraged by your build server solution and I hope to implement something similar given that the site I'm currently working uses Microsoft TFS which brings its own challenges.

xpagedeveloper commented 6 years ago

I'm still seeing this error also

<button
 width='2in' widthtype='maximum' maxlines='1' wraptext='true' bgcolor='system'
 htmlclass='formCancelButton'><code event='onClick' for='web'><javascript
>window.close();
</javascript></code><font size='7pt' name='Arial' pitch='variable' truetype='true'
 familyid='20'/>Cancel</button>

is becoming this after swiper has runned

<button width="2in" widthtype="maximum" maxlines="1" wraptext="true" bgcolor="system" htmlclass="formCancelButton">
          <code event="onClick" for="web">
            <javascript>window.close();
</javascript>
          </code>
          <code event="onClick" for="client">
            <javascript>window.close();
</javascript>
          </code>
          <font size="7pt" name="Arial" pitch="variable" truetype="true" familyid="20"/>

          Cancel</button>
sladeswan commented 6 years ago

@camac, I have confirmed the problem raised above can be resolved by removing the <xsl:output indent="yes"/> from the default xsl. But I also had to remove the transformer.setOutputProperty(OutputKeys.INDENT, "yes"); and rebuild the plugin. I haven't explored how to make this an option within the UI yet. I can create a fork of your code if you don't have the time to look at it right now. Let me know.