IDEA-36265
authorAlexander Lobas <Alexander.Lobas@jetbrains.com>
Wed, 25 Jan 2012 14:40:41 +0000 (18:40 +0400)
committerAlexander Lobas <Alexander.Lobas@jetbrains.com>
Wed, 25 Jan 2012 14:40:41 +0000 (18:40 +0400)
plugins/ui-designer/src/com/intellij/uiDesigner/GeneralConfigurable.form
plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfigurable.java
plugins/ui-designer/src/com/intellij/uiDesigner/GuiDesignerConfiguration.java
plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GridCaptionPanel.java

index 05b23634de4065feb9a7ac9997b0e767b1ce3125..30b8c75dba09c8b1a40f672d679a3cc2fa9893da 100644 (file)
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.uiDesigner.GuiDesignerConfigurable.MyGeneralUI">
-  <grid id="4a770" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="4a770" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
-      <xy x="62" y="47" width="473" height="224"/>
+      <xy x="62" y="47" width="493" height="278"/>
     </constraints>
     <properties/>
     <border type="none"/>
     <children>
       <vspacer id="d5f77">
         <constraints>
-          <grid row="5" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <grid row="6" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
         </constraints>
       </vspacer>
       <component id="2eed8" class="javax.swing.JLabel">
           </model>
         </properties>
       </component>
+      <component id="b9ad7" class="javax.swing.JCheckBox" binding="myResizeHeaders">
+        <constraints>
+          <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties>
+          <margin top="10" left="0" bottom="2" right="2"/>
+          <text value="Resize column and row headers over mouse"/>
+        </properties>
+      </component>
     </children>
   </grid>
   <buttonGroups>
index 4d9a541ea6ef2f41442e9cc9605f629871420ab0..4e5fc5c6b7fd38a447da575df1575ea4efee6121 100644 (file)
@@ -100,6 +100,10 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co
       return true;
     }
 
+    if (configuration.RESIZE_HEADERS != myGeneralUI.myResizeHeaders.isSelected()) {
+      return true;
+    }
+    
     return false;
   }
 
@@ -109,6 +113,7 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co
     configuration.DEFAULT_LAYOUT_MANAGER = (String)myGeneralUI.myLayoutManagerCombo.getSelectedItem();
     configuration.INSTRUMENT_CLASSES = myGeneralUI.myRbInstrumentClasses.isSelected();
     configuration.DEFAULT_FIELD_ACCESSIBILITY = (String)myGeneralUI .myDefaultFieldAccessibilityCombo.getSelectedItem();
+    configuration.RESIZE_HEADERS = myGeneralUI.myResizeHeaders.isSelected();
 
     if (configuration.INSTRUMENT_CLASSES && !myProject.isDefault()) {
       final DispatchThreadProgressWindow progressWindow = new DispatchThreadProgressWindow(false, myProject);
@@ -140,6 +145,8 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co
     myGeneralUI.myLayoutManagerCombo.setSelectedItem(configuration.DEFAULT_LAYOUT_MANAGER);
 
     myGeneralUI.myDefaultFieldAccessibilityCombo.setSelectedItem(configuration.DEFAULT_FIELD_ACCESSIBILITY);
+    
+    myGeneralUI.myResizeHeaders.setSelected(configuration.RESIZE_HEADERS);
   }
 
   public void disposeUIResources() {
@@ -153,6 +160,7 @@ public final class GuiDesignerConfigurable implements SearchableConfigurable, Co
     public JCheckBox myChkCopyFormsRuntime;
     private JComboBox myLayoutManagerCombo;
     private JComboBox myDefaultFieldAccessibilityCombo;
+    private JCheckBox myResizeHeaders;
   }
 
   private final class MyApplyRunnable implements Runnable {
index 15c480058d537b214a54396e0179318c063cf16b..902daf46c33e49b7f45e0db7d2419fcd3283c1bb 100644 (file)
@@ -49,6 +49,7 @@ public final class GuiDesignerConfiguration implements PersistentStateComponent<
 
   public String DEFAULT_FIELD_ACCESSIBILITY = PsiModifier.PRIVATE;
 
+  public boolean RESIZE_HEADERS = true;
 
   public GuiDesignerConfiguration getState() {
     return this;
index ce96c2a573dcf93b4c6017bfe904f60aade20aa7..538d7c31f37de49bca33cd330782e84f2dd302b9 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.ui.LightColors;
 import com.intellij.uiDesigner.CaptionSelection;
 import com.intellij.uiDesigner.FormEditingUtil;
 import com.intellij.uiDesigner.GridChangeUtil;
+import com.intellij.uiDesigner.GuiDesignerConfiguration;
 import com.intellij.uiDesigner.componentTree.ComponentSelectionListener;
 import com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager;
 import com.intellij.uiDesigner.radComponents.RadComponent;
@@ -272,6 +273,12 @@ public class GridCaptionPanel extends JPanel implements ComponentSelectionListen
     });
   }
 
+  private boolean canResizeCells() {
+    return GuiDesignerConfiguration.getInstance(myEditor.getProject()).RESIZE_HEADERS &&
+           mySelectedContainer != null &&
+           mySelectedContainer.getGridLayoutManager().canResizeCells();
+  }
+
   private int getCellAt(Point pnt) {
     if (mySelectedContainer == null) return -1;
     pnt = SwingUtilities.convertPoint(this, pnt, mySelectedContainer.getDelegee());
@@ -321,9 +328,8 @@ public class GridCaptionPanel extends JPanel implements ComponentSelectionListen
       requestFocus();
       Point pnt = SwingUtilities.convertPoint(GridCaptionPanel.this, e.getPoint(),
                                               mySelectedContainer.getDelegee());
-      RadAbstractGridLayoutManager layout = mySelectedContainer.getGridLayoutManager();
-      if (layout.canResizeCells()) {
-        myResizeLine = layout.getGridLineNear(mySelectedContainer, myIsRow, pnt, 4);
+      if (canResizeCells()) {
+        myResizeLine = mySelectedContainer.getGridLayoutManager().getGridLineNear(mySelectedContainer, myIsRow, pnt, 4);
       }
       if (!checkShowPopupMenu(e)) {
         int cell = getCellAt(e.getPoint());
@@ -393,7 +399,10 @@ public class GridCaptionPanel extends JPanel implements ComponentSelectionListen
     }
 
     public void mouseMoved(MouseEvent e) {
-      if (mySelectedContainer == null || !mySelectedContainer.getGridLayoutManager().canResizeCells()) return;
+      if (!canResizeCells()) {
+        return;
+      }
+
       Point pnt = SwingUtilities.convertPoint(GridCaptionPanel.this, e.getPoint(),
                                               mySelectedContainer.getDelegee());
       int gridLine = mySelectedContainer.getGridLayoutManager().getGridLineNear(mySelectedContainer, myIsRow, pnt, 4);