Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4125990

Add a method to query the character attributes for an entire selection

XMLWordPrintable

      ==========================================================================
      carlos.lucasius@canada 1998-04-06:
      RFE from Corel (licensee) for JFC1.1 using JDK1.1.4 on WINNT4.0.
      Corel: "Important for our product."

      As it is, there's a method to get the attributes at the current caret
      location (getCharacterRunAttributes). This does a great job of tracking
      the attributes and works great when there is no selection. What we'd
      really like to see added is a method to query the attributes for an entire
      selection... Something like:
      getSelectionCharacterAttributes and getSelectionParagraphAttributes.

      This would also require that attributes have either a definite or
      special value indicating that it is present, but not shared by the
      entire selection. In other words, if you've selected some text where
      some is bold and some is not and you query the selection's attribute
      set for the StyleConstants.Bold attribute, the return value could
      be one of the following:

          Boolean.TRUE or Boolean.FALSE: this means ALL the selected text is
      bold or not bold
      ...or some other defined object... for example...
          StyleContants.Partial: this means that some, but not all the
      selected text is bold.

      It now becomes more tedious to track the attribute run. An
      AttributeTracker class like the one in StyledEditorKit would have to
      make a much more complicated decision about when the current set of
      attributes has changed. It would no longer be able to just take the
      attributes at the caret location but would have to cycle through the
      attribute sets of all currently selected character/paragraph elements
      and combine their attributes. In combining those attributes, it would
      also have to determine if attributes are shared by some but not all of
      the selection and set their values accordingly.

      Another issue this creates is what to do when different types of content,
      with different types of attributes are all selected... ie: text, images,
      links, etc...

            idk Igor Kushnirskiy (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: