|
|
@ -1,22 +1,22 @@ |
|
|
|
package com.fr.design.dscolumn; |
|
|
|
package com.fr.design.dscolumn; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
|
|
|
|
import com.fr.data.SimpleDSColumn; |
|
|
|
import com.fr.data.SimpleDSColumn; |
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
|
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
import com.fr.design.data.datapane.TableDataComboBox; |
|
|
|
import com.fr.design.data.datapane.TableDataComboBox; |
|
|
|
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
|
|
|
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
|
|
|
|
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
|
|
|
import com.fr.design.gui.icombobox.LazyComboBox; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.itableeditorpane.ParameterTableModel; |
|
|
|
import com.fr.design.gui.itableeditorpane.ParameterTableModel; |
|
|
|
import com.fr.design.gui.itableeditorpane.UITableEditorPane; |
|
|
|
import com.fr.design.gui.itableeditorpane.UITableEditorPane; |
|
|
|
import com.fr.design.gui.icombobox.LazyComboBox; |
|
|
|
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
|
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.data.TableDataColumn; |
|
|
|
import com.fr.general.data.TableDataColumn; |
|
|
|
import com.fr.report.cell.CellElement; |
|
|
|
import com.fr.report.cell.CellElement; |
|
|
@ -35,6 +35,14 @@ import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 数据集列动态参数设置组件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @author yaoh.wu |
|
|
|
|
|
|
|
* @version 2017年7月26日 |
|
|
|
|
|
|
|
* todo 9.0设计器更新,修改动态参数注入按钮部分,使其能在右侧边栏正常显示 |
|
|
|
|
|
|
|
* @since 8.0 |
|
|
|
|
|
|
|
*/ |
|
|
|
public class SelectedDataColumnPane extends BasicPane { |
|
|
|
public class SelectedDataColumnPane extends BasicPane { |
|
|
|
protected UITableEditorPane<ParameterProvider> editorPane; |
|
|
|
protected UITableEditorPane<ParameterProvider> editorPane; |
|
|
|
protected Parameter[] ps; |
|
|
|
protected Parameter[] ps; |
|
|
@ -57,7 +65,6 @@ public class SelectedDataColumnPane extends BasicPane { |
|
|
|
* 初始化组件 |
|
|
|
* 初始化组件 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param showParameterButton 是否显示参数按钮 |
|
|
|
* @param showParameterButton 是否显示参数按钮 |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void initComponent(boolean showParameterButton) { |
|
|
|
public void initComponent(boolean showParameterButton) { |
|
|
|
initTableNameComboBox(); |
|
|
|
initTableNameComboBox(); |
|
|
@ -98,41 +105,6 @@ public class SelectedDataColumnPane extends BasicPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void initTableNameComboBox() { |
|
|
|
|
|
|
|
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); |
|
|
|
|
|
|
|
tableNameComboBox.addItemListener(new ItemListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
|
|
|
columnNameComboBox.setLoaded(false); |
|
|
|
|
|
|
|
// columnNameComboBox.loadList();
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initWithParameterButton() { |
|
|
|
|
|
|
|
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); |
|
|
|
|
|
|
|
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); |
|
|
|
|
|
|
|
paramButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void doOk() { |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = editorPane.update(); |
|
|
|
|
|
|
|
ps = parameterList.toArray(new Parameter[parameterList.size()]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editorPane.populate(ps == null ? new Parameter[0] : ps); |
|
|
|
|
|
|
|
paramDialog.setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
|
|
|
return "DSColumn"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void populate(TableDataSource source, TemplateCellElement cellElement) { |
|
|
|
public void populate(TableDataSource source, TemplateCellElement cellElement) { |
|
|
|
if (cellElement == null) { |
|
|
|
if (cellElement == null) { |
|
|
@ -183,7 +155,6 @@ public class SelectedDataColumnPane extends BasicPane { |
|
|
|
* 更新面板 |
|
|
|
* 更新面板 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 更新后的值 |
|
|
|
* @return 更新后的值 |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public SimpleDSColumn updateColumnPane() { |
|
|
|
public SimpleDSColumn updateColumnPane() { |
|
|
|
SimpleDSColumn dsColumn = new SimpleDSColumn(); |
|
|
|
SimpleDSColumn dsColumn = new SimpleDSColumn(); |
|
|
@ -210,16 +181,10 @@ public class SelectedDataColumnPane extends BasicPane { |
|
|
|
return dsColumn; |
|
|
|
return dsColumn; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isColumnName(String columnExp) { |
|
|
|
|
|
|
|
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 添加监听事件 |
|
|
|
* 添加监听事件 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param i 监听事件 |
|
|
|
* @param i 监听事件 |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addListener(ItemListener i) { |
|
|
|
public void addListener(ItemListener i) { |
|
|
|
itemListener = i; |
|
|
|
itemListener = i; |
|
|
@ -231,13 +196,55 @@ public class SelectedDataColumnPane extends BasicPane { |
|
|
|
* 移除监听事件 |
|
|
|
* 移除监听事件 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param i 监听事件 |
|
|
|
* @param i 监听事件 |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removeListener(ItemListener i) { |
|
|
|
public void removeListener(ItemListener i) { |
|
|
|
tableNameComboBox.removeItemListener(i); |
|
|
|
tableNameComboBox.removeItemListener(i); |
|
|
|
columnNameComboBox.removeItemListener(i); |
|
|
|
columnNameComboBox.removeItemListener(i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initTableNameComboBox() { |
|
|
|
|
|
|
|
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); |
|
|
|
|
|
|
|
tableNameComboBox.addItemListener(new ItemListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
|
|
|
columnNameComboBox.setLoaded(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
|
|
|
return "DSColumn"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initWithParameterButton() { |
|
|
|
|
|
|
|
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); |
|
|
|
|
|
|
|
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); |
|
|
|
|
|
|
|
paramButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void doOk() { |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = editorPane.update(); |
|
|
|
|
|
|
|
ps = parameterList.toArray(new Parameter[parameterList.size()]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editorPane.populate(ps == null ? new Parameter[0] : ps); |
|
|
|
|
|
|
|
paramDialog.setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isColumnName(String columnExp) { |
|
|
|
|
|
|
|
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<String> calculateColumnNameList() { |
|
|
|
private List<String> calculateColumnNameList() { |
|
|
|
if (this.tableNameComboBox.getSelectedItem() != null) { |
|
|
|
if (this.tableNameComboBox.getSelectedItem() != null) { |
|
|
|
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); |
|
|
|
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); |
|
|
|