AppletConfigurable. Toolbar decorator.

This commit is contained in:
Evgeny Zakrevsky
2012-03-12 15:57:04 +04:00
parent 6b03a25144
commit f31dd9f412
2 changed files with 21 additions and 53 deletions
@@ -119,7 +119,7 @@
</clientProperties>
<border type="none"/>
<children>
<grid id="32908" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="32908" layout-manager="GridLayoutManager" row-count="1" 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>
<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"/>
@@ -130,39 +130,7 @@
</clientProperties>
<border type="none" title-resource-bundle="messages/ExecutionBundle" title-key="applet.configuration.applet.parameters.label"/>
<children>
<grid id="f7d4e" layout-manager="GridLayoutManager" row-count="3" 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>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e3f93" class="javax.swing.JButton" binding="myAddButton">
<constraints>
<grid row="0" 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>
<text resource-bundle="messages/ExecutionBundle" key="button.add"/>
</properties>
</component>
<component id="1e21d" class="javax.swing.JButton" binding="myRemoveButton">
<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>
<text resource-bundle="messages/ExecutionBundle" key="button.remove"/>
</properties>
</component>
<vspacer id="b7052">
<constraints>
<grid row="2" 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>
</children>
</grid>
<xy id="814cb" binding="myTablePlace" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="814cb" binding="myTablePlace" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="100"/>
@@ -171,7 +139,7 @@
<properties/>
<border type="none"/>
<children/>
</xy>
</grid>
</children>
</grid>
<component id="36125" class="com.intellij.ui.components.JBLabel" binding="myClassNameLabel">
@@ -58,8 +58,6 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
private JTextField myHeight;
private LabeledComponent<JComboBox> myModule;
private JPanel myTablePlace;
private JButton myAddButton;
private JButton myRemoveButton;
private JBLabel myHtmlFileLabel;
private JBLabel myClassNameLabel;
private JBLabel myWidthLabel;
@@ -72,7 +70,7 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
private final ConfigurationModuleSelector myModuleSelector;
private static final ColumnInfo[] PARAMETER_COLUMNS = new ColumnInfo[]{
new MyColumnInfo(ExecutionBundle.message("applet.configuration.parameter.name.column")){
new MyColumnInfo(ExecutionBundle.message("applet.configuration.parameter.name.column")) {
public String valueOf(final AppletConfiguration.AppletParameter appletParameter) {
return appletParameter.getName();
}
@@ -96,7 +94,7 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
@NonNls
protected static final String HTTP_PREFIX = "http:/";
private void changePanel () {
private void changePanel() {
if (myMainClass.isSelected()) {
myClassOptions.setVisible(true);
myHTMLOptions.setVisible(false);
@@ -120,7 +118,19 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
myParameters = new ListTableModel<AppletConfiguration.AppletParameter>(PARAMETER_COLUMNS);
myTable = new TableView(myParameters);
myTable.getEmptyText().setText(ExecutionBundle.message("no.parameters"));
myTablePlace.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
myTablePlace.add(
ToolbarDecorator.createDecorator(myTable)
.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
addParameter();
}
}).setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
removeParameter();
}
}).disableUpDownActions().createPanel(), BorderLayout.CENTER);
myAppletRadioButtonGroup = new ButtonGroup();
myAppletRadioButtonGroup.add(myMainClass);
myAppletRadioButtonGroup.add(myURL);
@@ -145,17 +155,6 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
myHTMLOptions.setVisible(false);
myAddButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
addParameter();
}
});
myRemoveButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
removeParameter();
}
});
setAnchor(myVMParameters.getLabel());
}
@@ -164,7 +163,8 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
}
private void addParameter() {
final ArrayList<AppletConfiguration.AppletParameter> newItems = new ArrayList<AppletConfiguration.AppletParameter>(myParameters.getItems());
final ArrayList<AppletConfiguration.AppletParameter> newItems =
new ArrayList<AppletConfiguration.AppletParameter>(myParameters.getItems());
final AppletConfiguration.AppletParameter parameter = new AppletConfiguration.AppletParameter("newParameter", "");
newItems.add(parameter);
myParameters.setItems(newItems);
@@ -281,7 +281,7 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
}
private void createUIComponents() {
myClassName = new EditorTextFieldWithBrowseButton(myProject, true);
myClassName = new EditorTextFieldWithBrowseButton(myProject, true);
}
@Override