Browse Source

REPORT-69470 多分类坐标轴分层显示,选择部分轴标签颜色弹窗自动关闭

feature/x
方磊 3 years ago
parent
commit
9af7ee1f81
  1. 46
      designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java
  2. 20
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  3. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java

46
designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java

@ -0,0 +1,46 @@
package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public abstract class ClosableBubbleFloatPane<T> extends UIBubbleFloatPane<T> {
public ClosableBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) {
super(arrowPosition, arrowPoint, contentPane);
}
public ClosableBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) {
super(arrowPosition, arrowPoint, contentPane, width, height);
}
protected void initAWTEventListener() {
}
public boolean forceLockFocus() {
return true;
}
protected JPanel initTopOptionMenu() {
JPanel menu = new JPanel(new BorderLayout());
Icon icon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
UILabel label = new UILabel(icon);
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
showDialog.setVisible(false);
updateContentPane();
}
});
menu.add(label, BorderLayout.EAST);
return menu;
}
}

20
designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java

@ -48,7 +48,7 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
private int arrowPosition; private int arrowPosition;
private double time = 0.5; private double time = 0.5;
private UIDialog showDialog; protected UIDialog showDialog;
/** /**
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
@ -93,11 +93,22 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
populateBean(ob); populateBean(ob);
if (showDialog == null) { if (showDialog == null) {
showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane));
if (forceLockFocus()) {
showDialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
} }
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); }
initAWTEventListener();
showDialog.setVisible(true); showDialog.setVisible(true);
} }
public boolean forceLockFocus() {
return false;
}
protected void initAWTEventListener() {
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
}
/** /**
* 数据展现 * 数据展现
*/ */
@ -213,9 +224,14 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
} }
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(initTopOptionMenu(), BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
} }
protected JPanel initTopOptionMenu() {
return new JPanel();
}
private class CustomShapedDialog extends UIDialog { private class CustomShapedDialog extends UIDialog {
private static final int GAP_SMALL = 10; private static final int GAP_SMALL = 10;

4
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java

@ -1,7 +1,7 @@
package com.fr.van.chart.designer.style.axis.component; package com.fr.van.chart.designer.style.axis.component;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.ClosableBubbleFloatPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -68,7 +68,7 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel {
Point comPoint = settingButton.getLocationOnScreen(); Point comPoint = settingButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight());
Dimension size = settingPane.getPreferredSize(); Dimension size = settingPane.getPreferredSize();
UIBubbleFloatPane<VanChartAxisLabelStyle> pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 230) { ClosableBubbleFloatPane<VanChartAxisLabelStyle> pane = new ClosableBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 240) {
@Override @Override
public void updateContentPane() { public void updateContentPane() {

Loading…
Cancel
Save