1 19 20 package org.netbeans.core.windows.view.ui; 21 22 import javax.swing.JComponent ; 23 import javax.swing.JSplitPane ; 24 import org.netbeans.core.windows.*; 25 import org.netbeans.core.windows.view.*; 26 import org.netbeans.core.windows.view.ui.*; 27 28 import java.awt.Component ; 29 import java.awt.Dimension ; 30 31 36 class TestViewElement extends ViewElement { 37 38 SplitTestComponent myComponent; 39 int orientation; 40 41 42 public TestViewElement( int orientation, double resizeWeight ) { 43 super( null, resizeWeight ); 44 this.myComponent = new SplitTestComponent(); 45 this.orientation = orientation; 46 } 47 48 public Component getComponent() { 49 return myComponent; 50 } 51 52 56 public boolean updateAWTHierarchy(Dimension availableSpace) { 57 return true; 58 } 59 60 int getSizeInSplit() { 61 return orientation == JSplitPane.HORIZONTAL_SPLIT ? getComponent().getWidth() : getComponent().getHeight(); 62 } 63 64 int getNonSplitSize() { 65 return orientation != JSplitPane.HORIZONTAL_SPLIT ? getComponent().getWidth() : getComponent().getHeight(); 66 } 67 68 void setMinSize( int minSize ) { 69 myComponent.setMinimumSize( new Dimension ( minSize, minSize ) ); 70 } 71 72 private static class SplitTestComponent extends JComponent { 73 public SplitTestComponent() { 74 setMinimumSize( new Dimension ( 0, 0 ) ); 75 } 76 } 77 } 78 | Popular Tags |