Browse Source

CHART-13033 && CHART-13045 点击下拉框时展开下拉列表 && 取消保存的数据集和区域名

feature/big-screen
白岳 5 years ago
parent
commit
68f8530144
  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. 40
      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;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.IllegalComponentStateException;
import java.awt.RenderingHints;
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;
import java.util.Enumeration;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
@ -38,16 +30,23 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import java.util.Enumeration;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.IllegalComponentStateException;
import java.awt.RenderingHints;
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 {
@ -79,7 +78,7 @@ public class FRTreeComboBox extends UIComboBox {
boolean showRoot, boolean editable) {
this.setTree(tree);
this.tree.setCellRenderer(renderer);
this.setEditor(new FrTreeSearchComboBoxEditor(this));
this.setEditor(createEditor());
if (!showRoot) {
tree.expandPath(new TreePath(tree.getModel().getRoot()));
tree.setRootVisible(false);
@ -101,6 +100,10 @@ public class FRTreeComboBox extends UIComboBox {
return true;
}
protected UIComboBoxEditor createEditor() {
return new FrTreeSearchComboBoxEditor(this);
}
public void setTree(JTree tree) {
this.tree = tree;
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 FRTreeComboBox comboBox;
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) {
return;
}
if (tableNameCombox.getSelectedItem() != null) {
matchResult.setTableName(tableNameCombox.getSelectedItem().getTableDataName());
}
matchResult.setColumnName(GeneralUtils.objectToString(areaNameBox.getSelectedItem()));
matchResultTable.updateBean(matchResult);
}
@ -195,11 +191,6 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
public void populateBean(MapMatchResult matchResult, String tableName, String areaName) {
//先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名
matchResultTable.populateBean(matchResult);
if (matchResult != null && StringUtils.isNotEmpty(matchResult.getTableName())) {
tableName = matchResult.getTableName();
areaName = matchResult.getColumnName();
}
tableNameCombox.setSelectedTableDataByName(tableName);
if (StringUtils.isEmpty(areaName)) {
return;

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

@ -1,6 +1,7 @@
package com.fr.design.chartx.component;
import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.UIComboBoxEditor;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
@ -19,6 +20,8 @@ import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
* @author Bjorn
@ -54,6 +57,11 @@ public class TableTreeComboBox extends FRTreeComboBox {
}
}
@Override
protected UIComboBoxEditor createEditor() {
return new TableTreeComboBoxEditor(this);
}
private boolean matchLeafNode(TreePath parent, TreeNode node, UITextField textField) {
for (Enumeration e = node.children(); e.hasMoreElements(); ) {
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