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 ba64b4d4d..b559c22e6 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(row); + Object ob = parameterSetting.getSelectedItem(); + if (ob != null) { + String value = ob.toString(); + js.setExtendParameters(StringUtils.equals(value, DEFAULT)); + } + // 单纯为了刷新表格,使某些联动生效 + table.repaint(); + } + }); this.addCellEditorListener(new CellEditorListener() { @Override @@ -540,15 +561,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 +642,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);