Browse Source

Merge pull request #1500 in DESIGN/design from ~BJORN/design:release/10.0 to release/10.0

* commit '68f8530144bf8e6db1724fa99e5f9a194141b0e6':
  CHART-13033 && CHART-13045	点击下拉框时展开下拉列表 && 取消保存的数据集和区域名
feature/big-screen
Bjorn 5 years ago
parent
commit
55e01c33f8
  1. 61
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  2. 9
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  3. 42
      designer-chart/src/main/java/com/fr/design/chartx/component/TableTreeComboBox.java

61
designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -1,22 +1,14 @@
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.BorderLayout; import com.fr.design.constants.UIConstants;
import java.awt.Color; import com.fr.design.gui.ibutton.UIButton;
import java.awt.Component; import com.fr.design.gui.ilable.UILabel;
import java.awt.Dimension; import com.fr.design.gui.itextfield.UITextField;
import java.awt.Graphics; import com.fr.design.layout.FRGUIPaneFactory;
import java.awt.Graphics2D; import com.fr.general.ComparatorUtils;
import java.awt.IllegalComponentStateException; import com.fr.general.NameObject;
import java.awt.RenderingHints; import com.fr.stable.Constants;
import java.awt.event.KeyAdapter; import com.fr.stable.StringUtils;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -38,16 +30,23 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.util.Enumeration;
import com.fr.design.constants.UIConstants; import java.awt.BorderLayout;
import com.fr.design.gui.ibutton.UIButton; import java.awt.Color;
import com.fr.design.gui.ilable.UILabel; import java.awt.Component;
import com.fr.design.gui.itextfield.UITextField; import java.awt.Dimension;
import com.fr.design.layout.FRGUIPaneFactory; import java.awt.Graphics;
import com.fr.general.ComparatorUtils; import java.awt.Graphics2D;
import com.fr.general.NameObject; import java.awt.IllegalComponentStateException;
import com.fr.stable.Constants; import java.awt.RenderingHints;
import com.fr.stable.StringUtils; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
public class FRTreeComboBox extends UIComboBox { public class FRTreeComboBox extends UIComboBox {
@ -79,7 +78,7 @@ public class FRTreeComboBox extends UIComboBox {
boolean showRoot, boolean editable) { boolean showRoot, boolean editable) {
this.setTree(tree); this.setTree(tree);
this.tree.setCellRenderer(renderer); this.tree.setCellRenderer(renderer);
this.setEditor(new FrTreeSearchComboBoxEditor(this)); this.setEditor(createEditor());
if (!showRoot) { if (!showRoot) {
tree.expandPath(new TreePath(tree.getModel().getRoot())); tree.expandPath(new TreePath(tree.getModel().getRoot()));
tree.setRootVisible(false); tree.setRootVisible(false);
@ -101,6 +100,10 @@ public class FRTreeComboBox extends UIComboBox {
return true; return true;
} }
protected UIComboBoxEditor createEditor() {
return new FrTreeSearchComboBoxEditor(this);
}
public void setTree(JTree tree) { public void setTree(JTree tree) {
this.tree = tree; this.tree = tree;
if (tree != null) { if (tree != null) {
@ -529,7 +532,7 @@ public class FRTreeComboBox extends UIComboBox {
} }
} }
class FrTreeSearchComboBoxEditor extends UIComboBoxEditor implements DocumentListener { public class FrTreeSearchComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private volatile boolean setting = false; private volatile boolean setting = false;
private FRTreeComboBox comboBox; private FRTreeComboBox comboBox;
private Object item; private Object item;

9
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -180,10 +180,6 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
if (matchResult == null) { if (matchResult == null) {
return; return;
} }
if (tableNameCombox.getSelectedItem() != null) {
matchResult.setTableName(tableNameCombox.getSelectedItem().getTableDataName());
}
matchResult.setColumnName(GeneralUtils.objectToString(areaNameBox.getSelectedItem()));
matchResultTable.updateBean(matchResult); matchResultTable.updateBean(matchResult);
} }
@ -195,11 +191,6 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
public void populateBean(MapMatchResult matchResult, String tableName, String areaName) { public void populateBean(MapMatchResult matchResult, String tableName, String areaName) {
//先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名 //先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名
matchResultTable.populateBean(matchResult); matchResultTable.populateBean(matchResult);
if (matchResult != null && StringUtils.isNotEmpty(matchResult.getTableName())) {
tableName = matchResult.getTableName();
areaName = matchResult.getColumnName();
}
tableNameCombox.setSelectedTableDataByName(tableName); tableNameCombox.setSelectedTableDataByName(tableName);
if (StringUtils.isEmpty(areaName)) { if (StringUtils.isEmpty(areaName)) {
return; return;

42
designer-chart/src/main/java/com/fr/design/chartx/component/TableTreeComboBox.java

@ -1,6 +1,7 @@
package com.fr.design.chartx.component; package com.fr.design.chartx.component;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.UIComboBoxEditor;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -19,6 +20,8 @@ import java.awt.Component;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/** /**
* @author Bjorn * @author Bjorn
@ -49,11 +52,16 @@ public class TableTreeComboBox extends FRTreeComboBox {
public void resetText() { public void resetText() {
Object selectedItem = this.getSelectedItem(); Object selectedItem = this.getSelectedItem();
if(!ComparatorUtils.equals(selectedItem, textField.getText())){ if (!ComparatorUtils.equals(selectedItem, textField.getText())) {
textField.setText(GeneralUtils.objectToString(selectedItem)); textField.setText(GeneralUtils.objectToString(selectedItem));
} }
} }
@Override
protected UIComboBoxEditor createEditor() {
return new TableTreeComboBoxEditor(this);
}
private boolean matchLeafNode(TreePath parent, TreeNode node, UITextField textField) { private boolean matchLeafNode(TreePath parent, TreeNode node, UITextField textField) {
for (Enumeration e = node.children(); e.hasMoreElements(); ) { for (Enumeration e = node.children(); e.hasMoreElements(); ) {
TreeNode n = (TreeNode) e.nextElement(); TreeNode n = (TreeNode) e.nextElement();
@ -107,4 +115,36 @@ public class TableTreeComboBox extends FRTreeComboBox {
} }
}; };
class TableTreeComboBoxEditor extends FrTreeSearchComboBoxEditor {
public TableTreeComboBoxEditor(FRTreeComboBox comboBox) {
super(comboBox);
textField.addMouseListener(mouseListener);
}
private MouseListener mouseListener = new MouseListener() {
public void mouseClicked(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
setPopupVisible(true);
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
};
}
} }

Loading…
Cancel
Save