diff --git a/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java b/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java index ba64b4d4d7..8918ed9611 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java @@ -50,9 +50,9 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Color; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -86,6 +86,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane { + if (e.getStateChange() == ItemEvent.SELECTED) { + final int row = table.getSelectedRow(); + if (row == -1) { return; } - SingleJavaScript js = getList().get(table.getSelectedRow()); + SingleJavaScript js = getList().get(row); Object ob = parameterSetting.getSelectedItem(); if (ob != null) { String value = ob.toString(); js.setExtendParameters(StringUtils.equals(value, DEFAULT)); } - fireTableDataChanged(); + table.repaint(); } }); } @@ -567,7 +566,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane(Arrays.asList((ParameterProvider[]) value))); + if (getList().get(row) == null || getList().get(row).isExtendParameters()) { + return EMPTY_LABEL; + } + ParameterProvider[] providers = (ParameterProvider[]) value; + if (providers != null) { + paraSettingPane.refresh(Arrays.asList(providers)); + } return paraButton; } @@ -624,6 +628,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane parameterList = this.parameterViewPane.update(); - parameterList.clear(); - ParameterProvider[] parameters = js.getParameters(); - this.parameterViewPane.populate(parameters); + if (this.parameterViewPane != null) { + List parameterList = this.parameterViewPane.update(); + parameterList.clear(); + ParameterProvider[] parameters = js.getParameters(); + this.parameterViewPane.populate(parameters); + } } } else { OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);