home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.text;
-
- import com.sun.java.swing.event.DocumentEvent;
- import com.sun.java.swing.event.DocumentListener;
- import com.sun.java.swing.plaf.TextUI;
- import java.awt.Rectangle;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.beans.PropertyChangeEvent;
- import java.beans.PropertyChangeListener;
-
- class DefaultCaret$UpdateHandler implements PropertyChangeListener, DocumentListener, ActionListener {
- // $FF: synthetic field
- private final DefaultCaret this$0;
-
- public void actionPerformed(ActionEvent var1) {
- this.this$0.visible = !this.this$0.visible;
-
- try {
- TextUI var3 = this.this$0.component.getUI();
- Rectangle var2 = var3.modelToView(this.this$0.dot);
- this.this$0.damage(var2);
- } catch (BadLocationException var4) {
- }
- }
-
- public void insertUpdate(DocumentEvent var1) {
- int var2 = 0;
- int var3 = var1.getOffset();
- int var4 = var1.getLength();
- if (this.this$0.dot >= var3) {
- var2 = var4;
- }
-
- if (this.this$0.mark >= var3) {
- DefaultCaret var10000 = this.this$0;
- var10000.mark += var4;
- }
-
- if (var2 != 0) {
- this.this$0.changeCaretPosition(this.this$0.dot + var2);
- }
-
- }
-
- public void removeUpdate(DocumentEvent var1) {
- int var2 = 0;
- int var3 = var1.getOffset();
- int var4 = var3 + var1.getLength();
- if (this.this$0.dot >= var4) {
- var2 = var4 - var3;
- } else if (this.this$0.dot >= var3) {
- var2 = this.this$0.dot - var3;
- }
-
- if (this.this$0.mark >= var4) {
- DefaultCaret var10000 = this.this$0;
- var10000.mark -= var4 - var3;
- } else if (this.this$0.mark >= var3) {
- this.this$0.mark = var3;
- }
-
- if (this.this$0.mark == this.this$0.dot - var2) {
- this.this$0.setDot(this.this$0.dot - var2);
- } else {
- this.this$0.changeCaretPosition(this.this$0.dot - var2);
- }
- }
-
- public void changedUpdate(DocumentEvent var1) {
- }
-
- public void propertyChange(PropertyChangeEvent var1) {
- Object var2 = var1.getOldValue();
- Object var3 = var1.getNewValue();
- if (var2 instanceof Document || var3 instanceof Document) {
- this.this$0.setDot(0);
- if (var2 != null) {
- ((Document)var2).removeDocumentListener(this);
- }
-
- if (var3 != null) {
- ((Document)var3).addDocumentListener(this);
- }
- }
-
- }
-
- DefaultCaret$UpdateHandler(DefaultCaret var1) {
- this.this$0 = var1;
- this.this$0 = var1;
- }
- }
-