Uploaded image for project: '{RETIRED} Wiki3.0'
  1. {RETIRED} Wiki3.0
  2. WIKITHREEDOTO-102

Design issue for ToggleInlineStyle and InlineStyle executables

    XMLWordPrintable

Details

    Description

      Concerned module: xwiki-platform-gwt-user: https://github.com/xwiki-contrib/xwiki-platform-wiki30/tree/master/xwiki-platform-core/xwiki-platform-gwt/xwiki-platform-gwt-user
      code at:
      https://github.com/xwiki-contrib/xwiki-platform-wiki30/blob/master/xwiki-platform-core/xwiki-platform-gwt/xwiki-platform-gwt-user/src/main/java/org/xwiki/gwt/user/client/ui/rta/cmd/internal/ToggleInlineStyleExecutable.java

      and

      https://github.com/xwiki-contrib/xwiki-platform-wiki30/blob/master/xwiki-platform-core/xwiki-platform-gwt/xwiki-platform-gwt-user/src/main/java/org/xwiki/gwt/user/client/ui/rta/cmd/internal/InlineStyleExecutable.java

      There is a issue in my oppinion regarding the design of these classes.
      In ToggleInlineStyleExecutable the "executed" flag is updated only when the public method execute(String) is called, but not when the protected method execute(Range, String).
      Because of this I can call the second method toggleInlineStyleExecutable.execute(Range, String)(which is inherited) to add some styling on a range, but the "executed" flag isn't updated, thus leading to the following problem:
      the method TextFragment execute(Text text, int startIndex, int endIndex, String parameter) on ToggleInlineStyleExecutable does the wrong action(that is to add a style when it should remove it).

      Workaround: either update the "executed" flag on every ingerited method that wants to execute some style, either use the getter "isExecuted()" in the method TextFragment execute(Text text, int startIndex, int endIndex, String parameter).

      Attachments

        Activity

          People

            Unassigned Unassigned
            bflueras Bogdan Flueras
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: