Browse Source

CHART-12992&&CHART-13025 bugFix

feature/big-screen
白岳 5 years ago
parent
commit
d44fd448c9
  1. 3
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  2. 1
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  3. 16
      designer-chart/src/main/java/com/fr/design/chartx/component/TableTreeComboBox.java
  4. 55
      designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java

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

@ -250,7 +250,8 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
int size = dataModel.getRowCount(); int size = dataModel.getRowCount();
HashSet<Object> columnData = new LinkedHashSet<>(); HashSet<Object> columnData = new LinkedHashSet<>();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
columnData.add(dataModel.getValueAt(i, colIndex)); Object valueAt = dataModel.getValueAt(i, colIndex);
columnData.add(valueAt == null ? StringUtils.EMPTY : valueAt);
} }
return columnData.toArray(); return columnData.toArray();
} catch (TableDataException ignore) { } catch (TableDataException ignore) {

1
designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java

@ -125,6 +125,7 @@ public class MatchAreaTable extends JTable {
} }
public Object getCellEditorValue() { public Object getCellEditorValue() {
comboBox.resetText();
return comboBox.getSelectedItem(); return comboBox.getSelectedItem();
} }
} }

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

@ -2,6 +2,8 @@ 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.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import javax.swing.JTextField; import javax.swing.JTextField;
@ -39,6 +41,19 @@ public class TableTreeComboBox extends FRTreeComboBox {
matchLeafNode(parent, node, textField); matchLeafNode(parent, node, textField);
} }
@Override
public void setSelectedItemString(String name) {
super.setSelectedItemString(name);
this.textField.setText(name);
}
public void resetText() {
Object selectedItem = this.getSelectedItem();
if(!ComparatorUtils.equals(selectedItem, textField.getText())){
textField.setText(GeneralUtils.objectToString(selectedItem));
}
}
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();
@ -71,7 +86,6 @@ public class TableTreeComboBox extends FRTreeComboBox {
.getLastPathComponent(); .getLastPathComponent();
if (node.isLeaf()) { if (node.isLeaf()) {
TableTreeComboBox.this.setSelectedItem(treePath); TableTreeComboBox.this.setSelectedItem(treePath);
textField.setText(pathToString(treePath));
MenuSelectionManager.defaultManager().clearSelectedPath(); MenuSelectionManager.defaultManager().clearSelectedPath();
} }
} }

55
designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java

@ -21,6 +21,8 @@ import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
/** /**
* @author Bjorn * @author Bjorn
@ -52,12 +54,18 @@ public abstract class VanMapTableDataContentPane extends AbstractTableDataConten
this.matchResult = matchResult; this.matchResult = matchResult;
} }
public JPanel createAreaPanel(final UIComboBox areaBox) { public JPanel createAreaPanel(UIComboBox areaBox) {
JPanel areaPanel = new JPanel(new BorderLayout(4, 0)); JPanel areaPanel = new JPanel(new BorderLayout(4, 0));
areaBox.setPreferredSize(new Dimension(70, 20)); areaBox.setPreferredSize(new Dimension(70, 20));
areaPanel.add(areaBox, BorderLayout.CENTER); areaPanel.add(areaBox, BorderLayout.CENTER);
UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
uiButton.addActionListener(new ActionListener() { uiButton.addActionListener(createActionListener(areaBox));
areaPanel.add(uiButton, BorderLayout.EAST);
return areaPanel;
}
private ActionListener createActionListener(final UIComboBox areaBox){
return new ActionListener() {
private TwoTuple<DefaultMutableTreeNode, Set<String>> treeNodeAndItems; private TwoTuple<DefaultMutableTreeNode, Set<String>> treeNodeAndItems;
@Override @Override
@ -67,9 +75,8 @@ public abstract class VanMapTableDataContentPane extends AbstractTableDataConten
} }
final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems); final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems);
String nameTable = getTableName(); final String nameTable = getTableName();
pane.populateBean(matchResult, nameTable, Utils.objectToString(areaBox.getSelectedItem()));
BasicDialog dialog = pane.showWindow(new JFrame()); BasicDialog dialog = pane.showWindow(new JFrame());
dialog.addDialogActionListener(new DialogActionListener() { dialog.addDialogActionListener(new DialogActionListener() {
@Override @Override
@ -82,11 +89,45 @@ public abstract class VanMapTableDataContentPane extends AbstractTableDataConten
} }
}); });
dialog.setVisible(true); dialog.addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {
pane.populateBean(matchResult, nameTable, Utils.objectToString(areaBox.getSelectedItem()));
}
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
} }
}); });
areaPanel.add(uiButton, BorderLayout.EAST); dialog.setVisible(true);
return areaPanel; }
};
} }
@Override @Override

Loading…
Cancel
Save