Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/javax/swing/text/StyleContext.java
          +++ new/src/share/classes/javax/swing/text/StyleContext.java
↓ open down ↓ 284 lines elided ↑ open up ↑
 285  285      }
 286  286  
 287  287      // --- AttributeContext methods --------------------
 288  288  
 289  289      /**
 290  290       * Adds an attribute to the given set, and returns
 291  291       * the new representative set.
 292  292       * <p>
 293  293       * This method is thread safe, although most Swing methods
 294  294       * are not. Please see
 295      -     * <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      295 +     * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
 296  296       * in Swing</A> for more information.
 297  297       *
 298  298       * @param old the old attribute set
 299  299       * @param name the non-null attribute name
 300  300       * @param value the attribute value
 301  301       * @return the updated attribute set
 302  302       * @see MutableAttributeSet#addAttribute
 303  303       */
 304  304      public synchronized AttributeSet addAttribute(AttributeSet old, Object name, Object value) {
 305  305          if ((old.getAttributeCount() + 1) <= getCompressionThreshold()) {
↓ open down ↓ 8 lines elided ↑ open up ↑
 314  314          MutableAttributeSet ma = getMutableAttributeSet(old);
 315  315          ma.addAttribute(name, value);
 316  316          return ma;
 317  317      }
 318  318  
 319  319      /**
 320  320       * Adds a set of attributes to the element.
 321  321       * <p>
 322  322       * This method is thread safe, although most Swing methods
 323  323       * are not. Please see
 324      -     * <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      324 +     * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
 325  325       * in Swing</A> for more information.
 326  326       *
 327  327       * @param old the old attribute set
 328  328       * @param attr the attributes to add
 329  329       * @return the updated attribute set
 330  330       * @see MutableAttributeSet#addAttribute
 331  331       */
 332  332      public synchronized AttributeSet addAttributes(AttributeSet old, AttributeSet attr) {
 333  333          if ((old.getAttributeCount() + attr.getAttributeCount()) <= getCompressionThreshold()) {
 334  334              // build a search key and find/create an immutable and unique
↓ open down ↓ 7 lines elided ↑ open up ↑
 342  342          MutableAttributeSet ma = getMutableAttributeSet(old);
 343  343          ma.addAttributes(attr);
 344  344          return ma;
 345  345      }
 346  346  
 347  347      /**
 348  348       * Removes an attribute from the set.
 349  349       * <p>
 350  350       * This method is thread safe, although most Swing methods
 351  351       * are not. Please see
 352      -     * <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      352 +     * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
 353  353       * in Swing</A> for more information.
 354  354       *
 355  355       * @param old the old set of attributes
 356  356       * @param name the non-null attribute name
 357  357       * @return the updated attribute set
 358  358       * @see MutableAttributeSet#removeAttribute
 359  359       */
 360  360      public synchronized AttributeSet removeAttribute(AttributeSet old, Object name) {
 361  361          if ((old.getAttributeCount() - 1) <= getCompressionThreshold()) {
 362  362              // build a search key and find/create an immutable and unique
↓ open down ↓ 7 lines elided ↑ open up ↑
 370  370          MutableAttributeSet ma = getMutableAttributeSet(old);
 371  371          ma.removeAttribute(name);
 372  372          return ma;
 373  373      }
 374  374  
 375  375      /**
 376  376       * Removes a set of attributes for the element.
 377  377       * <p>
 378  378       * This method is thread safe, although most Swing methods
 379  379       * are not. Please see
 380      -     * <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      380 +     * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
 381  381       * in Swing</A> for more information.
 382  382       *
 383  383       * @param old the old attribute set
 384  384       * @param names the attribute names
 385  385       * @return the updated attribute set
 386  386       * @see MutableAttributeSet#removeAttributes
 387  387       */
 388  388      public synchronized AttributeSet removeAttributes(AttributeSet old, Enumeration<?> names) {
 389  389          if (old.getAttributeCount() <= getCompressionThreshold()) {
 390  390              // build a search key and find/create an immutable and unique
↓ open down ↓ 7 lines elided ↑ open up ↑
 398  398          MutableAttributeSet ma = getMutableAttributeSet(old);
 399  399          ma.removeAttributes(names);
 400  400          return ma;
 401  401      }
 402  402  
 403  403      /**
 404  404       * Removes a set of attributes for the element.
 405  405       * <p>
 406  406       * This method is thread safe, although most Swing methods
 407  407       * are not. Please see
 408      -     * <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      408 +     * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
 409  409       * in Swing</A> for more information.
 410  410       *
 411  411       * @param old the old attribute set
 412  412       * @param attrs the attributes
 413  413       * @return the updated attribute set
 414  414       * @see MutableAttributeSet#removeAttributes
 415  415       */
 416  416      public synchronized AttributeSet removeAttributes(AttributeSet old, AttributeSet attrs) {
 417  417          if (old.getAttributeCount() <= getCompressionThreshold()) {
 418  418              // build a search key and find/create an immutable and unique
↓ open down ↓ 19 lines elided ↑ open up ↑
 438  438      }
 439  439  
 440  440      /**
 441  441       * Returns a set no longer needed by the MutableAttributeSet implementation.
 442  442       * This is useful for operation under 1.1 where there are no weak
 443  443       * references.  This would typically be called by the finalize method
 444  444       * of the MutableAttributeSet implementation.
 445  445       * <p>
 446  446       * This method is thread safe, although most Swing methods
 447  447       * are not. Please see
 448      -     * <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      448 +     * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
 449  449       * in Swing</A> for more information.
 450  450       *
 451  451       * @param a the set to reclaim
 452  452       */
 453  453      public void reclaim(AttributeSet a) {
 454  454          if (SwingUtilities.isEventDispatchThread()) {
 455  455              attributesPool.size(); // force WeakHashMap to expunge stale entries
 456  456          }
 457  457          // if current thread is not event dispatching thread
 458  458          // do not bother with expunging stale entries.
↓ open down ↓ 1163 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX