< prev index next >

src/java.desktop/share/classes/javax/swing/text/html/HiddenTagView.java

Print this page




 139         yAlign = (h > 0) ? (h - d) / h : 0;
 140     }
 141 
 142     void resetBorder() {
 143         Component comp = getComponent();
 144 
 145         if (comp != null) {
 146             if (isEndTag()) {
 147                 ((JPanel)comp).setBorder(EndBorder);
 148             }
 149             else {
 150                 ((JPanel)comp).setBorder(StartBorder);
 151             }
 152         }
 153     }
 154 
 155     /**
 156      * This resets the text on the text component we created to match
 157      * that of the AttributeSet for the Element we represent.
 158      * <p>If this is invoked on the event dispatching thread, this
 159      * directly invokes <code>_setTextFromModel</code>, otherwise
 160      * <code>SwingUtilities.invokeLater</code> is used to schedule execution
 161      * of <code>_setTextFromModel</code>.
 162      */
 163     void setTextFromModel() {
 164         if (SwingUtilities.isEventDispatchThread()) {
 165             _setTextFromModel();
 166         }
 167         else {
 168             SwingUtilities.invokeLater(new Runnable() {
 169                 public void run() {
 170                     _setTextFromModel();
 171                 }
 172             });
 173         }
 174     }
 175 
 176     /**
 177      * This resets the text on the text component we created to match
 178      * that of the AttributeSet for the Element we represent.
 179      */
 180     void _setTextFromModel() {
 181         Document doc = getDocument();


 190                 resetBorder();
 191                 Container host = getContainer();
 192                 if (host != null) {
 193                     preferenceChanged(this, true, true);
 194                     host.repaint();
 195                 }
 196             }
 197         }
 198         finally {
 199             isSettingAttributes = false;
 200             if (doc instanceof AbstractDocument) {
 201                 ((AbstractDocument)doc).readUnlock();
 202             }
 203         }
 204     }
 205 
 206     /**
 207      * This copies the text from the text component we've created
 208      * to the Element's AttributeSet we represent.
 209      * <p>If this is invoked on the event dispatching thread, this
 210      * directly invokes <code>_updateModelFromText</code>, otherwise
 211      * <code>SwingUtilities.invokeLater</code> is used to schedule execution
 212      * of <code>_updateModelFromText</code>.
 213      */
 214     void updateModelFromText() {
 215         if (!isSettingAttributes) {
 216             if (SwingUtilities.isEventDispatchThread()) {
 217                 _updateModelFromText();
 218             }
 219             else {
 220                 SwingUtilities.invokeLater(new Runnable() {
 221                     public void run() {
 222                         _updateModelFromText();
 223                     }
 224                 });
 225             }
 226         }
 227     }
 228 
 229     /**
 230      * This copies the text from the text component we've created
 231      * to the Element's AttributeSet we represent.
 232      */




 139         yAlign = (h > 0) ? (h - d) / h : 0;
 140     }
 141 
 142     void resetBorder() {
 143         Component comp = getComponent();
 144 
 145         if (comp != null) {
 146             if (isEndTag()) {
 147                 ((JPanel)comp).setBorder(EndBorder);
 148             }
 149             else {
 150                 ((JPanel)comp).setBorder(StartBorder);
 151             }
 152         }
 153     }
 154 
 155     /**
 156      * This resets the text on the text component we created to match
 157      * that of the AttributeSet for the Element we represent.
 158      * <p>If this is invoked on the event dispatching thread, this
 159      * directly invokes {@code _setTextFromModel}, otherwise
 160      * {@code SwingUtilities.invokeLater} is used to schedule execution
 161      * of {@code _setTextFromModel}.
 162      */
 163     void setTextFromModel() {
 164         if (SwingUtilities.isEventDispatchThread()) {
 165             _setTextFromModel();
 166         }
 167         else {
 168             SwingUtilities.invokeLater(new Runnable() {
 169                 public void run() {
 170                     _setTextFromModel();
 171                 }
 172             });
 173         }
 174     }
 175 
 176     /**
 177      * This resets the text on the text component we created to match
 178      * that of the AttributeSet for the Element we represent.
 179      */
 180     void _setTextFromModel() {
 181         Document doc = getDocument();


 190                 resetBorder();
 191                 Container host = getContainer();
 192                 if (host != null) {
 193                     preferenceChanged(this, true, true);
 194                     host.repaint();
 195                 }
 196             }
 197         }
 198         finally {
 199             isSettingAttributes = false;
 200             if (doc instanceof AbstractDocument) {
 201                 ((AbstractDocument)doc).readUnlock();
 202             }
 203         }
 204     }
 205 
 206     /**
 207      * This copies the text from the text component we've created
 208      * to the Element's AttributeSet we represent.
 209      * <p>If this is invoked on the event dispatching thread, this
 210      * directly invokes {@code _updateModelFromText}, otherwise
 211      * {@code SwingUtilities.invokeLater} is used to schedule execution
 212      * of {@code _updateModelFromText}.
 213      */
 214     void updateModelFromText() {
 215         if (!isSettingAttributes) {
 216             if (SwingUtilities.isEventDispatchThread()) {
 217                 _updateModelFromText();
 218             }
 219             else {
 220                 SwingUtilities.invokeLater(new Runnable() {
 221                     public void run() {
 222                         _updateModelFromText();
 223                     }
 224                 });
 225             }
 226         }
 227     }
 228 
 229     /**
 230      * This copies the text from the text component we've created
 231      * to the Element's AttributeSet we represent.
 232      */


< prev index next >