home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.Component;
- import java.awt.Insets;
- import java.awt.event.MouseEvent;
- import javax.swing.JComponent;
- import javax.swing.JSplitPane;
-
- public class BasicSplitPaneDivider$DragController {
- // $FF: synthetic field
- private final BasicSplitPaneDivider this$0;
- int initialX;
- int maxX;
- int minX;
- int offset;
-
- protected BasicSplitPaneDivider$DragController(BasicSplitPaneDivider var1, MouseEvent var2) {
- this.this$0 = var1;
- JSplitPane var5 = var1.splitPaneUI.getSplitPane();
- Insets var6 = ((JComponent)var5).getInsets();
- int var7;
- if (var6 != null) {
- var7 = var6.right;
- } else {
- var7 = 0;
- }
-
- this.initialX = ((Component)var1).getLocation().x;
- Component var3 = var5.getLeftComponent();
- Component var4 = var5.getRightComponent();
- if (var3 != null && var4 != null) {
- this.minX = var3.getMinimumSize().width + var3.getLocation().x;
- this.maxX = Math.max(0, ((Component)var5).getSize().width - (2 + ((Component)var1).getSize().width + var7) - var4.getMinimumSize().width);
- if (this.maxX < this.minX) {
- this.minX = this.maxX = 0;
- }
- } else {
- this.minX = this.maxX = 0;
- }
-
- this.offset = var2.getX() - this.initialX;
- if (this.offset < -1 || this.offset > ((Component)var1).getSize().width) {
- this.maxX = -1;
- }
-
- }
-
- protected void completeDrag(int var1, int var2) {
- this.this$0.finishDraggingTo(this.getNeededLocation(var1, var2));
- }
-
- protected void completeDrag(MouseEvent var1) {
- this.this$0.finishDraggingTo(this.positionForMouseEvent(var1));
- }
-
- protected void continueDrag(int var1, int var2) {
- this.this$0.dragDividerTo(this.getNeededLocation(var1, var2));
- }
-
- protected void continueDrag(MouseEvent var1) {
- this.this$0.dragDividerTo(this.positionForMouseEvent(var1));
- }
-
- protected int getNeededLocation(int var1, int var2) {
- int var3 = Math.min(this.maxX, Math.max(this.minX, var1 - this.offset));
- return var3;
- }
-
- protected boolean isValid() {
- return this.maxX > 0;
- }
-
- protected int positionForMouseEvent(MouseEvent var1) {
- int var2 = Math.min(this.maxX, Math.max(this.minX, var1.getX() - this.offset));
- return var2;
- }
- }
-