run configurations layout with anchors

This commit is contained in:
Evgeny Zakrevsky
2011-09-01 23:20:36 +04:00
parent 55a9c61513
commit 904e525a0b
36 changed files with 546 additions and 290 deletions
@@ -43,7 +43,6 @@
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.policy.file.label"/>
</properties>
</component>
@@ -57,7 +56,6 @@
<componentClass value="com.intellij.ui.RawCommandLineEditor"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.vm.parameters.for.appletviewer.label"/>
</properties>
</component>
@@ -67,9 +65,7 @@
</constraints>
<properties>
<componentClass value="javax.swing.JComboBox"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.use.classpath.and.jdk.of.module.label"/>
</properties>
</component>
@@ -92,7 +88,7 @@
</clientProperties>
<border type="none"/>
<children>
<component id="a2b70" class="javax.swing.JLabel" binding="myHtmlFileLabel">
<component id="a2b70" class="com.intellij.ui.components.JBLabel" binding="myHtmlFileLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -110,7 +106,7 @@
</component>
</children>
</grid>
<grid id="71bb1" binding="myClassOptions" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="71bb1" binding="myClassOptions" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
@@ -123,58 +119,10 @@
</clientProperties>
<border type="none"/>
<children>
<grid id="9c777" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="575e9" class="javax.swing.JTextField" binding="myWidth">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="60aa" class="javax.swing.JLabel" binding="myWidthLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="52" height="-1"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.width.label"/>
</properties>
</component>
<component id="3cd8" class="javax.swing.JLabel" binding="myHeightLabel">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.height.label"/>
</properties>
</component>
<component id="16d37" class="javax.swing.JTextField" binding="myHeight">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
<grid id="32908" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -226,32 +174,58 @@
</xy>
</children>
</grid>
<grid id="d9c99" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="5">
<margin top="0" left="0" bottom="0" right="0"/>
<component id="36125" class="com.intellij.ui.components.JBLabel" binding="myClassNameLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="36125" class="javax.swing.JLabel" binding="myClassNameLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.applet.class.label"/>
</properties>
</component>
<component id="70a46" class="com.intellij.ui.EditorTextFieldWithBrowseButton" binding="myClassName" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.applet.class.label"/>
</properties>
</component>
<component id="70a46" class="com.intellij.ui.EditorTextFieldWithBrowseButton" binding="myClassName" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="60aa" class="com.intellij.ui.components.JBLabel" binding="myWidthLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.width.label"/>
</properties>
</component>
<component id="575e9" class="javax.swing.JTextField" binding="myWidth">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="3cd8" class="javax.swing.JLabel" binding="myHeightLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.height.label"/>
</properties>
</component>
<component id="16d37" class="javax.swing.JTextField" binding="myHeight">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
</children>
@@ -271,9 +245,7 @@
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<checkBoxPreferredSize width="215" height="23"/>
</properties>
<properties/>
</component>
</children>
</grid>
@@ -27,8 +27,10 @@ import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.EditorTextFieldWithBrowseButton;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.table.TableView;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
@@ -43,7 +45,8 @@ import java.io.File;
import java.util.*;
import java.util.List;
public class AppletConfigurable extends SettingsEditor<AppletConfiguration> implements CheckableRunConfigurationEditor<AppletConfiguration>{
public class AppletConfigurable extends SettingsEditor<AppletConfiguration> implements CheckableRunConfigurationEditor<AppletConfiguration>,
ComponentWithAnchor {
private JPanel myWholePanel;
private JRadioButton myMainClass;
private JRadioButton myURL;
@@ -59,12 +62,13 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
private JPanel myTablePlace;
private JButton myAddButton;
private JButton myRemoveButton;
private JLabel myHtmlFileLabel;
private JLabel myClassNameLabel;
private JLabel myWidthLabel;
private JBLabel myHtmlFileLabel;
private JBLabel myClassNameLabel;
private JBLabel myWidthLabel;
private JLabel myHeightLabel;
private AlternativeJREPanel myAlternativeJREPanel;
private final ButtonGroup myAppletRadioButtonGroup;
private JComponent anchor;
private final Project myProject;
private final ConfigurationModuleSelector myModuleSelector;
@@ -153,6 +157,8 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
removeParameter();
}
});
setAnchor(myModule.getLabel());
}
private void removeParameter() {
@@ -285,6 +291,21 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
myClassName = new EditorTextFieldWithBrowseButton(myProject, true);
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myModule.setAnchor(anchor);
myPolicyFile.setAnchor(anchor);
myVMParameters.setAnchor(anchor);
myAlternativeJREPanel.setAnchor(anchor);
myHtmlFileLabel.setAnchor(anchor);
}
private static abstract class MyColumnInfo extends ColumnInfo<AppletConfiguration.AppletParameter, String> {
public MyColumnInfo(final String name) {
super(name);
@@ -1,63 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.application.ApplicationConfigurable">
<grid id="93687" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="93687" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="53" y="36" width="708" height="433"/>
<xy x="53" y="36" width="708" height="319"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="eeb03">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="50b09" class="com.intellij.execution.ui.CommonJavaParametersPanel" binding="myCommonProgramParameters">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelsPreferredSize width="215" height="16"/>
</properties>
<properties/>
</component>
<component id="50d08" class="com.intellij.openapi.ui.LabeledComponent" binding="myMainClass" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="20"/>
</grid>
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="22"/>
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.main.class.label"/>
</properties>
</component>
<component id="c45d2" class="com.intellij.openapi.ui.LabeledComponent" binding="myModule">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="javax.swing.JComboBox"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.use.classpath.and.jdk.of.module.label"/>
</properties>
</component>
<component id="e88bd" class="com.intellij.execution.ui.AlternativeJREPanel" binding="myAlternativeJREPanel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<checkBoxPreferredSize width="215" height="23"/>
</properties>
<properties/>
</component>
<component id="b45cf" class="javax.swing.JCheckBox" binding="myShowSwingInspectorCheckbox">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="6" 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>
<text resource-bundle="messages/ExecutionBundle" key="show.swing.inspector"/>
</properties>
</component>
<vspacer id="f4215">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="10"/>
</grid>
</constraints>
</vspacer>
<vspacer id="7cceb">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="10"/>
</grid>
</constraints>
</vspacer>
</children>
</grid>
</form>
@@ -26,7 +26,6 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.psi.JavaCodeFragment;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
@@ -61,6 +60,17 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
});
ClassBrowser.createApplicationClassBrowser(project, myModuleSelector).setField(getMainClassField());
myVersionDetector = new JreVersionDetector();
settingAnchors();
}
private void settingAnchors() {
JComponent anchor = myCommonProgramParameters.getAnchor();
myMainClass.setAnchor(anchor);
myCommonProgramParameters.setAnchor(anchor);
anchor = myModule.getLabel();
myAlternativeJREPanel.setAnchor(anchor);
}
public void applyEditorTo(final ApplicationConfiguration configuration) throws ConfigurationException {
@@ -24,7 +24,9 @@ import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.GuiUtils;
import com.intellij.ui.InsertPathAction;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.TextFieldWithHistory;
import com.intellij.ui.components.JBCheckBox;
import javax.swing.*;
import java.awt.*;
@@ -36,15 +38,15 @@ import java.util.ArrayList;
* User: anna
* Date: Jun 21, 2005
*/
public class AlternativeJREPanel extends JPanel {
public class AlternativeJREPanel extends JPanel implements ComponentWithAnchor {
private final ComponentWithBrowseButton<TextFieldWithHistory> myPathField;
private final JCheckBox myCbEnabled;
private final JBCheckBox myCbEnabled;
final TextFieldWithHistory myFieldWithHistory;
public AlternativeJREPanel() {
super(new GridBagLayout());
myCbEnabled = new JCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
final GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
add(myCbEnabled, gc);
@@ -77,6 +79,7 @@ public class AlternativeJREPanel extends JPanel {
}
});
enabledChanged();
updateUI();
}
private void enabledChanged() {
@@ -106,12 +109,18 @@ public class AlternativeJREPanel extends JPanel {
setPathEnabled(isEnabled);
setPath(path);
}
public void setCheckBoxPreferredSize(Dimension d) {
myCbEnabled.setPreferredSize(d);
@Override
public JComponent getAnchor() {
return myCbEnabled.getAnchor();
}
public Dimension getCheckBoxPreferredSize() {
return myCbEnabled.getPreferredSize();
@Override
public void setAnchor(JComponent anchor) {
myCbEnabled.setAnchor(anchor);
}
public JBCheckBox getCbEnabled() {
return myCbEnabled;
}
}
@@ -19,12 +19,12 @@ import com.intellij.execution.CommonJavaRunConfigurationParameters;
import com.intellij.execution.ExecutionBundle;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.ui.RawCommandLineEditor;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
public class CommonJavaParametersPanel extends CommonProgramParametersPanel {
private LabeledComponent<RawCommandLineEditor> myVMParameters;
private LabeledComponent<RawCommandLineEditor> myVMParametersComponent;
public CommonJavaParametersPanel() {
super();
@@ -32,28 +32,28 @@ public class CommonJavaParametersPanel extends CommonProgramParametersPanel {
@Override
protected void addComponents() {
myVMParameters = LabeledComponent.create(new RawCommandLineEditor(),
myVMParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
ExecutionBundle.message("run.configuration.java.vm.parameters.label"));
copyDialogCaption(myVMParameters);
copyDialogCaption(myVMParametersComponent);
myVMParameters.setLabelLocation(BorderLayout.WEST);
myVMParametersComponent.setLabelLocation(BorderLayout.WEST);
add(myVMParameters);
add(myVMParametersComponent);
super.addComponents();
}
@Override
public void setLabelsPreferredSize(Dimension d) {
super.setLabelsPreferredSize(d);
myVMParameters.setLabelPreferredSize(d);
}
public void setVMParameters(String text) {
myVMParameters.getComponent().setText(text);
myVMParametersComponent.getComponent().setText(text);
}
public String getVMParameters() {
return myVMParameters.getComponent().getText();
return myVMParametersComponent.getComponent().getText();
}
@Override
public void setAnchor(JComponent labelAnchor) {
super.setAnchor(labelAnchor);
myVMParametersComponent.setAnchor(labelAnchor);
}
public void applyTo(CommonJavaRunConfigurationParameters configuration) {