hzzz 8 years ago
parent
commit
844a9a8669
  1. 2
      designer/src/com/fr/design/mainframe/FormatBrushAction.java
  2. 16
      designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java
  3. 2590
      designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java
  4. 4
      designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
  5. 10
      designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
  6. 6
      designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java
  7. 2
      designer_base/src/com/fr/design/locale/designer.properties
  8. 2
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  9. 2
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  10. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  11. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  12. 2
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  13. 475
      designer_form/src/com/fr/design/mainframe/widget/editors/DataTableConfigPane.java

2
designer/src/com/fr/design/mainframe/FormatBrushAction.java

@ -50,7 +50,7 @@ public class FormatBrushAction extends ElementCaseAction {
//判断是不是连续区域 //判断是不是连续区域
//荣国是连续区域,那么这些长方形的长加起来应该等于 //荣国是连续区域,那么这些长方形的长加起来应该等于
if (!isContinueArea()) { if (!isContinueArea()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Can_not_use_FormatBursh")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Can_not_use_FormatBursh"));
ePane.setFormatState(DesignerContext.FORMAT_STATE_NULL); ePane.setFormatState(DesignerContext.FORMAT_STATE_NULL);
ePane.getFormatBrush().setSelected(false); ePane.getFormatBrush().setSelected(false);
return false; return false;

16
designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java

@ -179,7 +179,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
} else { } else {
doAutocomplete(); doAutocomplete();
} }
} else if (AutoCompletion.getDebug()) { } else if (AutoCompletion.isDebug()) {
Thread.dumpStack(); Thread.dumpStack();
} }
} }
@ -300,7 +300,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
*/ */
private void installKeyBindings() { private void installKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("PopupWindow: Installing keybindings"); System.out.println("PopupWindow: Installing keybindings");
} }
@ -313,7 +313,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
ActionMap am = comp.getActionMap(); ActionMap am = comp.getActionMap();
replaceAction(im, am, KeyEvent.VK_ESCAPE, escapeKap, oldEscape); replaceAction(im, am, KeyEvent.VK_ESCAPE, escapeKap, oldEscape);
if (AutoCompletion.getDebug() && oldEscape.action == escapeKap.action) { if (AutoCompletion.isDebug() && oldEscape.action == escapeKap.action) {
Thread.dumpStack(); Thread.dumpStack();
} }
replaceAction(im, am, KeyEvent.VK_UP, upKap, oldUp); replaceAction(im, am, KeyEvent.VK_UP, upKap, oldUp);
@ -371,7 +371,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
*/ */
private void positionDescWindow() { private void positionDescWindow() {
boolean showDescWindow = descWindow != null && ac.getShowDescWindow(); boolean showDescWindow = descWindow != null && ac.isShowDescWindow();
if (!showDescWindow) { if (!showDescWindow) {
return; return;
} }
@ -604,7 +604,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
Rectangle screenBounds = Util.getScreenBoundsForPoint(r.x, r.y); Rectangle screenBounds = Util.getScreenBoundsForPoint(r.x, r.y);
//Dimension screenSize = getToolkit().getScreenSize(); //Dimension screenSize = getToolkit().getScreenSize();
boolean showDescWindow = descWindow != null && ac.getShowDescWindow(); boolean showDescWindow = descWindow != null && ac.isShowDescWindow();
int totalH = getHeight(); int totalH = getHeight();
if (showDescWindow) { if (showDescWindow) {
totalH = Math.max(totalH, descWindow.getHeight()); totalH = Math.max(totalH, descWindow.getHeight());
@ -655,7 +655,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
installKeyBindings(); installKeyBindings();
lastLine = ac.getLineOfCaret(); lastLine = ac.getLineOfCaret();
selectFirstItem(); selectFirstItem();
if (descWindow == null && ac.getShowDescWindow()) { if (descWindow == null && ac.isShowDescWindow()) {
descWindow = createDescriptionWindow(); descWindow = createDescriptionWindow();
positionDescWindow(); positionDescWindow();
} }
@ -693,7 +693,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
// because of the way child JWindows' visibility is handled - in // because of the way child JWindows' visibility is handled - in
// some ways it's dependent on the parent, in other ways it's not. // some ways it's dependent on the parent, in other ways it's not.
if (descWindow != null) { if (descWindow != null) {
descWindow.setVisible(visible && ac.getShowDescWindow()); descWindow.setVisible(visible && ac.isShowDescWindow());
} }
} }
@ -708,7 +708,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
*/ */
private void uninstallKeyBindings() { private void uninstallKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("PopupWindow: Removing keybindings"); System.out.println("PopupWindow: Removing keybindings");
} }

2590
designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java

File diff suppressed because it is too large Load Diff

4
designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java

@ -439,7 +439,7 @@ class ParameterizedCompletionContext {
*/ */
private void installKeyBindings() { private void installKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("CompletionContext: Installing keybindings"); System.out.println("CompletionContext: Installing keybindings");
} }
@ -733,7 +733,7 @@ class ParameterizedCompletionContext {
*/ */
private void uninstallKeyBindings() { private void uninstallKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("CompletionContext Uninstalling keybindings"); System.out.println("CompletionContext Uninstalling keybindings");
} }

10
designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java

@ -160,12 +160,14 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
public void run() { public void run() {
int height = centerPane.getHeight(); int height = centerPane.getHeight();
int width = centerPane.getWidth(); int width = centerPane.getWidth();
int step = 30;
int x = 0;
int y = -height; int y = -height;
for (int i = 0; i <= height; i += 30) { for (int i = 0; i <= height; i += step) {
// 设置面板位置 // 设置面板位置
currentPanel.setBounds(0, i, width, height); currentPanel.setBounds(x, i, width, height);
panel.setBounds(0, y, width, height); panel.setBounds(x, y, width, height);
y += 30; y += step;
try { try {
Thread.sleep(3); Thread.sleep(3);
} catch (InterruptedException e) { } catch (InterruptedException e) {

6
designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java

@ -236,8 +236,9 @@ public class CheckBoxTree extends JTree {
} }
TreePath path = _tree.getPathForLocation(e.getX(), e.getY()); TreePath path = _tree.getPathForLocation(e.getX(), e.getY());
if (path == null) if (path == null) {
return null; return null;
}
if (clicksInCheckBox(e, path)) { if (clicksInCheckBox(e, path)) {
return path; return path;
@ -308,8 +309,9 @@ public class CheckBoxTree extends JTree {
return; return;
} }
if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) {
toggleSelections(); toggleSelections();
}
} }
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {

2
designer_base/src/com/fr/design/locale/designer.properties

@ -1137,7 +1137,7 @@ FRFont-bold=bold
FR-Designer_Set_Submit_Condition= FR-Designer_Set_Submit_Condition=
Form-Change_Widget_Name=Change Widget Name Form-Change_Widget_Name=Change Widget Name
ReportColumns-Report_Columns=Report Columns ReportColumns-Report_Columns=Report Columns
Can_not_use_FormatBursh= FR-Designer_Can_not_use_FormatBursh=
CellElement-Property_Table=CellElement Property Table CellElement-Property_Table=CellElement Property Table
Dictionary-Dynamic_SQL=Dynamic SQL Dictionary-Dynamic_SQL=Dynamic SQL
FR-Designer_Form-CheckBoxGroup=CheckBoxGroup FR-Designer_Form-CheckBoxGroup=CheckBoxGroup

2
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -1138,7 +1138,7 @@ FRFont-bold=Bold
FR-Designer_Set_Submit_Condition=Submit Condition FR-Designer_Set_Submit_Condition=Submit Condition
Form-Change_Widget_Name=Change Control Name Form-Change_Widget_Name=Change Control Name
ReportColumns-Report_Columns=Multi-columns/lines display ReportColumns-Report_Columns=Multi-columns/lines display
Can_not_use_FormatBursh=Can't use format painter in multiple selections FR-Designer_Can_not_use_FormatBursh=Can't use format painter in multiple selections
CellElement-Property_Table=Cell Attribute Table CellElement-Property_Table=Cell Attribute Table
Dictionary-Dynamic_SQL=Dynamic SQL Dictionary-Dynamic_SQL=Dynamic SQL
FR-Designer_Form-CheckBoxGroup=CheckBoxGroup FR-Designer_Form-CheckBoxGroup=CheckBoxGroup

2
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1133,7 +1133,7 @@ FRFont-bold=\u592A\u5B57
FR-Designer_Set_Submit_Condition=\u63D0\u51FA\u6761\u4EF6\u3092\u8A2D\u5B9A FR-Designer_Set_Submit_Condition=\u63D0\u51FA\u6761\u4EF6\u3092\u8A2D\u5B9A
Form-Change_Widget_Name=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u540D\u5909\u66F4 Form-Change_Widget_Name=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u540D\u5909\u66F4
ReportColumns-Report_Columns=\u5E33\u7968\u30B3\u30E9\u30E0 ReportColumns-Report_Columns=\u5E33\u7968\u30B3\u30E9\u30E0
Can_not_use_FormatBursh=\u8907\u6570\u9078\u629E\u3057\u305F\u30A8\u30EA\u30A2\u3067\u306F\u66F8\u5F0F\u30D6\u30E9\u30B7\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\! FR-Designer_Can_not_use_FormatBursh=\u8907\u6570\u9078\u629E\u3057\u305F\u30A8\u30EA\u30A2\u3067\u306F\u66F8\u5F0F\u30D6\u30E9\u30B7\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\!
CellElement-Property_Table=\u30BB\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u00B7\u30B7\u30FC\u30C8 CellElement-Property_Table=\u30BB\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u00B7\u30B7\u30FC\u30C8
Dictionary-Dynamic_SQL=\u52D5\u614BSQL Dictionary-Dynamic_SQL=\u52D5\u614BSQL
FR-Designer_Form-CheckBoxGroup=\u30D5\u30EC\u30FC\u30E0\u30BB\u30C3\u30C8\u3092\u8907\u6570\u9078\u629E FR-Designer_Form-CheckBoxGroup=\u30D5\u30EC\u30FC\u30E0\u30BB\u30C3\u30C8\u3092\u8907\u6570\u9078\u629E

2
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -1134,7 +1134,7 @@ FRFont-bold=\uAD75\uAC8C
FR-Designer_Set_Submit_Condition=\uC81C\uCD9C\uC870\uAC74\uC124\uC815 FR-Designer_Set_Submit_Condition=\uC81C\uCD9C\uC870\uAC74\uC124\uC815
Form-Change_Widget_Name=\uC18C\uD504\uD2B8\uC6E8\uC5B4\uC81C\uC5B4\uC774\uB984\uBCC0\uACBD Form-Change_Widget_Name=\uC18C\uD504\uD2B8\uC6E8\uC5B4\uC81C\uC5B4\uC774\uB984\uBCC0\uACBD
ReportColumns-Report_Columns=\uBB38\uC11C\uC140\uB098\uB204\uAE30 ReportColumns-Report_Columns=\uBB38\uC11C\uC140\uB098\uB204\uAE30
Can_not_use_FormatBursh=\uC911\uBCF5\uC120\uD0DD\uB41C\uC601\uC5ED\uC5D0\uC11C\uC2DD\uC744\uC774\uC6A9\uD558\uC5EC\uC778\uC1C4\uD560\uC218\uC5C6\uC2B5\uB2C8\uB2E4.\! FR-Designer_Can_not_use_FormatBursh=\uC911\uBCF5\uC120\uD0DD\uB41C\uC601\uC5ED\uC5D0\uC11C\uC2DD\uC744\uC774\uC6A9\uD558\uC5EC\uC778\uC1C4\uD560\uC218\uC5C6\uC2B5\uB2C8\uB2E4.\!
CellElement-Property_Table=\uC140\uC18D\uC131\uD45C CellElement-Property_Table=\uC140\uC18D\uC131\uD45C
Dictionary-Dynamic_SQL=\uB3D9\uC801 SQL Dictionary-Dynamic_SQL=\uB3D9\uC801 SQL
FR-Designer_Form-CheckBoxGroup=\uCCB4\uD06C\uBC15\uC2A4\uADF8\uB8F9 FR-Designer_Form-CheckBoxGroup=\uCCB4\uD06C\uBC15\uC2A4\uADF8\uB8F9

2
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -1133,7 +1133,7 @@ FRFont-bold=\u52A0\u7C97
FR-Designer_Set_Submit_Condition=\u8BBE\u7F6E\u63D0\u4EA4\u6761\u4EF6 FR-Designer_Set_Submit_Condition=\u8BBE\u7F6E\u63D0\u4EA4\u6761\u4EF6
Form-Change_Widget_Name=\u66F4\u6539\u63A7\u4EF6\u540D Form-Change_Widget_Name=\u66F4\u6539\u63A7\u4EF6\u540D
ReportColumns-Report_Columns=\u62A5\u8868\u5206\u680F ReportColumns-Report_Columns=\u62A5\u8868\u5206\u680F
Can_not_use_FormatBursh=\u4E0D\u80FD\u5BF9\u591A\u91CD\u9009\u5B9A\u533A\u57DF\u4F7F\u7528\u683C\u5F0F\u5237\! FR-Designer_Can_not_use_FormatBursh=\u4E0D\u80FD\u5BF9\u591A\u91CD\u9009\u5B9A\u533A\u57DF\u4F7F\u7528\u683C\u5F0F\u5237\!
CellElement-Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868 CellElement-Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868
Dictionary-Dynamic_SQL=\u52A8\u6001SQL Dictionary-Dynamic_SQL=\u52A8\u6001SQL
FR-Designer_Form-CheckBoxGroup=\u590D\u9009\u6846\u7EC4 FR-Designer_Form-CheckBoxGroup=\u590D\u9009\u6846\u7EC4

2
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -1133,7 +1133,7 @@ FRFont-bold=\u7C97\u9AD4
FR-Designer_Set_Submit_Condition=\u8A2D\u5B9A\u63D0\u4EA4\u689D\u4EF6 FR-Designer_Set_Submit_Condition=\u8A2D\u5B9A\u63D0\u4EA4\u689D\u4EF6
Form-Change_Widget_Name=\u66F4\u6539\u63A7\u5236\u9805\u540D Form-Change_Widget_Name=\u66F4\u6539\u63A7\u5236\u9805\u540D
ReportColumns-Report_Columns=\u5831\u8868\u5206\u6B04 ReportColumns-Report_Columns=\u5831\u8868\u5206\u6B04
Can_not_use_FormatBursh=\u7121\u6CD5\u4F7F\u7528\u8907\u88FD\u683C\u5F0F FR-Designer_Can_not_use_FormatBursh=\u7121\u6CD5\u4F7F\u7528\u8907\u88FD\u683C\u5F0F
CellElement-Property_Table=\u5132\u5B58\u683C\u5C6C\u6027\u8868 CellElement-Property_Table=\u5132\u5B58\u683C\u5C6C\u6027\u8868
Dictionary-Dynamic_SQL=\u52D5\u614BSQL Dictionary-Dynamic_SQL=\u52D5\u614BSQL
FR-Designer_Form-CheckBoxGroup=\u5FA9\u9078\u6846\u7D44 FR-Designer_Form-CheckBoxGroup=\u5FA9\u9078\u6846\u7D44

475
designer_form/src/com/fr/design/mainframe/widget/editors/DataTableConfigPane.java

@ -25,248 +25,249 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M
public class DataTableConfigPane extends JComponent implements PropertyChangeListener { public class DataTableConfigPane extends JComponent implements PropertyChangeListener {
private DataEditingTable table; private DataEditingTable table;
public DataTableConfigPane() { public DataTableConfigPane() {
table = new DataEditingTable(); table = new DataEditingTable();
JScrollPane scrollPane = new JScrollPane(table); JScrollPane scrollPane = new JScrollPane(table);
this.setLayout(new DataTableLayout()); this.setLayout(new DataTableLayout());
this.add(scrollPane, BorderLayout.CENTER); this.add(scrollPane, BorderLayout.CENTER);
} }
public void populate(DataTableConfig config) { public void populate(DataTableConfig config) {
table.populate(config); table.populate(config);
} }
public DataTableConfig update() { public DataTableConfig update() {
return table.update(); return table.update();
} }
class DataTableLayout extends BorderLayout { class DataTableLayout extends BorderLayout {
public void layoutContainer(Container target) { public void layoutContainer(Container target) {
super.layoutContainer(target); super.layoutContainer(target);
table.doLayout(); table.doLayout();
} }
} }
class DataEditingTable extends JTable { class DataEditingTable extends JTable {
private DataTableConfig config; private DataTableConfig config;
private BeanTableModel model; private BeanTableModel model;
private TableColumnModelListener modeListener; private TableColumnModelListener modeListener;
public DataEditingTable() { public DataEditingTable() {
this.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210), 1)); this.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210), 1));
this.setColumnSelectionAllowed(true); this.setColumnSelectionAllowed(true);
this.setRowSelectionAllowed(true); this.setRowSelectionAllowed(true);
MouseAdapterListener l = new MouseAdapterListener(this); MouseAdapterListener l = new MouseAdapterListener(this);
this.addMouseListener(l); this.addMouseListener(l);
this.addMouseMotionListener(l); this.addMouseMotionListener(l);
model = new BeanTableModel(); model = new BeanTableModel();
modeListener = new TableColumnModelListener() { modeListener = new TableColumnModelListener() {
@Override @Override
public void columnAdded(TableColumnModelEvent e) { public void columnAdded(TableColumnModelEvent e) {
} }
@Override @Override
public void columnMarginChanged(ChangeEvent e) { public void columnMarginChanged(ChangeEvent e) {
DataTableConfigPane.this.propertyChange(); DataTableConfigPane.this.propertyChange();
} }
@Override @Override
public void columnMoved(TableColumnModelEvent e) { public void columnMoved(TableColumnModelEvent e) {
DataTableConfigPane.this.propertyChange(); DataTableConfigPane.this.propertyChange();
} }
@Override @Override
public void columnRemoved(TableColumnModelEvent e) { public void columnRemoved(TableColumnModelEvent e) {
} }
@Override @Override
public void columnSelectionChanged(ListSelectionEvent e) { public void columnSelectionChanged(ListSelectionEvent e) {
} }
}; };
} }
public TableCellRenderer getCellRenderer(int row, int column) { public TableCellRenderer getCellRenderer(int row, int column) {
TableCellRenderer renderer = super.getCellRenderer(row, column); TableCellRenderer renderer = super.getCellRenderer(row, column);
if (renderer instanceof UILabel) { if (renderer instanceof UILabel) {
((UILabel) renderer).setHorizontalAlignment(UILabel.CENTER); ((UILabel) renderer).setHorizontalAlignment(UILabel.CENTER);
} }
return renderer; return renderer;
} }
public void populate(DataTableConfig config) { public void populate(DataTableConfig config) {
this.getTableHeader().getColumnModel().removeColumnModelListener(modeListener); this.getTableHeader().getColumnModel().removeColumnModelListener(modeListener);
if (config == null) { if (config == null) {
config = DataTableConfig.DEFAULT_TABLE_DATA_CONFIG; config = DataTableConfig.DEFAULT_TABLE_DATA_CONFIG;
} }
this.config = config; this.config = config;
model = new BeanTableModel(); model = new BeanTableModel();
this.setModel(model); this.setModel(model);
this.setRowHeight(0, config.getRowHeight()); this.setRowHeight(0, config.getRowHeight());
for (int i = 0; i < config.getColumnCount(); i++) { for (int i = 0; i < config.getColumnCount(); i++) {
this.getColumn(this.getColumnName(i)).setPreferredWidth(config.getColumnWidth(i)); this.getColumn(this.getColumnName(i)).setPreferredWidth(config.getColumnWidth(i));
} }
this.getTableHeader().getColumnModel().addColumnModelListener(modeListener); this.getTableHeader().getColumnModel().addColumnModelListener(modeListener);
this.doLayout(); this.doLayout();
this.repaint(); this.repaint();
} }
public DataTableConfig update() { public DataTableConfig update() {
config.setRowHeight(this.getRowHeight(0)); config.setRowHeight(this.getRowHeight(0));
model = new BeanTableModel(); model = new BeanTableModel();
String[] columns = new String[this.getColumnCount()]; String[] columns = new String[this.getColumnCount()];
for (int i = 0; i < this.getColumnCount(); i++) { for (int i = 0; i < this.getColumnCount(); i++) {
config.setColumnWidth(i, this.getColumn(this.getColumnName(i)).getWidth()); config.setColumnWidth(i, this.getColumn(this.getColumnName(i)).getWidth());
columns[i] = this.getColumnName(i); columns[i] = this.getColumnName(i);
} }
config.setColumns(columns); config.setColumns(columns);
return config; return config;
} }
public class BeanTableModel extends AbstractTableModel { public class BeanTableModel extends AbstractTableModel {
@Override @Override
public int getColumnCount() { public int getColumnCount() {
return config.getColumnCount(); return config.getColumnCount();
} }
@Override @Override
public int getRowCount() { public int getRowCount() {
return 1; return 1;
} }
@Override @Override
public String getColumnName(int column) { public String getColumnName(int column) {
return config.getColumnName(column); return config.getColumnName(column);
} }
@Override @Override
public Object getValueAt(int rowIndex, int columnIndex) { public Object getValueAt(int rowIndex, int columnIndex) {
return config.getTableDataName() + "." + config.getColumnName(columnIndex); return config.getTableDataName() + "." + config.getColumnName(columnIndex);
} }
} }
class MouseAdapterListener extends MouseAdapter { class MouseAdapterListener extends MouseAdapter {
private JTable table; private JTable table;
int oldY = 0; int oldY = 0;
int newY = 0; int newY = 0;
int row = 0; int row = 0;
int oldHeight = 0; int oldHeight = 0;
boolean drag = false; boolean drag = false;
int increase = 0; int increase = 0;
JPopupMenu popupMenu; JPopupMenu popupMenu;
public MouseAdapterListener(JTable table) { public MouseAdapterListener(JTable table) {
this.table = table; this.table = table;
popupMenu = new JPopupMenu(); popupMenu = new JPopupMenu();
popupMenu.add(new CutAction()); popupMenu.add(new CutAction());
popupMenu.add(new CutAction()); popupMenu.add(new CutAction());
popupMenu.add(new CutAction()); popupMenu.add(new CutAction());
popupMenu.add(new CutAction()); popupMenu.add(new CutAction());
} }
class CutAction extends UpdateAction { class CutAction extends UpdateAction {
/** /**
* Constructor * Constructor
*/ */
public CutAction() { public CutAction() {
this.setName(Inter.getLocText("M_Edit-Cut")); this.setName(Inter.getLocText("M_Edit-Cut"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int row = table.getSelectedRow(); int row = table.getSelectedRow();
int column = table.getSelectedColumn(); int column = table.getSelectedColumn();
table.getColumnModel().removeColumn(table.getColumn(table.getColumnName(column))); table.getColumnModel().removeColumn(table.getColumn(table.getColumnName(column)));
DataTableConfigPane.this.propertyChange(); DataTableConfigPane.this.propertyChange();
} }
} }
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
int onRow = table.rowAtPoint(e.getPoint()); int onRow = table.rowAtPoint(e.getPoint());
int height = 0; int height = 0;
for (int i = 0; i <= onRow; i++) { for (int i = 0; i <= onRow; i++) {
height = height + table.getRowHeight(i); height = height + table.getRowHeight(i);
} }
if (height - e.getY() < 3) { if (height - e.getY() < 3) {
drag = true; drag = true;
table.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR)); table.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
} else { } else {
drag = false; drag = false;
table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
} }
} }
private void trigger_popup(MouseEvent e) { private void trigger_popup(MouseEvent e) {
popupMenu.show(table, e.getX(), e.getY()); popupMenu.show(table, e.getX(), e.getY());
} }
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (drag) { if (drag) {
int value = oldHeight + e.getY() - oldY; int value = oldHeight + e.getY() - oldY;
if (value < 30) if (value < 30) {
table.setRowHeight(row, 30); table.setRowHeight(row, 30);
else } else {
table.setRowHeight(row, oldHeight + e.getY() - oldY); table.setRowHeight(row, oldHeight + e.getY() - oldY);
DataTableConfigPane.this.propertyChange(); }
} DataTableConfigPane.this.propertyChange();
} }
}
public void mousePressed(MouseEvent e) {
oldY = e.getY(); public void mousePressed(MouseEvent e) {
row = table.rowAtPoint(e.getPoint()); oldY = e.getY();
oldHeight = table.getRowHeight(row); row = table.rowAtPoint(e.getPoint());
if (e.getButton() == MouseEvent.BUTTON3) { oldHeight = table.getRowHeight(row);
trigger_popup(e); if (e.getButton() == MouseEvent.BUTTON3) {
} trigger_popup(e);
} }
}
public void mouseReleased(MouseEvent e) {
newY = e.getY(); public void mouseReleased(MouseEvent e) {
table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); newY = e.getY();
} table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
} }
} }
}
private ArrayList<PropertyChangeListener> changetList = new ArrayList<PropertyChangeListener>();
private ArrayList<PropertyChangeListener> changetList = new ArrayList<PropertyChangeListener>();
public void addpropertyChangeListener(PropertyChangeListener l) {
changetList.add(l); public void addpropertyChangeListener(PropertyChangeListener l) {
} changetList.add(l);
}
@Override
public void propertyChange() { @Override
for (PropertyChangeListener l : changetList) { public void propertyChange() {
l.propertyChange(); for (PropertyChangeListener l : changetList) {
} l.propertyChange();
} }
}
@Override @Override
public void propertyChange(Object mark) { public void propertyChange(Object mark) {
} }
@Override @Override
public void propertyChange(Object[] marks) { public void propertyChange(Object[] marks) {
} }
} }
Loading…
Cancel
Save