|
|
@ -1,10 +1,10 @@ |
|
|
|
package com.fr.design.mainframe.chart.gui; |
|
|
|
package com.fr.design.mainframe.chart.gui; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.chart.base.AttrChangeConfig; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
import com.fr.chart.chartattr.ChartCollection; |
|
|
|
import com.fr.chart.chartattr.ChartCollection; |
|
|
|
import com.fr.chart.chartattr.SwitchState; |
|
|
|
import com.fr.chart.chartattr.SwitchState; |
|
|
|
import com.fr.chart.base.AttrChangeConfig; |
|
|
|
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
import com.fr.design.dialog.DialogActionListener; |
|
|
|
import com.fr.design.dialog.DialogActionListener; |
|
|
|
import com.fr.design.dialog.UIDialog; |
|
|
|
import com.fr.design.dialog.UIDialog; |
|
|
@ -53,19 +53,14 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
|
|
|
|
|
|
|
|
private ChartTypePane parent = null; |
|
|
|
private ChartTypePane parent = null; |
|
|
|
|
|
|
|
|
|
|
|
//记录鼠标当前是否在操作添加按钮
|
|
|
|
|
|
|
|
private boolean mouseOnChartTypeButtonPane = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//配置窗口属性
|
|
|
|
//配置窗口属性
|
|
|
|
private UIMenuNameableCreator configCreator; |
|
|
|
private UIMenuNameableCreator configCreator; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
//处理 编辑一个button时,选中另一个button的问题.
|
|
|
|
* 鼠标事件是否在这个面板 |
|
|
|
//stopEditing不能直接relayout,否则click事件不响应了.
|
|
|
|
* @return 返回是否 |
|
|
|
//所以:stopEditing--选中其他button则响应click之后relayout;普通失焦则直接relayout.
|
|
|
|
*/ |
|
|
|
private boolean pressOtherButtonWhenEditing = false; |
|
|
|
public boolean isMouseOnChartTypeButtonPane() { |
|
|
|
|
|
|
|
return this.mouseOnChartTypeButtonPane; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private AWTEventListener awt = new AWTEventListener() {
|
|
|
|
// private AWTEventListener awt = new AWTEventListener() {
|
|
|
|
// public void eventDispatched(AWTEvent event) {
|
|
|
|
// public void eventDispatched(AWTEvent event) {
|
|
|
@ -122,7 +117,6 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
private void initAddButton() { |
|
|
|
private void initAddButton() { |
|
|
|
addButton.setPreferredSize(new Dimension(20, 20)); |
|
|
|
addButton.setPreferredSize(new Dimension(20, 20)); |
|
|
|
addButton.addActionListener(addListener); |
|
|
|
addButton.addActionListener(addListener); |
|
|
|
addButton.addMouseListener(mouseListener); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initConfigButton() { |
|
|
|
private void initConfigButton() { |
|
|
@ -133,7 +127,6 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
ActionListener addListener = new ActionListener() { |
|
|
|
ActionListener addListener = new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
mouseOnChartTypeButtonPane = true; |
|
|
|
|
|
|
|
String name = getNewChartName(); |
|
|
|
String name = getNewChartName(); |
|
|
|
ChartChangeButton button = new ChartChangeButton(name);// some set selected
|
|
|
|
ChartChangeButton button = new ChartChangeButton(name);// some set selected
|
|
|
|
|
|
|
|
|
|
|
@ -189,15 +182,6 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseListener mouseListener = new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
super.mouseExited(e); |
|
|
|
|
|
|
|
mouseOnChartTypeButtonPane = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getNewChartName() { |
|
|
|
private String getNewChartName() { |
|
|
|
int count = indexList.size() + 1; |
|
|
|
int count = indexList.size() + 1; |
|
|
|
while (true) { |
|
|
|
while (true) { |
|
|
@ -352,12 +336,19 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
if (currentEditingEditor != null) { |
|
|
|
if (currentEditingEditor != null) { |
|
|
|
String newName = currentEditingEditor.getText(); |
|
|
|
String newName = currentEditingEditor.getText(); |
|
|
|
int selectedIndex = editingCollection.getSelectedIndex(); |
|
|
|
int selectedIndex = editingCollection.getSelectedIndex(); |
|
|
|
|
|
|
|
ChartChangeButton button = indexList.get(selectedIndex); |
|
|
|
|
|
|
|
button.isMoveOn = false; |
|
|
|
if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) { |
|
|
|
if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) { |
|
|
|
editingCollection.setChartName(selectedIndex, newName); |
|
|
|
editingCollection.setChartName(selectedIndex, newName); |
|
|
|
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); |
|
|
|
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); |
|
|
|
|
|
|
|
button.changeChartName(newName); |
|
|
|
} |
|
|
|
} |
|
|
|
buttonPane.remove(currentEditingEditor); |
|
|
|
buttonPane.remove(currentEditingEditor); |
|
|
|
currentEditingEditor = null; |
|
|
|
currentEditingEditor = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!pressOtherButtonWhenEditing) { |
|
|
|
|
|
|
|
layoutPane(buttonPane); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -375,11 +366,25 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
|
|
|
|
|
|
|
|
buttonName = name; |
|
|
|
buttonName = name; |
|
|
|
this.setToolTipText(name); |
|
|
|
this.setToolTipText(name); |
|
|
|
nameField.addActionListener(new ActionListener() { |
|
|
|
nameField.addActionListener(new ActionListener() {//enter
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
pressOtherButtonWhenEditing = false; |
|
|
|
stopEditing(); |
|
|
|
stopEditing(); |
|
|
|
populateBean(editingCollection); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nameField.addFocusListener(new FocusListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void focusLost(FocusEvent e) {//编辑状态lost才走这边
|
|
|
|
|
|
|
|
if (currentEditingEditor != null ) { |
|
|
|
|
|
|
|
stopEditing(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -388,6 +393,11 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
return buttonName; |
|
|
|
return buttonName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void changeChartName(String name) { |
|
|
|
|
|
|
|
this.setText(name); |
|
|
|
|
|
|
|
buttonName = name; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
return new Dimension(B_W, B_H); |
|
|
|
return new Dimension(B_W, B_H); |
|
|
|
} |
|
|
|
} |
|
|
@ -467,17 +477,20 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
mouseClick(e); |
|
|
|
mouseClick(e); |
|
|
|
mouseOnChartTypeButtonPane = true; |
|
|
|
if(pressOtherButtonWhenEditing){ |
|
|
|
|
|
|
|
relayoutPane(); |
|
|
|
|
|
|
|
pressOtherButtonWhenEditing = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
checkMoveOn(true); |
|
|
|
checkMoveOn(true); |
|
|
|
mouseOnChartTypeButtonPane = true; |
|
|
|
pressOtherButtonWhenEditing = currentEditingEditor != null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
checkMoveOn(false); |
|
|
|
checkMoveOn(false); |
|
|
|
mouseOnChartTypeButtonPane = false; |
|
|
|
pressOtherButtonWhenEditing = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|