178 changed files with 5577 additions and 5454 deletions
@ -1,8 +1,11 @@ |
|||||||
package com.fr.design.dialog; |
package com.fr.design.dialog; |
||||||
|
|
||||||
|
import com.fr.common.annotations.Open; |
||||||
|
|
||||||
|
@Open |
||||||
public interface DialogActionListener { |
public interface DialogActionListener { |
||||||
|
|
||||||
public void doOk(); |
void doOk(); |
||||||
|
|
||||||
public void doCancel(); |
void doCancel(); |
||||||
} |
} |
@ -0,0 +1,24 @@ |
|||||||
|
package com.fr.design.fun; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
import com.fr.stable.fun.mark.Mutable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 移动端组件样式扩展接口 |
||||||
|
*/ |
||||||
|
public interface MobileWidgetStyleProvider extends Mutable { |
||||||
|
|
||||||
|
String XML_TAG = "MobileWidgetStyleProvider"; |
||||||
|
|
||||||
|
int CURRENT_LEVEL = 1; |
||||||
|
|
||||||
|
Class<? extends MobileStyle> classForMobileStyle(); |
||||||
|
|
||||||
|
Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance(); |
||||||
|
|
||||||
|
String xTypeForWidget(); |
||||||
|
|
||||||
|
String displayName(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.fr.design.fun.impl; |
||||||
|
|
||||||
|
import com.fr.design.fun.MobileWidgetStyleProvider; |
||||||
|
import com.fr.stable.fun.impl.AbstractProvider; |
||||||
|
import com.fr.stable.fun.mark.API; |
||||||
|
|
||||||
|
@API(level = MobileWidgetStyleProvider.CURRENT_LEVEL) |
||||||
|
public abstract class AbstractMobileWidgetStyleProvider extends AbstractProvider implements MobileWidgetStyleProvider { |
||||||
|
|
||||||
|
@Override |
||||||
|
public int currentAPILevel() { |
||||||
|
return CURRENT_LEVEL; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String mark4Provider() { |
||||||
|
return getClass().getName(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.fr.design.gui.ispinner; |
||||||
|
|
||||||
|
import com.fr.design.gui.itextfield.UIIntNumberField; |
||||||
|
import com.fr.design.gui.itextfield.UINumberField; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by IntelliJ IDEA. |
||||||
|
* Author : Hugh.C |
||||||
|
* Date: 19-08-28 |
||||||
|
* Time: 下午2:19 |
||||||
|
*/ |
||||||
|
public class UnsignedIntUISpinner extends UISpinner { |
||||||
|
|
||||||
|
|
||||||
|
public UnsignedIntUISpinner(double minValue, double maxValue, double dierta) { |
||||||
|
super(minValue, maxValue, dierta); |
||||||
|
} |
||||||
|
|
||||||
|
public UnsignedIntUISpinner(double minValue, double maxValue, double dierta, double defaultValue) { |
||||||
|
super(minValue, maxValue, dierta, defaultValue); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected UINumberField initNumberField() { |
||||||
|
return new UIIntNumberField() { |
||||||
|
public boolean shouldResponseChangeListener() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package com.fr.design.mainframe.mobile.ui; |
||||||
|
|
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public class DefaultMobileStyleCustomDefinePane extends MobileStyleCustomDefinePane { |
||||||
|
|
||||||
|
|
||||||
|
public DefaultMobileStyleCustomDefinePane(Widget widget) { |
||||||
|
super(widget); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel createPreviewPane() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(MobileStyle ob) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public MobileStyle updateBean() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void init() { |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.fr.design.mainframe.mobile.ui; |
||||||
|
|
||||||
|
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||||
|
import com.fr.form.ui.mobile.DefaultMobileStyle; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
import com.fr.locale.InterProviderFactory; |
||||||
|
|
||||||
|
public class DefaultMobileWidgetStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||||
|
|
||||||
|
@Override |
||||||
|
public Class<? extends MobileStyle> classForMobileStyle() { |
||||||
|
return DefaultMobileStyle.class; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||||
|
return DefaultMobileStyleCustomDefinePane.class; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String xTypeForWidget() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String displayName() { |
||||||
|
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.fr.design.mainframe.mobile.ui; |
||||||
|
|
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public abstract class MobileStyleCustomDefinePane extends BasicBeanPane<MobileStyle> { |
||||||
|
|
||||||
|
protected Widget widget; |
||||||
|
|
||||||
|
public MobileStyleCustomDefinePane(Widget widget) { |
||||||
|
this.widget = widget; |
||||||
|
init(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract JPanel createPreviewPane(); |
||||||
|
|
||||||
|
protected abstract void init(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,122 @@ |
|||||||
|
package com.fr.design.mainframe.mobile.ui; |
||||||
|
|
||||||
|
import com.fr.base.background.ColorBackground; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.style.color.NewColorSelectBox; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
import com.fr.general.FRFont; |
||||||
|
import com.fr.invoke.Reflect; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.border.TitledBorder; |
||||||
|
import javax.swing.event.ChangeEvent; |
||||||
|
import javax.swing.event.ChangeListener; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> { |
||||||
|
|
||||||
|
private Widget widget; |
||||||
|
private MobileStyleCustomDefinePane customBeanPane; |
||||||
|
private Class<? extends MobileStyle> mobileStyleClazz; |
||||||
|
private NewColorSelectBox colorSelectBox; |
||||||
|
private Color titleColor = new Color(47, 142, 241); |
||||||
|
|
||||||
|
MobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass, |
||||||
|
Class<? extends MobileStyle> mobileStyleClazz) { |
||||||
|
this.widget = widget; |
||||||
|
this.customBeanPane = Reflect.on(customBeanPaneClass).create(widget).get(); |
||||||
|
this.mobileStyleClazz = mobileStyleClazz; |
||||||
|
init(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(MobileStyle ob) { |
||||||
|
this.customBeanPane.populateBean(ob); |
||||||
|
if(ob.getBackground() != null) { |
||||||
|
colorSelectBox.setSelectObject(((ColorBackground)ob.getBackground()).getColor()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public MobileStyle updateBean() { |
||||||
|
MobileStyle mobileStyle = Reflect.on(mobileStyleClazz).create().get(); |
||||||
|
this.widget.setMobileStyle(mobileStyle); |
||||||
|
this.customBeanPane.updateBean(); |
||||||
|
mobileStyle.setBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject())); |
||||||
|
return mobileStyle; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private void init() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
createGeneralPane(); |
||||||
|
createCustomPane(); |
||||||
|
} |
||||||
|
|
||||||
|
private void createGeneralPane() { |
||||||
|
createPreviewPane(); |
||||||
|
createBackgroundPane(); |
||||||
|
} |
||||||
|
|
||||||
|
private void createPreviewPane() { |
||||||
|
JPanel mobileStylePreviewPane = this.customBeanPane.createPreviewPane(); |
||||||
|
if(mobileStylePreviewPane != null) { |
||||||
|
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview")); |
||||||
|
previewPane.setBorder(titledBorder); |
||||||
|
previewPane.setPreferredSize(new Dimension(500, 83)); |
||||||
|
previewPane.add(mobileStylePreviewPane, BorderLayout.CENTER); |
||||||
|
this.add(previewPane, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void createBackgroundPane() { |
||||||
|
|
||||||
|
JPanel backgroundPane = new JPanel(); |
||||||
|
backgroundPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5)); |
||||||
|
backgroundPane.setPreferredSize(new Dimension(500, 65)); |
||||||
|
|
||||||
|
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_Common_Attribute")); |
||||||
|
backgroundPane.setBorder(titledBorder); |
||||||
|
|
||||||
|
UILabel colorSelectLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Widget_Background"), UILabel.RIGHT); |
||||||
|
colorSelectLabel.setPreferredSize(new Dimension(65, 20)); |
||||||
|
|
||||||
|
colorSelectBox = new NewColorSelectBox(152); |
||||||
|
colorSelectBox.addSelectChangeListener(new ChangeListener() { |
||||||
|
@Override |
||||||
|
public void stateChanged(ChangeEvent e) { |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
backgroundPane.add(colorSelectLabel); |
||||||
|
backgroundPane.add(colorSelectBox); |
||||||
|
|
||||||
|
this.add(backgroundPane, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
private void createCustomPane() { |
||||||
|
JPanel configPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Set")); |
||||||
|
configPane.setBorder(titledBorder); |
||||||
|
|
||||||
|
configPane.add(this.customBeanPane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
this.add(configPane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
private TitledBorder createTitledBorder(String title) { |
||||||
|
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(title, titleColor); |
||||||
|
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12)); |
||||||
|
return titledBorder; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,136 @@ |
|||||||
|
package com.fr.design.mainframe.mobile.ui; |
||||||
|
|
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.fun.MobileWidgetStyleProvider; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.form.ui.container.WScaleLayout; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
import com.fr.form.ui.widget.CRBoundsWidget; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public class MobileStylePane extends BasicPane { |
||||||
|
|
||||||
|
private Widget widget; |
||||||
|
private DefaultListModel<String> listModel; |
||||||
|
private JPanel right; |
||||||
|
private CardLayout card; |
||||||
|
private JList styleList; |
||||||
|
private Map<String, BasicBeanPane<MobileStyle>> map = new HashMap<>(); |
||||||
|
|
||||||
|
public MobileStylePane(Widget widget) { |
||||||
|
if(widget instanceof WScaleLayout) { |
||||||
|
this.widget = ((CRBoundsWidget)((WScaleLayout) widget).getBoundsWidget()).getWidget(); |
||||||
|
} else { |
||||||
|
this.widget = widget; |
||||||
|
} |
||||||
|
init(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(MobileStyle mobileStyle) { |
||||||
|
if(mobileStyle != null) { |
||||||
|
MobileWidgetStyleProvider[] styleProviders = getMobileWidgetStyleProviders(); |
||||||
|
for(int i = 0; i < styleProviders.length; i ++) { |
||||||
|
if(mobileStyle.getClass() == styleProviders[i].classForMobileStyle()) { |
||||||
|
String displayName = styleProviders[i].displayName(); |
||||||
|
styleList.setSelectedIndex(i); |
||||||
|
map.get(displayName).populateBean(mobileStyle); |
||||||
|
card.show(right, displayName); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
styleList.setSelectedIndex(0); |
||||||
|
} |
||||||
|
|
||||||
|
public MobileStyle update() { |
||||||
|
return map.get(styleList.getSelectedValue()).updateBean(); |
||||||
|
} |
||||||
|
|
||||||
|
private void init() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
listModel = new DefaultListModel<>(); |
||||||
|
card = new CardLayout(); |
||||||
|
right = FRGUIPaneFactory.createCardLayout_S_Pane(); |
||||||
|
right.setLayout(card); |
||||||
|
MobileWidgetStyleProvider[] styleProviders = getMobileWidgetStyleProviders(); |
||||||
|
for(MobileWidgetStyleProvider styleProvider: styleProviders) { |
||||||
|
this.addProvider2View(styleProvider); |
||||||
|
} |
||||||
|
this.addWestList(); |
||||||
|
this.addCenterConfig(); |
||||||
|
} |
||||||
|
|
||||||
|
private void addWestList() { |
||||||
|
styleList = new JList<>(listModel); |
||||||
|
styleList.setCellRenderer(render); |
||||||
|
styleList.addMouseListener(new MouseAdapter() { |
||||||
|
public void mouseClicked(MouseEvent e) { |
||||||
|
String selectedValue = (String)styleList.getSelectedValue(); |
||||||
|
card.show(right, selectedValue); |
||||||
|
} |
||||||
|
}); |
||||||
|
JPanel westPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
westPane.add(styleList, BorderLayout.CENTER); |
||||||
|
westPane.setPreferredSize(new Dimension(100, 500)); |
||||||
|
this.add(westPane, BorderLayout.WEST); |
||||||
|
} |
||||||
|
|
||||||
|
private void addCenterConfig() { |
||||||
|
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
centerPane.setPreferredSize(new Dimension(500, 500)); |
||||||
|
attrConfPane.add(right, BorderLayout.CENTER); |
||||||
|
centerPane.add(attrConfPane, BorderLayout.CENTER); |
||||||
|
this.add(centerPane, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
private void addProvider2View(MobileWidgetStyleProvider styleProvider) { |
||||||
|
String displayName = styleProvider.displayName(); |
||||||
|
Class<? extends MobileStyleCustomDefinePane> appearanceClazz = styleProvider.classForWidgetAppearance(); |
||||||
|
Class<? extends MobileStyle> mobileStyleClazz = styleProvider.classForMobileStyle(); |
||||||
|
|
||||||
|
listModel.addElement(displayName); |
||||||
|
try { |
||||||
|
BasicBeanPane<MobileStyle> mobileStyleBasicBeanPane = new MobileStyleDefinePane(widget, appearanceClazz, mobileStyleClazz); |
||||||
|
right.add(displayName, mobileStyleBasicBeanPane); |
||||||
|
map.put(displayName, mobileStyleBasicBeanPane); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static ListCellRenderer render = new DefaultListCellRenderer() { |
||||||
|
@Override |
||||||
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
|
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||||
|
if (value instanceof MobileStyle) { |
||||||
|
MobileStyle l = (MobileStyle) value; |
||||||
|
this.setText(l.toString()); |
||||||
|
} |
||||||
|
return this; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
private MobileWidgetStyleProvider[] getMobileWidgetStyleProviders() { |
||||||
|
DefaultMobileWidgetStyleProvider defaultMobileWidgetStyleProvider = new DefaultMobileWidgetStyleProvider(); |
||||||
|
MobileWidgetStyleProvider[] styleProviders = ExtraDesignClassManager.getInstance().getMobileStyleOfWidget(widget.getXType()); |
||||||
|
styleProviders = ArrayUtils.insert(0, styleProviders, defaultMobileWidgetStyleProvider); |
||||||
|
return styleProviders; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
|
import com.fr.design.dialog.BasicDialog; |
||||||
|
import com.fr.design.dialog.DialogActionAdapter; |
||||||
|
import com.fr.design.mainframe.mobile.ui.MobileStylePane; |
||||||
|
import com.fr.design.mainframe.widget.wrappers.MobileStyleWrapper; |
||||||
|
import com.fr.form.ui.mobile.MobileStyle; |
||||||
|
|
||||||
|
import javax.swing.SwingUtilities; |
||||||
|
import java.awt.Dimension; |
||||||
|
|
||||||
|
public class AccessibleMobileStyleEditor extends UneditableAccessibleEditor { |
||||||
|
|
||||||
|
private MobileStylePane stylePane; |
||||||
|
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); |
||||||
|
|
||||||
|
public AccessibleMobileStyleEditor(MobileStylePane stylePane) { |
||||||
|
super(new MobileStyleWrapper()); |
||||||
|
this.stylePane = stylePane; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void showEditorPane() { |
||||||
|
stylePane.setPreferredSize(DEFAULT_DIMENSION); |
||||||
|
BasicDialog dlg = stylePane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||||
|
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||||
|
@Override |
||||||
|
public void doOk() { |
||||||
|
setValue(stylePane.update()); |
||||||
|
fireStateChanged(); |
||||||
|
} |
||||||
|
}); |
||||||
|
stylePane.populate((MobileStyle) getValue()); |
||||||
|
dlg.setVisible(true); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.fr.design.mainframe.widget.wrappers; |
||||||
|
|
||||||
|
import com.fr.design.Exception.ValidationException; |
||||||
|
import com.fr.design.designer.properties.Decoder; |
||||||
|
import com.fr.design.designer.properties.Encoder; |
||||||
|
import com.fr.locale.InterProviderFactory; |
||||||
|
|
||||||
|
public class MobileStyleWrapper implements Encoder, Decoder { |
||||||
|
@Override |
||||||
|
public Object decode(String txt) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void validate(String txt) throws ValidationException { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String encode(Object v) { |
||||||
|
if (v == null) { |
||||||
|
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT"); |
||||||
|
} |
||||||
|
return v.toString(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,116 @@ |
|||||||
|
package com.fr.design.chart; |
||||||
|
|
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.xml.XMLPrintWriter; |
||||||
|
import com.fr.stable.xml.XMLable; |
||||||
|
import com.fr.stable.xml.XMLableReader; |
||||||
|
|
||||||
|
import javax.swing.Icon; |
||||||
|
import java.awt.Color; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.Graphics; |
||||||
|
import java.awt.Graphics2D; |
||||||
|
import java.awt.Paint; |
||||||
|
import java.awt.image.BufferedImage; |
||||||
|
|
||||||
|
/** |
||||||
|
* 图表的缩略图Icon, 在选择图表类型界面 用到. |
||||||
|
*/ |
||||||
|
public class ChartIcon implements Icon, XMLable { |
||||||
|
private static final int WIDTH = 400; |
||||||
|
private static final int HEIGHT = 225; |
||||||
|
/** |
||||||
|
* 缩略图中的图片路径 |
||||||
|
*/ |
||||||
|
private String imagePath; |
||||||
|
|
||||||
|
private String chartName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 构造Chart的缩略图Icon |
||||||
|
*/ |
||||||
|
public ChartIcon(String imagePath, String chartName) { |
||||||
|
this.imagePath = imagePath; |
||||||
|
this.chartName = chartName; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 画出缩略图Icon |
||||||
|
* |
||||||
|
* @param g 图形的上下文 |
||||||
|
* @param c 所在的Component |
||||||
|
* @param x 缩略图的起始坐标x |
||||||
|
* @param y 缩略图的起始坐标y |
||||||
|
*/ |
||||||
|
public void paintIcon(Component c, Graphics g, int x, int y) { |
||||||
|
|
||||||
|
Graphics2D g2d = (Graphics2D) g; |
||||||
|
|
||||||
|
Paint oldPaint = g2d.getPaint(); |
||||||
|
|
||||||
|
g.translate(x, y); |
||||||
|
g2d.setPaint(Color.white); |
||||||
|
|
||||||
|
g2d.fillRect(0, 0, getIconWidth(), getIconHeight()); |
||||||
|
BufferedImage demoImage = IOUtils.readImageWithCache(imagePath); |
||||||
|
GraphHelper.paintImage(g, getIconWidth(), getIconHeight(), demoImage, Constants.IMAGE_ADJUST, Constants.NULL, Constants.NULL, -1, -1); |
||||||
|
|
||||||
|
g.translate(-x, -y); |
||||||
|
g2d.setPaint(oldPaint); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回缩略图的宽度 |
||||||
|
* |
||||||
|
* @return int 缩略图宽度 |
||||||
|
*/ |
||||||
|
public int getIconWidth() { |
||||||
|
return WIDTH; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回缩略图的高度 |
||||||
|
* |
||||||
|
* @return int 缩略图高度 |
||||||
|
*/ |
||||||
|
public int getIconHeight() { |
||||||
|
return HEIGHT; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 返回缩略图中的图片路径 |
||||||
|
* |
||||||
|
* @return 缩略图中的图片路径 |
||||||
|
*/ |
||||||
|
public String getImagePath() { |
||||||
|
return imagePath; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChartName() { |
||||||
|
return chartName; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void readXML(XMLableReader reader) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void writeXML(XMLPrintWriter writer) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return 克隆后的对象 |
||||||
|
* @throws CloneNotSupportedException 如果克隆失败则抛出此异常 |
||||||
|
*/ |
||||||
|
public Object clone() throws CloneNotSupportedException { |
||||||
|
ChartIcon cloned = (ChartIcon) super.clone(); |
||||||
|
cloned.imagePath = this.imagePath; |
||||||
|
cloned.chartName = this.chartName; |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,97 +0,0 @@ |
|||||||
package com.fr.design.chart.gui; |
|
||||||
|
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.CategoryAxisGlyph; |
|
||||||
import com.fr.chart.chartglyph.ChartAlertValueGlyph; |
|
||||||
import com.fr.chart.chartglyph.ChartGlyph; |
|
||||||
import com.fr.chart.chartglyph.DataSeries; |
|
||||||
import com.fr.chart.chartglyph.DataSheetGlyph; |
|
||||||
import com.fr.chart.chartglyph.DateAxisGlyph; |
|
||||||
import com.fr.chart.chartglyph.LegendGlyph; |
|
||||||
import com.fr.chart.chartglyph.PlotGlyph; |
|
||||||
import com.fr.chart.chartglyph.RadarAxisGlyph; |
|
||||||
import com.fr.chart.chartglyph.RangeAxisGlyph; |
|
||||||
import com.fr.chart.chartglyph.TextGlyph; |
|
||||||
import com.fr.chart.chartglyph.TitleGlyph; |
|
||||||
import com.fr.chart.chartglyph.TrendLineGlyph; |
|
||||||
import com.fr.chart.chartglyph.ValueAxisGlyph; |
|
||||||
import com.fr.design.chart.gui.active.ActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.AlertValueActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.CategoryAxisActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.ChartActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.DataLabelActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.DataSeriesActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.DataSheetActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.DateAxisActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.LegendActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.PlotActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.RadarAxisActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.RangeAxisActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.TextActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.TrendLineActiveGlyph; |
|
||||||
import com.fr.design.chart.gui.active.ValueAxisActiveGlyph; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-23 |
|
||||||
* Time : 上午9:08 |
|
||||||
*/ |
|
||||||
public class ActiveGlyphFactory { |
|
||||||
private static Map<String, Class> glyphMap = new HashMap<String, Class>(); |
|
||||||
|
|
||||||
static { |
|
||||||
glyphMap.put(DataSeries.class.getName(), DataSeriesActiveGlyph.class); |
|
||||||
glyphMap.put(RadarAxisGlyph.class.getName(), RadarAxisActiveGlyph.class); |
|
||||||
glyphMap.put(RangeAxisGlyph.class.getName(), RangeAxisActiveGlyph.class); |
|
||||||
glyphMap.put(TitleGlyph.class.getName(), TextActiveGlyph.class); |
|
||||||
glyphMap.put(DateAxisGlyph.class.getName(), DateAxisActiveGlyph.class); |
|
||||||
glyphMap.put(ValueAxisGlyph.class.getName(), ValueAxisActiveGlyph.class); |
|
||||||
glyphMap.put(CategoryAxisGlyph.class.getName(), CategoryAxisActiveGlyph.class); |
|
||||||
glyphMap.put(ChartGlyph.class.getName(), ChartActiveGlyph.class); |
|
||||||
glyphMap.put(DataSheetGlyph.class.getName(), DataSheetActiveGlyph.class); |
|
||||||
glyphMap.put(LegendGlyph.class.getName(), LegendActiveGlyph.class); |
|
||||||
glyphMap.put(TextGlyph.class.getName(), DataLabelActiveGlyph.class); |
|
||||||
glyphMap.put(TrendLineGlyph.class.getName(), TrendLineActiveGlyph.class); |
|
||||||
glyphMap.put(ChartAlertValueGlyph.class.getName(), AlertValueActiveGlyph.class); |
|
||||||
} |
|
||||||
|
|
||||||
private ActiveGlyphFactory() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph) { |
|
||||||
return createActiveGlyph(chartComponent, glyph, null); |
|
||||||
} |
|
||||||
|
|
||||||
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph, Glyph parentGlyph) { |
|
||||||
if (glyph == null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
String clsName = glyph.getClass().getName(); |
|
||||||
Class cls = glyphMap.get(clsName); |
|
||||||
Class parameterCls = glyph.getClass(); |
|
||||||
if (cls == null) { |
|
||||||
if (clsName.endsWith("PlotGlyph")) { |
|
||||||
cls = PlotActiveGlyph.class; |
|
||||||
parameterCls = PlotGlyph.class; |
|
||||||
} else if (clsName.endsWith("DataSeries4Area")) { |
|
||||||
cls = DataSeriesActiveGlyph.class; |
|
||||||
parameterCls = DataSeries.class; |
|
||||||
} else { |
|
||||||
cls = ChartActiveGlyph.class; |
|
||||||
parameterCls = ChartGlyph.class; |
|
||||||
} |
|
||||||
} |
|
||||||
try { |
|
||||||
Class[] argsClass = new Class[]{ChartComponent.class, parameterCls, Glyph.class}; |
|
||||||
return (ActiveGlyph) cls.getConstructor(argsClass).newInstance(new Object[]{chartComponent, glyph, parentGlyph}); |
|
||||||
} catch (Exception e) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,161 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import java.awt.AlphaComposite; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.Composite; |
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.Paint; |
|
||||||
import java.awt.Shape; |
|
||||||
import java.awt.event.MouseEvent; |
|
||||||
import java.awt.geom.Point2D; |
|
||||||
|
|
||||||
import com.fr.base.ScreenResolution; |
|
||||||
import com.fr.base.chart.BaseChartGlyph; |
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.design.chart.gui.ActiveGlyphFactory; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午3:51 |
|
||||||
* 选中的Glyph |
|
||||||
*/ |
|
||||||
public abstract class ActiveGlyph { |
|
||||||
protected Glyph parentGlyph; |
|
||||||
protected ChartComponent chartComponent; |
|
||||||
|
|
||||||
public ActiveGlyph(ChartComponent chartComponent, Glyph parentGlyph) { |
|
||||||
this.chartComponent = chartComponent; |
|
||||||
this.parentGlyph = parentGlyph; |
|
||||||
} |
|
||||||
|
|
||||||
public abstract Glyph getGlyph(); |
|
||||||
|
|
||||||
public void drawAllGlyph(Graphics2D g2d, int resolution){ |
|
||||||
Point2D offset4Paint = offset4Paint(); |
|
||||||
g2d.translate(offset4Paint.getX(), offset4Paint.getY()); |
|
||||||
this.getGlyph().draw(g2d, resolution); |
|
||||||
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); |
|
||||||
}; |
|
||||||
|
|
||||||
/** |
|
||||||
* 属性表中, 通过点击 展开到对应的界面. |
|
||||||
*/ |
|
||||||
public abstract void goRightPane(); |
|
||||||
|
|
||||||
/** |
|
||||||
* 画的偏移的 |
|
||||||
* @return 偏移的 |
|
||||||
*/ |
|
||||||
public Point2D offset4Paint() { |
|
||||||
return new Point2D.Double( |
|
||||||
this.parentGlyph.getShape().getBounds().getX(), |
|
||||||
this.parentGlyph.getShape().getBounds().getY() |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
public void paint4ActiveGlyph(Graphics2D g2d, BaseChartGlyph chartGlyph) { |
|
||||||
if(this.parentGlyph == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
Paint oldPaint = g2d.getPaint(); |
|
||||||
Composite oldComposite = g2d.getComposite(); |
|
||||||
g2d.setPaint(Color.WHITE); |
|
||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); |
|
||||||
|
|
||||||
g2d.fill(chartGlyph.getShape()); |
|
||||||
drawAllGlyph(g2d, ScreenResolution.getScreenResolution()); |
|
||||||
|
|
||||||
g2d.setPaint(oldPaint); |
|
||||||
g2d.setComposite(oldComposite); |
|
||||||
} |
|
||||||
|
|
||||||
protected void drawSelectedBounds4Active(Graphics2D g2d) { |
|
||||||
if (this.getGlyph() != null) { |
|
||||||
Shape shape = this.getGlyph().getShape(); |
|
||||||
if (shape != null) { |
|
||||||
g2d.draw(shape); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
*当前的ActiveGlyph是否包含坐标mouseX, mouseY |
|
||||||
* @param mouseX 坐标X |
|
||||||
* @param mouseY 坐标Y |
|
||||||
* @return 包含则返回true |
|
||||||
*/ |
|
||||||
public boolean contains(int mouseX, int mouseY) { |
|
||||||
if (getGlyph() == null || getGlyph().getShape() == null){ |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
Point2D offset = this.offset4Paint(); |
|
||||||
|
|
||||||
/* |
|
||||||
* alex:因为Line2D.contains(x, y)必然返回false |
|
||||||
* 所以用intersect一个区域,这个区域大小用4 * 4的,区域大一些,就灵敏一些 |
|
||||||
*/ |
|
||||||
return getGlyph().getShape().intersects(mouseX - offset.getX() - 2, mouseY - offset.getY() - 2, 4, 4); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 在当前选中的ActiveGlyph中,仅仅在其Children中找与mouseX, mouseY匹配的ActiveGlyph |
|
||||||
* @param mouseX 坐标X |
|
||||||
* @param mouseY 坐标Y |
|
||||||
* @return 当前ativeGlyph |
|
||||||
*/ |
|
||||||
public ActiveGlyph findActionGlyphFromChildren(int mouseX, int mouseY) { |
|
||||||
Glyph currentGlyph = getGlyph(); |
|
||||||
// 报错应对.
|
|
||||||
if (currentGlyph == null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
java.util.Iterator selectableChildren = currentGlyph.selectableChildren(); |
|
||||||
|
|
||||||
ActiveGlyph resAG = null; |
|
||||||
while (selectableChildren.hasNext() && resAG == null) { |
|
||||||
ActiveGlyph childActiveGlyph = ActiveGlyphFactory.createActiveGlyph(chartComponent, selectableChildren.next(), currentGlyph); |
|
||||||
|
|
||||||
// 如果childActiveGlyph不为null,找一下其子辈有没有符合条件
|
|
||||||
if (childActiveGlyph != null) { |
|
||||||
resAG = childActiveGlyph.findActionGlyphFromChildren(mouseX, mouseY); |
|
||||||
} |
|
||||||
|
|
||||||
// 如果childActiveGlyph的子辈没有符合条件的,就看一下这个childGlyph是否符合条件
|
|
||||||
if (resAG == null && childActiveGlyph != null && childActiveGlyph.contains(mouseX, mouseY)) { |
|
||||||
resAG = childActiveGlyph; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// 如果当前ActiveGlyph的所有子辈都没有与mouseX, mouseY相匹配的,看一下它自己是否匹配
|
|
||||||
if (resAG == null) { |
|
||||||
if (this.contains(mouseX, mouseY)) { |
|
||||||
resAG = this; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return resAG; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 拖拽 |
|
||||||
* @param e 事件 |
|
||||||
*/ |
|
||||||
public void onMouseDragged(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 移动事件 |
|
||||||
* @param e 事件 |
|
||||||
*/ |
|
||||||
public void onMouseMove(MouseEvent e) { |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -1,38 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import java.awt.geom.Point2D; |
|
||||||
import java.awt.geom.Rectangle2D; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.ChartAlertValueGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction; |
|
||||||
|
|
||||||
public class AlertValueActiveGlyph extends ActiveGlyph{ |
|
||||||
ChartAlertValueGlyph alertValueGlyph; |
|
||||||
|
|
||||||
public AlertValueActiveGlyph(ChartComponent chartComponent,ChartAlertValueGlyph alertLine, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.alertValueGlyph = alertLine; |
|
||||||
} |
|
||||||
|
|
||||||
public Point2D offset4Paint() { |
|
||||||
Rectangle2D valueAxisBoudns = this.alertValueGlyph.getValueAxisGlyph().getBounds(); |
|
||||||
|
|
||||||
return new Point2D.Double( |
|
||||||
this.parentGlyph.getShape().getBounds().getX() + valueAxisBoudns.getX(), |
|
||||||
this.parentGlyph.getShape().getBounds().getY() + valueAxisBoudns.getY() |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.alertValueGlyph; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void goRightPane() { |
|
||||||
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,43 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.geom.Point2D; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.AxisGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.chart.gui.active.action.SetAxisStyleAction; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午4:00 |
|
||||||
*/ |
|
||||||
public abstract class AxisActiveGlyph extends ActiveGlyph { |
|
||||||
protected AxisGlyph axis; |
|
||||||
|
|
||||||
public AxisActiveGlyph(ChartComponent chartComponent, AxisGlyph axis, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.axis = axis; |
|
||||||
} |
|
||||||
|
|
||||||
public void drawAllGlyph(Graphics2D g2d, int resolution){ |
|
||||||
Point2D offset4Paint = offset4Paint(); |
|
||||||
g2d.translate(offset4Paint.getX(), offset4Paint.getY()); |
|
||||||
this.axis.drawWithOutAlert(g2d, resolution); |
|
||||||
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); |
|
||||||
}; |
|
||||||
|
|
||||||
public void goRightPane() { |
|
||||||
new SetAxisStyleAction(chartComponent).showAxisStylePane(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 返回 对应的属性Axis |
|
||||||
*/ |
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.axis; |
|
||||||
} |
|
||||||
} |
|
@ -1,19 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.CategoryAxisGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午4:01 |
|
||||||
*/ |
|
||||||
public class CategoryAxisActiveGlyph extends AxisActiveGlyph { |
|
||||||
|
|
||||||
public CategoryAxisActiveGlyph(ChartComponent chartComponent, CategoryAxisGlyph axis, Glyph parentGlyph) { |
|
||||||
super(chartComponent, axis, parentGlyph); |
|
||||||
} |
|
||||||
} |
|
@ -1,39 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import java.awt.geom.Point2D; |
|
||||||
|
|
||||||
import com.fr.base.chart.BaseChartGlyph; |
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.chart.gui.active.action.SetChartStyleAciton; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午3:54 |
|
||||||
*/ |
|
||||||
public class ChartActiveGlyph extends ActiveGlyph { |
|
||||||
private BaseChartGlyph glyphChart; |
|
||||||
|
|
||||||
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart) { |
|
||||||
this(chartComponent, chart, null); |
|
||||||
} |
|
||||||
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.glyphChart = chart; |
|
||||||
} |
|
||||||
|
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.glyphChart; |
|
||||||
} |
|
||||||
|
|
||||||
public Point2D offset4Paint() { |
|
||||||
return new java.awt.Point(0, 0); |
|
||||||
} |
|
||||||
|
|
||||||
public void goRightPane() { |
|
||||||
new SetChartStyleAciton(chartComponent).showChartStylePane(); |
|
||||||
} |
|
||||||
} |
|
@ -1,44 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.geom.Point2D; |
|
||||||
import java.util.ArrayList; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.PlotGlyph; |
|
||||||
import com.fr.chart.chartglyph.TextGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.chart.gui.active.action.SetDataLabelStyleAction; |
|
||||||
|
|
||||||
public class DataLabelActiveGlyph extends ActiveGlyph{ |
|
||||||
private TextGlyph dataLabel; |
|
||||||
|
|
||||||
public DataLabelActiveGlyph(ChartComponent chartComponent, TextGlyph dataLabel, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.dataLabel = dataLabel; |
|
||||||
} |
|
||||||
|
|
||||||
public void drawAllGlyph(Graphics2D g2d, int resolution){ |
|
||||||
Point2D offset4Paint = offset4Paint(); |
|
||||||
g2d.translate(offset4Paint.getX(), offset4Paint.getY()); |
|
||||||
|
|
||||||
ArrayList<TextGlyph> allDataPointLableGlyph = new ArrayList<TextGlyph>(); |
|
||||||
PlotGlyph plotGlyph = (PlotGlyph)(this.parentGlyph); |
|
||||||
plotGlyph.getAllDataPointGlyph(allDataPointLableGlyph); |
|
||||||
for(int index = 0; index < allDataPointLableGlyph.size(); index++){ |
|
||||||
allDataPointLableGlyph.get(index).draw(g2d, resolution); |
|
||||||
} |
|
||||||
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); |
|
||||||
}; |
|
||||||
|
|
||||||
@Override |
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.dataLabel; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void goRightPane() { |
|
||||||
new SetDataLabelStyleAction(chartComponent).showDataLabelStylePane(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,53 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import java.awt.Graphics2D; |
|
||||||
import java.awt.geom.Point2D; |
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.DataSeries; |
|
||||||
import com.fr.chart.chartglyph.PlotGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.mainframe.chart.PaneTitleConstants; |
|
||||||
import com.fr.design.module.DesignModuleFactory; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午3:59 |
|
||||||
*/ |
|
||||||
public class DataSeriesActiveGlyph extends ActiveGlyph { |
|
||||||
private DataSeries series; |
|
||||||
|
|
||||||
public DataSeriesActiveGlyph(ChartComponent chartComponent, DataSeries series, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.series = series; |
|
||||||
} |
|
||||||
|
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.series; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 界面条状 |
|
||||||
*/ |
|
||||||
public void goRightPane() { |
|
||||||
if(chartComponent.getEditingChart() == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void drawAllGlyph(Graphics2D g2d, int resolution) { |
|
||||||
Point2D offset4Paint = offset4Paint(); |
|
||||||
g2d.translate(offset4Paint.getX(), offset4Paint.getY()); |
|
||||||
if(this.parentGlyph != null && this.parentGlyph instanceof PlotGlyph){ |
|
||||||
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph; |
|
||||||
plotGlyph.drawShape4Series(g2d, resolution); |
|
||||||
} |
|
||||||
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,30 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.DataSheetGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.chart.gui.active.action.SetDataSheetAction; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午3:57 |
|
||||||
*/ |
|
||||||
public class DataSheetActiveGlyph extends ActiveGlyph { |
|
||||||
private DataSheetGlyph dataSheetGlyph; |
|
||||||
|
|
||||||
public DataSheetActiveGlyph(ChartComponent chartComponent, DataSheetGlyph dataSheetGlyph, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.dataSheetGlyph = dataSheetGlyph; |
|
||||||
} |
|
||||||
|
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.dataSheetGlyph; |
|
||||||
} |
|
||||||
|
|
||||||
public void goRightPane() { |
|
||||||
new SetDataSheetAction(chartComponent).showDataSheetStylePane(); |
|
||||||
} |
|
||||||
} |
|
@ -1,18 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.DateAxisGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午4:03 |
|
||||||
*/ |
|
||||||
public class DateAxisActiveGlyph extends AxisActiveGlyph { |
|
||||||
public DateAxisActiveGlyph(ChartComponent chartComponent, DateAxisGlyph axis, Glyph parentGlyph) { |
|
||||||
super(chartComponent, axis, parentGlyph); |
|
||||||
} |
|
||||||
} |
|
@ -1,30 +0,0 @@ |
|||||||
package com.fr.design.chart.gui.active; |
|
||||||
|
|
||||||
import com.fr.base.chart.Glyph; |
|
||||||
import com.fr.chart.chartglyph.LegendGlyph; |
|
||||||
import com.fr.design.chart.gui.ChartComponent; |
|
||||||
import com.fr.design.chart.gui.active.action.SetLegendStyleAction; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by IntelliJ IDEA. |
|
||||||
* Author : Richer |
|
||||||
* Version: 6.5.6 |
|
||||||
* Date : 11-11-22 |
|
||||||
* Time : 下午3:58 |
|
||||||
*/ |
|
||||||
public class LegendActiveGlyph extends ActiveGlyph { |
|
||||||
private LegendGlyph legendGlyph; |
|
||||||
|
|
||||||
public LegendActiveGlyph(ChartComponent chartComponent, LegendGlyph legendGlyph, Glyph parentGlyph) { |
|
||||||
super(chartComponent, parentGlyph); |
|
||||||
this.legendGlyph = legendGlyph; |
|
||||||
} |
|
||||||
|
|
||||||
public Glyph getGlyph() { |
|
||||||
return this.legendGlyph; |
|
||||||
} |
|
||||||
|
|
||||||
public void goRightPane() { |
|
||||||
new SetLegendStyleAction(chartComponent).showLegendStylePane(); |
|
||||||
} |
|
||||||
} |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue