Browse Source

update

master
xiaohu 9 years ago
parent
commit
ef30f9e9d8
  1. 46
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  2. 63
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java

46
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -25,28 +25,31 @@ import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.Authorize;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.stable.plugin.PluginReadListener;
import com.fr.stable.plugin.PluginSimplify;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.util.*;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Created by eason on 14/12/29.
*/
public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider {
private static ClassLoader loader = Thread.currentThread().getContextClassLoader();
private static ChartTypeInterfaceManager classManager = null;
private static LinkedHashMap<String, IndependentChartUIProvider> chartTypeInterfaces = new LinkedHashMap<String, IndependentChartUIProvider>();
private static List<String> chartOrderList = new ArrayList<String>();
public synchronized static ChartTypeInterfaceManager getInstance() {
if (classManager == null) {
classManager = new ChartTypeInterfaceManager();
chartTypeInterfaces.clear();
classManager.readDefault();
classManager.readXMLFile();
}
return classManager;
@ -60,11 +63,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
});
}
static {
GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override
public void success() {
if (chartTypeInterfaces != null) {
readDefault();
}
}
});
}
private synchronized static void envChanged() {
classManager = null;
}
private static void readDefault() {
chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface());
chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface());
@ -83,15 +98,15 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface());
chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface());
for (String plotID :chartTypeInterfaces.keySet()){
if (!chartOrderList.contains(plotID)){
chartOrderList.add(plotID);
}
}
}
public String getIconPath(String plotID) {
return chartTypeInterfaces.get(plotID).getIconPath();
if (chartTypeInterfaces.get(plotID) != null) {
return chartTypeInterfaces.get(plotID).getIconPath();
}else {
return StringUtils.EMPTY;
}
}
/**
@ -113,10 +128,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
PluginMessage.remindUpdate(className);
} else if (!chartTypeInterfaces.containsKey(plotID)) {
chartTypeInterfaces.put(plotID, provider);
//新图表类型插入到前面
if (!chartOrderList.contains(plotID)) {
chartOrderList.add(0, plotID);
}
}
} catch (ClassNotFoundException e) {
FRLogger.getLogger().error("class not found:" + e.getMessage());
@ -137,11 +148,14 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
* @param paneList pane容器
*/
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList) {
for (int i = 0; i < chartOrderList.size(); i++){
String plotID = chartOrderList.get(i);
IndependentChartUIProvider creator = chartTypeInterfaces.get(plotID);
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue();
paneList.add(creator.getPlotTypePane());
}
}
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {

63
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java

@ -0,0 +1,63 @@
package com.fr.design.designer.creator.cardlayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
/**
* Created by Fangjie on 2016/6/30.
*/
public class XWCoverCardLayout extends XWCardMainBorderLayout{
private boolean mouseEnter;
public boolean isMouseEnter() {
return mouseEnter;
}
public void setMouseEnter(boolean mouseEnter) {
this.mouseEnter = mouseEnter;
}
/**
* 构造函数
*
* @param border
* @param dimension
*/
public XWCoverCardLayout(WCardMainBorderLayout border, Dimension dimension) {
super(border, dimension);
}
public void paint(Graphics g) {
super.paint(g);
if (mouseEnter) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
Paint old_paint = g2d.getPaint();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
g2d.setColor(Color.YELLOW);
int x = 1;
int y = 1;
int w = getWidth();
int h = getHeight();
g2d.fillRect(x, y, w, h);
g2d.setColor(Color.BLACK);
g2d.drawRect(getX(), getY(), getWidth(), getHeight());
g2d.setComposite(oldComposite);
g2d.setPaint(old_paint);
}
}
}
Loading…
Cancel
Save