diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index 7a4f24ea68..09b03c1837 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.designer.EditingState; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; @@ -11,6 +12,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.Inter; import com.fr.grid.Grid; import com.fr.main.impl.WorkBook; +import com.fr.poly.PolyDesigner; import com.fr.report.report.TemplateReport; import javax.swing.*; @@ -45,9 +47,6 @@ public class ReportComponentComposite extends JComponent { private JSliderPane jSliderContainer; - private boolean isCtrl = false; - - /** * Constructor with workbook.. */ @@ -66,29 +65,10 @@ public class ReportComponentComposite extends JComponent { jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); } - KeyListener showValSpinnerKeyListener = new KeyListener() { - @Override - public void keyTyped(KeyEvent e) { - - } - - @Override - public void keyPressed(KeyEvent e) { - if (e.isControlDown()) { - isCtrl = true; - } - } - - @Override - public void keyReleased(KeyEvent e) { - isCtrl = false; - } - }; - MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isCtrl) { + if (InputEventBaseOnOS.isControlDown(e)) { int dir = e.getWheelRotation(); int old_resolution = (int) jSliderContainer.getShowVal().getValue(); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); @@ -149,12 +129,12 @@ public class ReportComponentComposite extends JComponent { } if (centerCardPane.editingComponet.elementCasePane == null) { + centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener); return; } Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid(); this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); - this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener); if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { grid.requestFocus(); diff --git a/designer/src/com/fr/design/mainframe/ReportFloatPane.java b/designer/src/com/fr/design/mainframe/ReportFloatPane.java index b7fead91aa..9f579f4f96 100644 --- a/designer/src/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer/src/com/fr/design/mainframe/ReportFloatPane.java @@ -62,7 +62,7 @@ public class ReportFloatPane extends JPanel { new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane}, }; JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 15)); + leftTopPane.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 15)); this.add(leftTopPane, BorderLayout.NORTH); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 6b1113f358..83945d324e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -16,15 +16,13 @@ import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.model.SearchResult; -import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane; -import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; -import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; -import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane; +import com.fr.design.mainframe.alphafine.preview.*; import com.fr.design.mainframe.alphafine.search.manager.*; import com.fr.form.main.Form; import com.fr.form.main.FormIO; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.http.HttpClient; import com.fr.io.TemplateWorkBookIO; @@ -75,6 +73,7 @@ public class AlphaFineDialog extends UIDialog { private JPanel searchResultPane; private Point pressedPoint; private UIScrollPane leftSearchResultPane; + private JPanel defaultPane; private JPanel rightSearchResultPane; private AlphaFineList searchResultList; private SearchListModel searchListModel; @@ -299,15 +298,10 @@ public class AlphaFineDialog extends UIDialog { leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane = new JPanel(); rightSearchResultPane.setBackground(Color.WHITE); - UILabel splitLine = new UILabel(); - splitLine.setBackground(AlphaFineConstants.GRAY); - splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); - searchResultPane.add(splitLine, BorderLayout.CENTER); searchResultPane.add(rightSearchResultPane, BorderLayout.EAST); UILabel splitLabel = new UILabel(); - splitLabel.setBackground(AlphaFineConstants.GRAY); splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1)); searchResultPane.add(splitLabel, BorderLayout.NORTH); add(searchResultPane, BorderLayout.SOUTH); @@ -344,6 +338,32 @@ public class AlphaFineDialog extends UIDialog { */ private void fireStopLoading() { searchListModel.resetState(); + replaceLeftPane(); + } + + /** + * 刷新容器 + */ + private void refreshContainer() { + validate(); + repaint(); + revalidate(); + } + + /** + * 重置结果面板 + */ + private void replaceLeftPane() { + if (searchListModel.getSize() == 0 && defaultPane == null) { + defaultPane = new NoResultPane(Inter.getLocText("FR-Designer-AlphaFine_NO_Result"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/no_result.png")); + searchResultPane.remove(leftSearchResultPane); + searchResultPane.add(defaultPane, BorderLayout.WEST); + } else if (searchListModel.getSize() > 0 && defaultPane != null) { + searchResultPane.remove(defaultPane); + defaultPane = null; + searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); + } + refreshContainer(); } /** @@ -534,7 +554,7 @@ public class AlphaFineDialog extends UIDialog { break; case ACTION: rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new ActionPreviewPane()); + rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png"))); validate(); repaint(); break; @@ -625,7 +645,6 @@ public class AlphaFineDialog extends UIDialog { */ private void initGlobalListener() { initAWTEventListener(); - initMouseListener(); } /** @@ -912,6 +931,8 @@ public class AlphaFineDialog extends UIDialog { if (getSelectedIndex() == 1) { searchTextField.requestFocus(); } + } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + searchTextField.requestFocus(); } } }); diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/no_result.png b/designer/src/com/fr/design/mainframe/alphafine/images/no_result.png new file mode 100644 index 0000000000..cd3d803af0 Binary files /dev/null and b/designer/src/com/fr/design/mainframe/alphafine/images/no_result.png differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java deleted file mode 100644 index c7286850f8..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.mainframe.alphafine.preview; - - -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.general.IOUtils; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; - - -/** - * Created by XiaXiang on 2017/5/5. - */ -public class ActionPreviewPane extends JPanel { - private static final Font NAME = new Font("Song_TypeFace", 0, 14); - - public ActionPreviewPane() { - setLayout(new BorderLayout()); - setBackground(null); - setBorder(BorderFactory.createEmptyBorder(135, 0, 0, 0)); - UILabel image = new UILabel(); - image.setPreferredSize(new Dimension(150, 111)); - image.setHorizontalAlignment(SwingConstants.CENTER); - image.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - image.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png")); - UILabel description = new UILabel(Inter.getLocText("FR-Designer_NoResult")); - description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(NAME); - description.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - description.setHorizontalAlignment(SwingConstants.CENTER); - this.add(image, BorderLayout.CENTER); - this.add(description, BorderLayout.SOUTH); - } - -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java new file mode 100644 index 0000000000..67157aee2f --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -0,0 +1,31 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.general.FRFont; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by XiaXiang on 2017/8/14. + */ +public class NoResultPane extends JPanel { + public NoResultPane(String title, Icon icon) { + setLayout(new BorderLayout()); + setBackground(Color.white); + setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + UILabel image = new UILabel(); + image.setPreferredSize(new Dimension(150, 111)); + image.setHorizontalAlignment(SwingConstants.CENTER); + image.setIcon(icon); + image.setBorder(BorderFactory.createEmptyBorder(100,0,0,0)); + UILabel description = new UILabel(title); + description.setForeground(AlphaFineConstants.MEDIUM_GRAY); + description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14)); + description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); + description.setHorizontalAlignment(SwingConstants.CENTER); + add(image, BorderLayout.CENTER); + add(description, BorderLayout.SOUTH); + } +} diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 3756b03aec..14135a2b23 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -74,15 +74,13 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { if (!AlphaFineHelper.getFilterResult().contains(object)) { result.add(object); } - } - if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { + if (result.size() == 0) { + return lessModelList; + } + if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"))); - if (result.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(result); - } + lessModelList.addAll(result); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION)); lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -97,4 +95,4 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { public SearchResult getMoreSearchResult() { return moreModelList; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java index ebabc9aa23..7067dd17c9 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java @@ -76,13 +76,12 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { searchResult.add(cellModel); } } - if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { + if (searchResult.size() == 0) { + return lessModelList; + } + if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"))); - if (searchResult.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(searchResult); - } + lessModelList.addAll(searchResult); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.DOCUMENT)); lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -114,4 +113,4 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { return moreModelList; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java index 21f2b5fc40..d67d434bda 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java @@ -100,13 +100,12 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } - if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { + if (result.size() == 0) { + return lessModelList; + } + if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"))); - if (result.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(result); - } + lessModelList.addAll(result); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE)); lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -248,4 +247,4 @@ public class FileSearchManager implements AlphaFineSearchProcessor { public void setContainFrm(boolean containFrm) { isContainFrm = containFrm; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java index 5855168d7b..04c5074ef3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java @@ -109,13 +109,12 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { searchResult.add(cellModel); } } - if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"))); - if (searchResult.size() == 0) { - lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); - } else { - lessModelList.addAll(searchResult); - } + if (searchResult.size() == 0) { + return this.lessModelList; + } + if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"))); + lessModelList.addAll(searchResult); } else { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN)); lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); @@ -142,4 +141,4 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { public SearchResult getMoreSearchResult() { return this.moreModelList; } -} +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java index f091cbe8aa..a79f64af4e 100644 --- a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.form; import com.fr.base.DynamicUnitList; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -40,7 +41,6 @@ public class FormReportComponentComposite extends JComponent implements TargetMo private FormTabPane sheetNameTab; private JPanel hbarContainer; private JSliderPane jSliderContainer; - private boolean isCtrl = false; public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { this.jForm = jform; @@ -52,33 +52,13 @@ public class FormReportComponentComposite extends JComponent implements TargetMo jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); - this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener); elementCaseDesigner.addTargetModifiedListener(this); } - KeyListener showValSpinnerKeyListener = new KeyListener() { - @Override - public void keyTyped(KeyEvent e) { - - } - - @Override - public void keyPressed(KeyEvent e) { - if (e.isControlDown()) { - isCtrl = true; - } - } - - @Override - public void keyReleased(KeyEvent e) { - isCtrl = false; - } - }; - MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isCtrl) { + if (InputEventBaseOnOS.isControlDown(e)) { int dir = e.getWheelRotation(); int old_resolution = (int) jSliderContainer.getShowVal().getValue(); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); diff --git a/designer/src/com/fr/grid/GridColumn.java b/designer/src/com/fr/grid/GridColumn.java index 165a5727a9..b6644df91d 100644 --- a/designer/src/com/fr/grid/GridColumn.java +++ b/designer/src/com/fr/grid/GridColumn.java @@ -68,11 +68,11 @@ public class GridColumn extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!reportPane.isColumnHeaderVisible()) { return new Dimension(0, 0); } - return new Dimension(super.getPreferredSize().width, GraphHelper.getFontMetrics(this.getFont()).getHeight() + SIZE_ADJUST); + return new Dimension(super.getPreferredSize().width, (int) (GraphHelper.getFontMetrics(this.getFont()).getHeight() * time + SIZE_ADJUST)); } } \ No newline at end of file diff --git a/designer/src/com/fr/grid/GridColumnUI.java b/designer/src/com/fr/grid/GridColumnUI.java index 227de31941..9712821682 100644 --- a/designer/src/com/fr/grid/GridColumnUI.java +++ b/designer/src/com/fr/grid/GridColumnUI.java @@ -48,6 +48,9 @@ public class GridColumnUI extends ComponentUI { Grid gird = reportPane.getGrid(); // size Dimension size = gridColumn.getSize(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + g2d.setFont(gridColumn.getFont().deriveFont(gridColumn.getFont().getSize2D() * time)); + ElementCase elementCase = reportPane.getEditingElementCase(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCase); int horizontalValue = gird.getHorizontalValue(); @@ -77,7 +80,7 @@ public class GridColumnUI extends ComponentUI { g2d.setPaint(gridColumn.getSeparatorLineColor()); GraphHelper.drawLine(g2d, 0, 0, 0, size.getHeight()); double tmpWidth2 = 0; - drawColumn(horizontalBeginValue, horizontalEndValue, columnWidthList, tmpWidth2, reportPane, g2d, gridColumn); + drawColumn(horizontalBeginValue, horizontalEndValue, columnWidthList, tmpWidth2, reportPane, g2d, gridColumn, size); // 画上边的边框线. g2d.setColor(gridColumn.getSeparatorLineColor()); GraphHelper.drawLine(g2d, 0, 0, tmpWidth2, 0); @@ -85,14 +88,13 @@ public class GridColumnUI extends ComponentUI { private void drawColumn(int horizontalBeginValue, int horizontalEndValue, DynamicUnitList columnWidthList, double tmpWidth2, - ElementCasePane reportPane, Graphics2D g2d, GridColumn gridColumn) { + ElementCasePane reportPane, Graphics2D g2d, GridColumn gridColumn, Dimension size) { // draw column. boolean isSelectedBounds; double tmpWidth1 = 0; double tmpIncreaseWidth = 0; ElementCase elementCase = reportPane.getEditingElementCase(); - Dimension size = gridColumn.getSize(); // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); LineMetrics fm = gridColumn.getFont().getLineMetrics("", fontRenderContext); @@ -158,8 +160,9 @@ public class GridColumnUI extends ComponentUI { columnContent += "(FR)"; } } + float time = (float)resolution/ScreenResolution.getScreenResolution(); - double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth(); + double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth() * time; // if (stringWidth > tmpIncreaseWidth) { // paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent); // } else { @@ -203,8 +206,8 @@ public class GridColumnUI extends ComponentUI { g2d.setPaint(UIManager.getColor("controlShadow")); } } - - GraphHelper.drawString(g2d, columnContent, tmpWidth1 + (tmpIncreaseWidth - stringWidth) / 2, fmAscent + GridHeader.SIZE_ADJUST / 2 + 1); + GraphHelper.drawString(g2d, columnContent, tmpWidth1 + (tmpIncreaseWidth - stringWidth) / 2, + (gridColumn.getSize().height/2 + g2d.getFont().getSize2D()/2)); } diff --git a/designer/src/com/fr/grid/GridCorner.java b/designer/src/com/fr/grid/GridCorner.java index a3f79b9331..91891fd44d 100644 --- a/designer/src/com/fr/grid/GridCorner.java +++ b/designer/src/com/fr/grid/GridCorner.java @@ -12,6 +12,7 @@ import java.awt.geom.Rectangle2D; import javax.swing.event.MouseInputListener; import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; import com.fr.design.mainframe.ElementCasePane; /** @@ -37,7 +38,7 @@ public class GridCorner extends BaseGridComponent { Graphics2D g2d = (Graphics2D) g; ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); //size Dimension size = this.getSize(); Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); @@ -50,7 +51,7 @@ public class GridCorner extends BaseGridComponent { GraphHelper.fill(g2d, rect2D); } - paintArc(g2d, size); + paintArc(g2d, size, time); //画左边的边框线. g2d.setColor(reportPane.getGridColumn().getSeparatorLineColor()); @@ -85,15 +86,15 @@ public class GridCorner extends BaseGridComponent { } - private void paintArc(Graphics2D g2d, Dimension size) { + private void paintArc(Graphics2D g2d, Dimension size, float time) { g2d.setColor(Color.gray); - int width = size.width - 16; + int width = (int) (size.width - (16 * time)); int avgWidth = width / 3; - int height = size.height - 8; + int height = (int) (size.height - (8 * time)); int avgHeight = height / 3; for (int i = 0; i < 3; i ++) { for (int j = 0; j < 3; j ++) { - GraphHelper.fillArc(g2d, 8 + i * avgWidth, 4 + j * avgHeight, 3, 3, 0, 360); + GraphHelper.fillArc(g2d, (8 * time) + (i * avgWidth), (4 * time) + (j * avgHeight), 3, 3, 0, 360); } } } diff --git a/designer/src/com/fr/grid/GridMouseAdapter.java b/designer/src/com/fr/grid/GridMouseAdapter.java index 147155e43d..fc88714adc 100644 --- a/designer/src/com/fr/grid/GridMouseAdapter.java +++ b/designer/src/com/fr/grid/GridMouseAdapter.java @@ -807,9 +807,11 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous * @param e */ public void mouseWheelMoved(MouseWheelEvent e) { - ElementCasePane reportPane = grid.getElementCasePane(); - if (reportPane.isHorizontalScrollBarVisible()) { - reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); + if (!InputEventBaseOnOS.isControlDown(e)) { + ElementCasePane reportPane = grid.getElementCasePane(); + if (reportPane.isHorizontalScrollBarVisible()) { + reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); + } } } diff --git a/designer/src/com/fr/grid/GridRow.java b/designer/src/com/fr/grid/GridRow.java index c80d08a4ec..70679b91bc 100644 --- a/designer/src/com/fr/grid/GridRow.java +++ b/designer/src/com/fr/grid/GridRow.java @@ -65,13 +65,13 @@ public class GridRow extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!(reportPane.isRowHeaderVisible())) { return new Dimension(0, 0); } int maxCharNumber = this.caculateMaxCharNumber(reportPane); - return new Dimension(maxCharNumber * GraphHelper.getFontMetrics(this.getFont()).charWidth('M'), super.getPreferredSize().height); + return new Dimension((int) (maxCharNumber * GraphHelper.getFontMetrics(this.getFont()).charWidth('M') * time), super.getPreferredSize().height); } /** diff --git a/designer/src/com/fr/grid/GridRowUI.java b/designer/src/com/fr/grid/GridRowUI.java index 4c0694a21a..016cfe6378 100644 --- a/designer/src/com/fr/grid/GridRowUI.java +++ b/designer/src/com/fr/grid/GridRowUI.java @@ -46,6 +46,9 @@ public class GridRowUI extends ComponentUI { ElementCasePane reportPane = gridRow.getElementCasePane(); // size Dimension size = gridRow.getSize(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + g2d.setFont(gridRow.getFont().deriveFont(gridRow.getFont().getSize2D() * time)); + ElementCase elementCase = reportPane.getEditingElementCase(); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCase); int verticalValue = reportPane.getGrid().getVerticalValue(); @@ -152,10 +155,10 @@ public class GridRowUI extends ComponentUI { , ElementCase elementCase, Dimension size, double tmpHeight1) { // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); - - float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent(); - double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth(); - double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent() * time; + double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth() * time; + double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight() * time; if (isSelectedBounds) { g2d.setColor(gridRow.getSelectedForeground()); } else { diff --git a/designer/src/com/fr/poly/PolyDesigner.java b/designer/src/com/fr/poly/PolyDesigner.java index aa416fc86f..0c700a7bf5 100644 --- a/designer/src/com/fr/poly/PolyDesigner.java +++ b/designer/src/com/fr/poly/PolyDesigner.java @@ -7,6 +7,7 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.edit.CopyAction; @@ -51,10 +52,7 @@ import com.fr.stable.unit.UnitRectangle; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; +import java.awt.event.*; import java.util.ArrayList; import java.util.List; @@ -98,7 +96,6 @@ public class PolyDesigner extends ReportComponent extends BasicBeanPane{ private static final long serialVersionUID = -4293765343535336275L; private static final int MAXVALUE = 100; @@ -119,7 +111,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ /** * august:不容易啊 还要用笔画图立个方程才计算出来 * - * @param e + * @param */ protected void ajustValues() { doLayout(); @@ -163,26 +155,30 @@ public abstract class BasicScrollPane extends BasicBeanPane{ } else { int preferheight = leftcontentPane.getPreferredSize().height; int value = scrollBar.getValue(); - + int baseValue = MAXVALUE - scrollBar.getVisibleAmount(); beginY = baseValue == 0 ? 0 : value * (preferheight - maxheight) / baseValue; if(MAXVALUE - scrollBar.getVisibleAmount() != 0) { beginY = value * (preferheight - maxheight) / (MAXVALUE - scrollBar.getVisibleAmount()); } } - int width = parent.getWidth(); - int height = parent.getHeight(); - if (leftcontentPane.getPreferredSize().height > maxheight) { - leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - DET_WIDTH_OVER_HEIGHT, height + beginY); - scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); - } else { - leftcontentPane.setBounds(0, 0, width - DET_WIDTH, height); - } + setLeftContentPaneBounds(parent, scrollBar, beginY, maxheight); leftcontentPane.validate(); } } + protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) { + int width = parent.getWidth(); + int height = parent.getHeight(); + if (leftcontentPane.getPreferredSize().height > maxheight) { + leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - DET_WIDTH_OVER_HEIGHT, height + beginY); + scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); + } else { + leftcontentPane.setBounds(0, 0, width - DET_WIDTH, height); + } + } + protected boolean isShowScrollBar() { return true; } @@ -191,7 +187,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ public T updateBean() { return null; } - + /** * 用于在调用removeAll以后恢复原来pane的结构,放在这边是因为BarLayout是内部类 * @param pane diff --git a/designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java b/designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java index 82854dd898..77f50aa6d5 100644 --- a/designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java +++ b/designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java @@ -128,6 +128,7 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, } public void setCurrentEditor(int i) { + upButton.setSelectedIndex(i); currentEditor = this.cards[i]; centerPane.removeAll(); centerPane.add(currentEditor); @@ -223,6 +224,10 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, return columnIndex; } + public void updateUpButton(){ + upButton.setSelectedIndex(this.getCurrentEditorIndex()); + } + public Object update(String makeAdiff) { String name = currentEditor.getName(); Object columnIndex = currentEditor.getValue(); @@ -335,6 +340,7 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, * 清除组件数据 */ public void clearComponentsData() { + setCurrentEditor(0); for (Editor card : cards) { card.clearData(); } diff --git a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java index c61a39c431..cb0e43712c 100644 --- a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java @@ -1,31 +1,20 @@ package com.fr.design.file; -import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.*; -import java.util.List; -import java.util.logging.Level; - -import javax.swing.*; - -import com.fr.design.constants.UIConstants; -import com.fr.design.DesignerEnvManager; -import com.fr.design.data.DesignTableDataManager; -import com.fr.design.gui.ilable.UILabel; - -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - import com.fr.base.FRContext; -import com.fr.design.data.datapane.TableDataTreePane; +import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.dav.LocalEnv; import com.fr.design.DesignModelAdapter; +import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.UIList; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; @@ -33,9 +22,19 @@ import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.stable.Constants; import com.fr.stable.project.ProjectConstants; -import com.fr.design.utils.gui.GUIPaintUtils; -public class HistoryTemplateListPane extends JPanel implements FileOperations { +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; + +public class HistoryTemplateListPane extends JPanel implements FileOperations, CallbackEvent{ private static final int LIST_BORDER = 4; private List> historyList; private JTemplate editingTemplate; @@ -228,6 +227,11 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations { return ComparatorUtils.equals(filename, editingFileName); } + @Override + public void callback() { + getCurrentEditingTemplate().repaint(); + } + private class HistoryListCellRender extends DefaultListCellRenderer { diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index 5908f06e1a..74c64de329 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -301,6 +301,12 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH return; } } + // 如果有可见模态对话框,则不隐藏 + for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) { + if (window instanceof JDialog && window.isVisible() && ((JDialog)window).isModal()) { + return; + } + } saveSettings(); setVisible(false); } diff --git a/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 00c1f07952..755d9cfaea 100644 --- a/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -1,10 +1,10 @@ package com.fr.design.gui.frpane; +import com.fr.design.dialog.BasicPane; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.dialog.BasicPane; import javax.swing.*; import java.awt.*; diff --git a/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java b/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java index 63ef53146a..071820e03c 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java +++ b/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java @@ -57,12 +57,12 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener { super.paint(g, c); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - Color linecolor = UIConstants.TITLED_BORDER_COLOR; + Color linecolor = UIConstants.POP_DIALOG_BORDER; if (comboBox.isPopupVisible()) { arrowButton.setSelected(true); } else { - linecolor = UIConstants.TITLED_BORDER_COLOR; + linecolor = UIConstants.POP_DIALOG_BORDER; arrowButton.setSelected(false); } g2d.setColor(linecolor); diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java index e08de4a8c5..3f16f8b91e 100644 --- a/designer_base/src/com/fr/design/gui/style/FormatPane.java +++ b/designer_base/src/com/fr/design/gui/style/FormatPane.java @@ -113,12 +113,7 @@ public class FormatPane extends AbstractBasicStylePane { centerPane.setBorder(LEFT_BORDER); frFontPane.setBorder(LEFT_BORDER); - Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(Inter.getLocText("FR-Base_Format"), SwingConstants.LEFT), typePane}, - new Component[]{null, centerPane}, - new Component[]{fontPane, frFontPane}, - }; + Component[][] components = getComponent(fontPane, centerPane, typePane); double[] rowSize = {p, p, p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; @@ -126,6 +121,16 @@ public class FormatPane extends AbstractBasicStylePane { this.add(panel, BorderLayout.CENTER); } + + protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Base_Format"), SwingConstants.LEFT), typePane}, + new Component[]{null, centerPane}, + new Component[]{fontPane, frFontPane}, + }; + } + protected UIComboBoxRenderer createComBoxRender() { return new UIComboBoxRenderer() { @Override @@ -383,6 +388,10 @@ public class FormatPane extends AbstractBasicStylePane { }; typeComboBox.setRenderer(render); typeComboBox.addItemListener(itemListener); + setTypeComboBoxPane(typeComboBox); + } + + protected void setTypeComboBoxPane (UIComboBox typeComboBox) { this.add(typeComboBox, BorderLayout.NORTH); } diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 669a5d06a2..34857cbecc 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2125,4 +2125,5 @@ FS-Designer_DS_Filter_Odd_Tip=Odd_Tip FS-Designer_DS_Filter_Even_Tip=Even_Tip FS-Designer_DS_Filter_Specify_Tip=Specify_Tip FR-Designer_Mobile-Height-Percent=Max Percent -FR-Designer_Mobile-Height-Limit=Height Limit \ No newline at end of file +FR-Designer_Mobile-Height-Limit=Height Limit +FR-Designer-AlphaFine_NO_Result=no search result \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 7be21d0be1..e92cb1119c 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2121,4 +2121,5 @@ FR-Designer_Coords_And_Size=Coords & Size FR-Designer_Barcode_Size=Barcode_Size FS-Designer_DS_Filter_Odd_Tip=Odd_Tip FS-Designer_DS_Filter_Even_Tip=Even_Tip -FS-Designer_DS_Filter_Specify_Tip=Specify_Tip \ No newline at end of file +FS-Designer_DS_Filter_Specify_Tip=Specify_Tip +FR-Designer-AlphaFine_NO_Result=no search result \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index d2bc62f860..19bfad99a0 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2132,4 +2132,5 @@ FR-Designer_Coords_And_Size=\u5750\u6807\u00B7\u5C3A\u5BF8 FR-Designer_Barcode_Size=\u6761\u5F62\u7801\u5927\u5C0F FS-Designer_DS_Filter_Odd_Tip=\u63D0\u793A\uFF1A\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u9009\u62E9\u4E86\u5947\u6570\u96C6(1,3,5...) FS-Designer_DS_Filter_Even_Tip=\u63D0\u793A\uFF1A\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u9009\u62E9\u4E86\u5076\u6570\u96C6(2,4,6...) -FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u4E3A1,2-3,5,8\uFF0C\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u5185\u503C\u53C2\u6570$_count_\u8868\u793A\u603B\u4E2A\u6570 \ No newline at end of file +FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u4E3A1,2-3,5,8\uFF0C\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u5185\u503C\u53C2\u6570$_count_\u8868\u793A\u603B\u4E2A\u6570 +FR-Designer-AlphaFine_NO_Result=\u65E0\u641C\u7D22\u7ED3\u679C \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index e0288fbe6b..4ae23d014d 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2125,3 +2125,4 @@ FS-Designer_DS_Filter_Odd_Tip=\u63D0\u793A\uFF1A\u5E8F\u865F\u5F9E1\u958B\u59CB\ FS-Designer_DS_Filter_Even_Tip=\u63D0\u793A\uFF1A\u5E8F\u865F\u5F9E1\u958B\u59CB\uFF0C\u9078\u64C7\u4E86\u5076\u6578\u96C6(2,4,6...) FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u70BA1,2-3,5,8\uFF0C\u5E8F\u865F\u5F9E1\u958B\u59CB\uFF0C\u5185\u7F6E\u53C3\u6578$_count_\u8868\u793A\u7E02\u500B\u6578 M-New_FormBook=\u65B0\u589E\u6C7A\u7B56\u5831\u8868 +FR-Designer-AlphaFine_NO_Result=\u7121\u641C\u7D22\u7D50\u679C diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index b5bf0fc1a8..ab2dff8b2b 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -77,7 +77,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public static final EastRegionContainerPane getInstance() { if (THIS == null) { THIS = new EastRegionContainerPane(); -// THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY()); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); } return THIS; @@ -85,13 +84,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public EastRegionContainerPane() { super(); -// setVerticalDragEnabled(false); initPropertyItemList(); defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available")); defaultAuthorityPane = getDefaultPane(Inter.getLocText("FR-Designer_Not_Support_Authority_Edit")); switchMode(PropertyMode.REPORT); -// initContentPane(); -// super(leftPane, rightPane); setContainerWidth(CONTAINER_WIDTH); } @@ -230,8 +226,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) { super(leftPane, rightPane); -// setVerticalDragEnabled(false); -// setContainerWidth(260); } public void replaceUpPane(JComponent pane) { @@ -377,29 +371,23 @@ public class EastRegionContainerPane extends UIEastResizableContainer { hasEnabledTab = true; if (!propertyItem.isPoppedOut()) { propertyCard.show(rightPane, name); // 显示第一个可用tab + propertyItem.setTabButtonSelected(); hasAvailableTab = true; break; } } } if (!hasAvailableTab) { + resetPropertyIcons(); if (!hasEnabledTab && BaseUtils.isAuthorityEditing()) { propertyCard.show(rightPane, DEFAULT_AUTHORITY_PANE); } else { propertyCard.show(rightPane, DEFAULT_PANE); } } - -// if (this.getRightPane() instanceof DockingView) { -// ((DockingView) this.getRightPane()).refreshDockingView(); -// } } public void refreshDownPane() { -// JComponent pane = propertyItemList.get(1).getContentPane(); -// if (pane instanceof DockingView) { -// ((DockingView) pane).refreshDockingView(); -// } } private void refreshContainer() { @@ -460,7 +448,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.btnIconName = btnIconName; initButton(); initPropertyPanel(); -// this.visibleModes = new ArrayList(visibleModes); initModes(visibleModes, enableModes); } @@ -576,11 +563,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } -// private void refreshContainer() { -// propertyPanel.validate(); -// propertyPanel.repaint(); -// propertyPanel.revalidate(); -// } private String getBtnIconUrl() { return ICON_BASE_DIR + btnIconName + iconSuffix; } @@ -594,6 +576,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + public void setTabButtonSelected() { + resetPropertyIcons(); + iconSuffix = ICON_SUFFIX_SELECTED; + button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); + button.setBackground(selectedBtnBackground); + button.setOpaque(true); + } + private void initButton() { button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { public Dimension getPreferredSize() { @@ -614,11 +604,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } else { popupFixedPane(); } - resetPropertyIcons(); - iconSuffix = ICON_SUFFIX_SELECTED; - button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); - button.setBackground(selectedBtnBackground); - button.setOpaque(true); + setTabButtonSelected(); } }); } @@ -655,7 +641,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 弹出对话框 public void popupDialog() { -// setIsPoppedOut(true); if (isPoppedOut) { return; } @@ -667,15 +652,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { popupDialog.adjustLocation(); popupDialog.setVisible(true); } -// initContentPane(); -// refreshContainer(); removeItem(this); } public void popToFrame() { if (isPoppedOut) { isPoppedOut = false; -// popupDialog.dispose(); popupDialog.setVisible(false); initContentPane(); onResize(); @@ -892,7 +874,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { container.add(popupToolPane, BorderLayout.NORTH); container.add(contentPane, BorderLayout.CENTER); setSize(CONTENT_WIDTH, POPUP_DEFAULT_HEIGHT); -// validate(); adjustLocation(); initListener(); diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 5d0cefed2e..17d9d6e364 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -379,10 +379,9 @@ public abstract class ToolBarMenuDock { // shortCuts.add(new ForumAction()); } shortCuts.add(SeparatorDef.DEFAULT); - shortCuts.add(new AboutAction()); - shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new AlphaFineAction()); - + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new AboutAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java b/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java index d28d6a3bd1..4b25c3436f 100644 --- a/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java +++ b/designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java @@ -137,6 +137,8 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName())); if (this.database == null) { + this.keyColumnPane.updateUpButton(); + this.valueDictPane.updateUpButton(); return; } @@ -187,6 +189,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i } dbDict.setKeyColumnIndex(keyColumnIndex); dbDict.setKeyColumnName(keyColumnName); + }else { + this.keyColumnPane.updateUpButton(); + this.valueDictPane.updateUpButton(); } Object value = this.valueDictPane.update(); if (value instanceof Integer) { diff --git a/designer_base/src/com/fr/design/style/AbstractSelectBox.java b/designer_base/src/com/fr/design/style/AbstractSelectBox.java index 58d1ec13d6..f354c164f8 100644 --- a/designer_base/src/com/fr/design/style/AbstractSelectBox.java +++ b/designer_base/src/com/fr/design/style/AbstractSelectBox.java @@ -38,12 +38,10 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent.setEmptyBackground(); displayComponent.setBorder(new TriggleLineBorder()); triggleButton = new UIToggleButton(UIConstants.ARROW_DOWN_ICON); - triggleButton.setRoundBorder(true, Constants.LEFT); - triggleButton.setPreferredSize(new Dimension(21, 20)); + triggleButton.setPreferredSize(new Dimension(20, 20)); JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); displayPane.add(displayComponent, BorderLayout.CENTER); - displayComponent.setPreferredSize(new Dimension(preWidth, displayPane.getPreferredSize().height)); displayComponent.addMouseListener(mouseListener); @@ -59,7 +57,6 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou } public void ancestorRemoved(AncestorEvent evt) { - hidePopupMenu(); } public void ancestorMoved(AncestorEvent event) { @@ -74,8 +71,6 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent.setEnabled(enabled); triggleButton.setEnabled(enabled); } - - @Override public JPanel initWindowPane(double preWidth) { @@ -88,8 +83,8 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(UIConstants.LINE_COLOR); - g2d.drawRoundRect(0, 0, this.getWidth() , this.getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + g2d.setColor(UIConstants.POP_DIALOG_BORDER); + g2d.drawRoundRect(0, 0, this.getWidth() - 1 , this.getHeight() - 1, 4, 4); triggleButton.setSelected(isPopupVisible()); } @@ -105,15 +100,12 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou private class TriggleLineBorder extends AbstractBorder { private static final long serialVersionUID = 1065857667981063530L; - protected Insets borderInsets = new Insets(0, 0, 0, 1); + protected Insets borderInsets = new Insets(0, 0, 0, 0); public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { g.translate(x, y); - g.setColor(UIConstants.LINE_COLOR); - g.drawLine(3, 0, w-2, 0); - g.drawLine(3, h - 1, w-2, h - 1); - g.drawLine(w - 1, 0, w - 1, h); + g.setColor(UIConstants.POP_DIALOG_BORDER); g.translate(-x, -y); } diff --git a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java index 434f60d9c7..b6f52e1998 100644 --- a/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java +++ b/designer_base/src/com/fr/design/utils/gui/GUIPaintUtils.java @@ -19,7 +19,7 @@ public class GUIPaintUtils { if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR); } else { - g2d.setColor(UIConstants.TITLED_BORDER_COLOR); + g2d.setColor(UIConstants.POP_DIALOG_BORDER); } if (isRound) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 06cfc242ac..6e8c898717 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -9,8 +9,25 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.chart.gui.ChartWidgetOption; -import com.fr.design.chartinterface.*; +import com.fr.design.chartinterface.AreaIndependentChartInterface; +import com.fr.design.chartinterface.BarIndependentChartInterface; +import com.fr.design.chartinterface.BubbleIndependentChartInterface; +import com.fr.design.chartinterface.ColumnIndependentChartInterface; +import com.fr.design.chartinterface.CustomIndependentChartInterface; +import com.fr.design.chartinterface.DonutIndependentChartInterface; +import com.fr.design.chartinterface.FunnelIndependentChartInterface; +import com.fr.design.chartinterface.GanttIndependentChartInterface; +import com.fr.design.chartinterface.GisMapIndependentChartInterface; +import com.fr.design.chartinterface.LineIndependentChartInterface; +import com.fr.design.chartinterface.MapIndependentChartInterface; +import com.fr.design.chartinterface.MeterIndependentChartInterface; +import com.fr.design.chartinterface.PieIndependentChartInterface; +import com.fr.design.chartinterface.RadarIndependentChartInterface; +import com.fr.design.chartinterface.RangeIndependentChartInterface; +import com.fr.design.chartinterface.StockIndependentChartInterface; +import com.fr.design.chartinterface.XYScatterIndependentChartInterface; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; @@ -25,20 +42,58 @@ import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.chart.PiePlot4VanChart; +import com.fr.plugin.chart.area.AreaIndependentVanChartInterface; +import com.fr.plugin.chart.area.VanChartAreaPlot; +import com.fr.plugin.chart.bar.BarIndependentVanChartInterface; +import com.fr.plugin.chart.bubble.BubbleIndependentVanChartInterface; +import com.fr.plugin.chart.bubble.VanChartBubblePlot; +import com.fr.plugin.chart.column.ColumnIndependentVanChartInterface; +import com.fr.plugin.chart.column.VanChartColumnPlot; +import com.fr.plugin.chart.custom.CustomIndependentVanChartInterface; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.drillmap.DrillMapIndependentVanChartInterface; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.funnel.VanChartFunnelPlot; +import com.fr.plugin.chart.funnel.designer.FunnelIndependentVanChartInterface; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.plugin.chart.gantt.designer.GanttIndependentVanChartInterface; +import com.fr.plugin.chart.gauge.GaugeIndependentVanChartInterface; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; +import com.fr.plugin.chart.heatmap.designer.HeatMapIndependentVanChartInterface; +import com.fr.plugin.chart.line.LineIndependentVanChartInterface; +import com.fr.plugin.chart.line.VanChartLinePlot; +import com.fr.plugin.chart.map.MapIndependentVanChartInterface; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.multilayer.MultiPieIndependentVanChartInterface; +import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; +import com.fr.plugin.chart.pie.PieIndependentVanChartInterface; +import com.fr.plugin.chart.radar.RadarIndependentVanChartInterface; +import com.fr.plugin.chart.radar.VanChartRadarPlot; +import com.fr.plugin.chart.scatter.ScatterIndependentVanChartInterface; +import com.fr.plugin.chart.scatter.VanChartScatterPlot; +import com.fr.plugin.chart.structure.VanChartStructurePlot; +import com.fr.plugin.chart.structure.desinger.StructureIndependentVanChartInterface; +import com.fr.plugin.chart.treemap.TreeMapIndependentVanChartInterface; +import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; +import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; +import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; +import com.fr.plugin.chart.wordcloud.designer.WordCloudIndependentVanChartInterface; import com.fr.plugin.injectable.PluginSingleInjection; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.solution.closeable.CloseableContainedMap; import com.fr.stable.ArrayUtils; +import com.fr.stable.EnvChangedListener; import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Created by eason on 14/12/29. @@ -58,24 +113,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr static { readDefault(); + readVanChart(); StableFactory.registerMarkedObject(XML_TAG, classManager); } static { - - GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - + + GeneralContext.addEnvChangedListener(new EnvChangedListener() { @Override - public void on(PluginEvent event) { + public void envChanged() { //重新注册designModuleFactory DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraChartType); + DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); } }); } @@ -130,6 +179,36 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr aRowChart.createSlotImage(); } } + + private static void readVanChart() { + + if (chartTypeInterfaces.containsKey(ChartTypeManager.VAN_CHART_PRIORITY)) { + return; + } + CloseableContainedMap chartUIList = + new CloseableContainedMap(LinkedHashMap.class); + chartUIList.put(PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface()); + chartUIList.put(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new ColumnIndependentVanChartInterface()); + chartUIList.put(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface()); + chartUIList.put(VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface()); + chartUIList.put(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface()); + chartUIList.put(VanChartGaugePlot.VAN_CHART_GAUGE_PLOT, new GaugeIndependentVanChartInterface()); + chartUIList.put(VanChartRadarPlot.VAN_CHART_RADAR_PLOT, new RadarIndependentVanChartInterface()); + chartUIList.put(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID, new ScatterIndependentVanChartInterface()); + chartUIList.put(VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, new BubbleIndependentVanChartInterface()); + chartUIList.put(VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID, new CustomIndependentVanChartInterface()); + chartUIList.put(VanChartMultiPiePlot.VAN_CHART_MULTILAYER_PLOT_ID, new MultiPieIndependentVanChartInterface()); + chartUIList.put(VanChartMapPlot.VAN_CHART_MAP_ID, new MapIndependentVanChartInterface()); + chartUIList.put(VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new DrillMapIndependentVanChartInterface()); + chartUIList.put(VanChartTreeMapPlot.VAN_CHART_TREE_MAP_PLOT_ID, new TreeMapIndependentVanChartInterface()); + chartUIList.put(VanChartFunnelPlot.VAN_CHART_FUNNEL_PLOT_ID, new FunnelIndependentVanChartInterface()); + chartUIList.put(VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new HeatMapIndependentVanChartInterface()); + chartUIList.put(VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface()); + chartUIList.put(VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); + chartUIList.put(VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface()); + + chartTypeInterfaces.put(ChartTypeManager.VAN_CHART_PRIORITY, chartUIList); + } private static void readDefault() { diff --git a/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java b/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java index 8a157f0843..0d78f84ffc 100644 --- a/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java +++ b/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java @@ -81,7 +81,7 @@ public class MinMaxValuePane extends JPanel { }; } - private void checkBoxUse() { + protected void checkBoxUse() { minValueField.setEnabled(minCheckBox.isSelected()); maxValueField.setEnabled(maxCheckBox.isSelected()); diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/area.png b/designer_chart/src/com/fr/design/images/form/toolbar/area.png new file mode 100644 index 0000000000..0e690168c1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/area.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/bar.png b/designer_chart/src/com/fr/design/images/form/toolbar/bar.png new file mode 100644 index 0000000000..0913e05b1d Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/bar.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/bubble.png b/designer_chart/src/com/fr/design/images/form/toolbar/bubble.png new file mode 100644 index 0000000000..249e3cda0c Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/bubble.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/column.png b/designer_chart/src/com/fr/design/images/form/toolbar/column.png new file mode 100644 index 0000000000..e07ad05839 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/column.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/custom.png b/designer_chart/src/com/fr/design/images/form/toolbar/custom.png new file mode 100644 index 0000000000..dd25ad0471 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/custom.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png b/designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png new file mode 100644 index 0000000000..6459771dbc Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/funnel.png b/designer_chart/src/com/fr/design/images/form/toolbar/funnel.png new file mode 100644 index 0000000000..ff8239f8d5 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/funnel.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/gantt.png b/designer_chart/src/com/fr/design/images/form/toolbar/gantt.png new file mode 100644 index 0000000000..08a6282f25 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/gantt.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/gauge.png b/designer_chart/src/com/fr/design/images/form/toolbar/gauge.png new file mode 100644 index 0000000000..8ee7ab31f7 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/gauge.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png b/designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png new file mode 100644 index 0000000000..6e6c2146c4 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/line.png b/designer_chart/src/com/fr/design/images/form/toolbar/line.png new file mode 100644 index 0000000000..5bb2764652 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/line.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/map.png b/designer_chart/src/com/fr/design/images/form/toolbar/map.png new file mode 100644 index 0000000000..6459771dbc Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/map.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png b/designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png new file mode 100644 index 0000000000..b6bca9a3eb Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/pie.png b/designer_chart/src/com/fr/design/images/form/toolbar/pie.png new file mode 100644 index 0000000000..15885cd7b0 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/pie.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/radar.png b/designer_chart/src/com/fr/design/images/form/toolbar/radar.png new file mode 100644 index 0000000000..5343bef301 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/radar.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/scatter.png b/designer_chart/src/com/fr/design/images/form/toolbar/scatter.png new file mode 100644 index 0000000000..5edb30ff52 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/scatter.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/structure.png b/designer_chart/src/com/fr/design/images/form/toolbar/structure.png new file mode 100644 index 0000000000..31720b5178 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/structure.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png b/designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png new file mode 100644 index 0000000000..09edd2b77e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png b/designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png new file mode 100644 index 0000000000..3423b0583d Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png new file mode 100644 index 0000000000..2f68dcf8f9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png new file mode 100644 index 0000000000..e1ab5c3131 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png new file mode 100644 index 0000000000..dd25ad0471 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png new file mode 100644 index 0000000000..c23759fba9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png new file mode 100644 index 0000000000..e5da857b6b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png new file mode 100644 index 0000000000..2c62da86be Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png new file mode 100644 index 0000000000..0450c50073 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png new file mode 100644 index 0000000000..2f68dcf8f9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png new file mode 100644 index 0000000000..b6bca9a3eb Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png new file mode 100644 index 0000000000..754781f9fd Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png new file mode 100644 index 0000000000..24a2aaa3e9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png new file mode 100644 index 0000000000..09edd2b77e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png differ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java index 8c4a21c814..183fb78417 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java @@ -4,6 +4,9 @@ package com.fr.design.mainframe.chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import javax.swing.*; +import java.awt.*; + public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { public abstract void populate(ChartCollection collection); @@ -25,6 +28,12 @@ public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { } + protected void initContentPane() { + leftContentPane = createContentPane(); + leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, original)); + this.add(leftContentPane, BorderLayout.CENTER); + } + /** * 刷新图表数据界面 * @param collection 图表收集器 diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index fc3b70108e..22b9db8e37 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.chart; -import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; @@ -74,12 +73,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 //构建主面板 protected void createTabsPane() { - Icon[] iconArray = new Icon[paneList.size()]; + String[] iconArray = new String[paneList.size()]; card = new CardLayout(); center = new JPanel(card); for (int i = 0; i < paneList.size(); i++) { AbstractChartAttrPane pane = paneList.get(i); - iconArray[i] = BaseUtils.readIcon(pane.getIconPath()); + iconArray[i] = pane.title4PopupWindow(); center.add(pane, pane.title4PopupWindow()); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 3ee84ceb7c..1f1f5a9f94 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -4,9 +4,9 @@ package com.fr.design.mainframe.chart.gui; * Created by hufan on 2016/10/20. */ -import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.base.AttrChangeConfig; import com.fr.chart.base.AttrChangeType; +import com.fr.chart.chartattr.ChartCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -15,6 +15,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.general.Inter; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; import javax.swing.*; import java.awt.*; @@ -55,11 +56,9 @@ public class ChangeConfigPane extends BasicBeanPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p,p,p,p}; + double[] rowSize = {p,p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, - new Component[]{null, null}, - new Component[]{new JSeparator(), null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style")),configStyleButton}, new Component[]{configPane, null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -84,6 +83,8 @@ public class ChangeConfigPane extends BasicBeanPane { panel.add(buttonConfigPane, "button"); panel.add(carouselConfigPane, "carousel"); + panel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); + return panel; } @@ -92,35 +93,33 @@ public class ChangeConfigPane extends BasicBeanPane { double f = TableLayout.FILL; double[] columnSize = {p, f}; double[] rowSize = {p,p,p}; + timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); + colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); Component[][] components = new Component[][]{ - new Component[]{createTimeIntervalPane(),null}, - new Component[]{new JSeparator(),null}, - new Component[]{createCarouseBackgroundColorPane(),null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Time_Interval")), timeInterval}, + new Component[]{new UILabel(Inter.getLocText("Background")),colorSelectBox4carousel}, }; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - } - - private Component createTimeIntervalPane() { - timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Time_Interval") + ":", timeInterval); - } - - private JPanel createCarouseBackgroundColorPane() { - colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4carousel); + return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); } private JPanel createTitleStylePane(){ - styleAttrPane = new ChartTextAttrPane(); + styleAttrPane = new ChartTextAttrPane(){ + protected Component[][] getComponents(JPanel buttonPane) { + return new Component[][]{ + new Component[]{fontNameComboBox, null}, + new Component[]{buttonPane, null} + }; + } + }; styleAttrPane.setPreferredSize(new Dimension(WIDTH, (int) styleAttrPane.getPreferredSize().getHeight())); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style")+":", styleAttrPane); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-Chart_Character")+":", styleAttrPane); } private JPanel createButtonBackgroundColorPane(){ colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4button); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Background") + ":", colorSelectBox4button); } private JPanel createButtonConfigPane() { @@ -130,7 +129,6 @@ public class ChangeConfigPane extends BasicBeanPane { double[] rowSize = {p,p,p}; Component[][] components = new Component[][]{ new Component[]{createTitleStylePane(),null}, - new Component[]{new JSeparator(),null}, new Component[]{createButtonBackgroundColorPane(),null}, }; diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java index 0003c09be5..3eff5f6974 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java @@ -97,17 +97,21 @@ public class ChartFillStylePane extends BasicBeanPane{ customPane.setPreferredSize(new Dimension(200, 130)); colorGradient.setPreferredSize(new Dimension(120, 30)); + + this.setLayout(new BorderLayout()); + this.add(getContentPane(),BorderLayout.CENTER); + } + + protected JPanel getContentPane () { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = { f }; double[] rowSize = { p, p}; - Component[][] components = new Component[][]{ - new Component[]{styleSelectBox}, - new Component[]{customPane} - } ; - JPanel panel = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ColorMatch"},components,rowSize,columnSize); - this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + Component[][] components = new Component[][]{ + new Component[]{styleSelectBox}, + new Component[]{customPane} + } ; + return TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ColorMatch"},components,rowSize,columnSize); } @Override diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index 1146d404d5..e53a505345 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -1,25 +1,23 @@ package com.fr.design.mainframe.chart.gui.style; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.Font; - -import javax.swing.JPanel; - import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.dialog.BasicPane; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.*; +import java.awt.*; public class ChartTextAttrPane extends BasicPane { private static final long serialVersionUID = 6731679928019436869L; @@ -147,17 +145,23 @@ public class ChartTextAttrPane extends BasicPane { buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); - double[] columnSize = {f}; - double[] rowSize = {p, p}; - Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, - new Component[]{buttonPane} - }; + double[] columnSize = {p,f}; + double[] rowSize = {p, p, p}; + - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER); populate(FRFont.getInstance()); } + + protected Component[][] getComponents(JPanel buttonPane) { + UILabel text = new UILabel(Inter.getLocText("Plugin-Chart_Character"), SwingConstants.LEFT); + return new Component[][]{ + new Component[]{null, null}, + new Component[]{text, fontNameComboBox}, + new Component[]{null, buttonPane} + }; + } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java index 951d57f822..9d3f9756e3 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java @@ -1,24 +1,18 @@ package com.fr.design.mainframe.chart.gui.style; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.util.List; - -import javax.swing.JPanel; -import javax.swing.border.Border; - import com.fr.chart.chartattr.Plot; -import com.fr.design.constants.UIConstants; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIHeadGroup; +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; +import java.util.List; + public abstract class ThirdTabPane extends BasicBeanPane{ private static final long serialVersionUID = 2298609199400393886L; @@ -114,8 +108,8 @@ public abstract class ThirdTabPane extends BasicBeanPane{ protected static class NamePane { private String name; - private AbstractChartTabPane pane; - public NamePane(String name, AbstractChartTabPane pane) { + private BasicScrollPane pane; + public NamePane(String name, BasicScrollPane pane) { this.name = name; this.pane = pane; } @@ -125,10 +119,10 @@ public abstract class ThirdTabPane extends BasicBeanPane{ public void setName(String name) { this.name = name; } - public AbstractChartTabPane getPane() { + public BasicScrollPane getPane() { return pane; } - public void setPane(AbstractChartTabPane pane) { + public void setPane(BasicScrollPane pane) { this.pane = pane; } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java index 2f82714bf2..66b0c41f3c 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java @@ -26,62 +26,67 @@ public abstract class AbstractPlotSeriesPane extends BasicBeanPane{ public AbstractPlotSeriesPane(ChartStylePane parent, Plot plot) { this(parent, plot, false); } - - public AbstractPlotSeriesPane(ChartStylePane parent, Plot plot, boolean custom) { + + public AbstractPlotSeriesPane(ChartStylePane parent, Plot plot, boolean custom) { this.plot = plot; - this.parentPane = parent; - fillStylePane = getFillStylePane(); + this.parentPane = parent; + fillStylePane = getFillStylePane(); + + this.setLayout(new BorderLayout()); + this.add(getContentPane(custom), BorderLayout.CENTER); + } - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { f }; - double[] rowSize = { p,p,p}; + protected JPanel getContentPane(boolean custom) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[3][1]; - if(custom) { - if(!(plot instanceof Bar2DPlot)) { - components[0] = new Component[]{getContentInPlotType()}; - components[1] = new Component[]{new JSeparator()}; - } + JPanel panel; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + if (custom) { + if (!(plot instanceof Bar2DPlot)) { + components[0] = new Component[]{getContentInPlotType()}; + components[1] = new Component[]{new JSeparator()}; + } - JScrollPane scrollPane = new JScrollPane(); - scrollPane.setViewportView(panel); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.setLayout(new BorderLayout()); - this.add(scrollPane, BorderLayout.CENTER); + JScrollPane scrollPane = new JScrollPane(); + scrollPane.setViewportView(panel); + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } else { - if(fillStylePane != null) { - components[0] = new Component[]{fillStylePane}; - components[1] = new Component[]{new JSeparator()}; - } - - JPanel contentPane = getContentInPlotType(); - if(contentPane != null) { - components[2] = new Component[]{contentPane}; - } - - JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + if (fillStylePane != null) { + components[0] = new Component[]{fillStylePane}; + components[1] = new Component[]{new JSeparator()}; + } + + JPanel contentPane = getContentInPlotType(); + if (contentPane != null) { + components[2] = new Component[]{contentPane}; + } + + panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } - } - - /** + panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + return panel; + + } + + /** * 在每个不同类型Plot, 得到不同类型的属性. 比如: 柱形的风格, 折线的线型曲线. */ protected abstract JPanel getContentInPlotType(); - + /** * 返回 填充界面. */ protected ChartFillStylePane getFillStylePane() { return new ChartFillStylePane(); } - + /** * 界面标题. */ @@ -95,8 +100,8 @@ public abstract class AbstractPlotSeriesPane extends BasicBeanPane{ public Plot updateBean() { return null; } - - + + /** * 更新Plot的属性到系列界面 */ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ChartSeriesPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ChartSeriesPane.java index 7cb9beb02c..c9f54fc339 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ChartSeriesPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ChartSeriesPane.java @@ -3,9 +3,9 @@ package com.fr.design.mainframe.chart.gui.style.series; import com.fr.chart.chartattr.Chart; import com.fr.design.ChartTypeInterfaceManager; -import com.fr.design.dialog.BasicScrollPane; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.plugin.chart.designer.AbstractVanChartScrollPane; import javax.swing.*; import java.awt.*; @@ -15,7 +15,7 @@ import java.awt.*; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-1-5 上午10:31:50 */ -public class ChartSeriesPane extends BasicScrollPane{ +public class ChartSeriesPane extends AbstractVanChartScrollPane { protected AbstractPlotSeriesPane seriesStyleContentPane; protected Chart chart; diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index a24b818346..37c2f26b51 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -1,27 +1,11 @@ package com.fr.design.mainframe.chart.gui.style.series; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.LayoutManager; -import java.awt.Point; -import java.awt.event.*; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - import com.fr.base.Formula; import com.fr.chart.base.AreaColor; import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.chartglyph.MapHotAreaColor; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.frpane.UINumberDragPane; @@ -31,12 +15,20 @@ import com.fr.design.gui.ipoppane.PopupHider; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.dialog.BasicPane; -import com.fr.general.Inter; -import com.fr.stable.StringUtils; import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; public class UIColorPickerPane extends BasicPane implements UIObserver { private static final int MARGIN_TOP = 10; @@ -105,11 +97,10 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; Component[][] components = createComponents(); - upControlPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + upControlPane = TableLayoutHelper.createTableLayoutPane(components, getRowSIze (), columnSize); this.textFieldList = this.getTextFieldList(); this.textGroup = new TextFieldGroupPane(); @@ -122,6 +113,11 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { refreshGroupPane(colors, getValueArray(number)); } + protected double[] getRowSIze () { + double p = TableLayout.PREFERRED; + return new double[]{p, p, p}; + } + protected UIButtonGroup getDesignTypeButtonGroup(){ return designTypeButtonGroup; } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java index 1d66cb6207..96f0fff3ee 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java @@ -10,6 +10,7 @@ import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.Marker; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.ConfigHelper; /** * 散点图 属性表 系列界面. @@ -57,7 +58,7 @@ public class XYScatterSeriesPane extends LineSeriesPane { attrList.remove(attr); } - if(!ComparatorUtils.equals(markerPane.getSelectedMarkder().getMarkerType(), Marker.NULL_M)){ + if(!ComparatorUtils.equals(markerPane.getSelectedMarkder().getMarkerType(), ConfigHelper.NULL_M)){ attrList.addDataSeriesCondition(new AttrMarkerType(markerPane.getSelectedMarkder().getMarkerType())); } } diff --git a/designer_chart/src/com/fr/design/module/ChartDesignerModule.java b/designer_chart/src/com/fr/design/module/ChartDesignerModule.java index 979be5c92a..586910774a 100644 --- a/designer_chart/src/com/fr/design/module/ChartDesignerModule.java +++ b/designer_chart/src/com/fr/design/module/ChartDesignerModule.java @@ -1 +1,92 @@ -package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if (ArrayUtils.isEmpty(rowChart)) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } \ No newline at end of file +package com.fr.design.module; + +import com.fr.chart.base.ChartInternationalNameContentBean; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.actions.core.ActionFactory; +import com.fr.design.chart.ChartDialog; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.ChartWidgetOption; +import com.fr.design.gui.core.WidgetOption; +import com.fr.design.mainframe.App; +import com.fr.design.mainframe.ChartPropertyPane; +import com.fr.form.ui.ChartEditor; +import com.fr.general.IOUtils; +import com.fr.general.Inter; +import com.fr.plugin.chart.map.server.ChartMapEditorAction; +import com.fr.stable.ArrayUtils; +import com.fr.stable.bridge.StableFactory; +import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; + +import javax.swing.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 7.0.3 + * Date: 13-7-8 + * Time: 上午9:13 + */ +public class ChartDesignerModule extends DesignModule { + public void start() { + super.start(); + dealBeforeRegister(); + register(); + registerFloatEditor(); + } + + protected void dealBeforeRegister(){ + StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); + StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); + } + + private void register(){ + DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); + + DesignModuleFactory.registerChartEditorClass(ChartEditor.class); + DesignModuleFactory.registerChartComponentClass(ChartComponent.class); + + DesignModuleFactory.registerChartDialogClass(ChartDialog.class); + + DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); + + ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); + ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction()); + } + + protected void registerFloatEditor() { + ActionFactory.registerChartCollection(ChartCollection.class); + } + + /** + * 返回设计器能打开的模板类型的一个数组列表 + * + * @return 可以打开的模板类型的数组 + */ + public App[] apps4TemplateOpener() { + return new App[0]; + } + protected WidgetOption[] options4Show() { + ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + for (int i = 0; i < typeName.length; i++) { + String plotID = typeName[i].getPlotID(); + Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + if (ArrayUtils.isEmpty(rowChart)) { + continue; + } + String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); + Icon icon = IOUtils.readIcon(iconPath); + child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); + } + return child; + } + + public String getInterNationalName() { + return Inter.getLocText("FR-Chart-Design_ChartModule"); + } + + +} diff --git a/designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java new file mode 100644 index 0000000000..0f23b79429 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java @@ -0,0 +1,40 @@ +package com.fr.plugin.chart.area; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; + +/** + * Created by Mitisky on 15/11/18. + */ +public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { + @Override + public String getIconPath() { + return "com/fr/design/images/form/toolbar/area.png"; + } + + @Override + public AbstractChartTypePane getPlotTypePane() { + return new VanChartAreaPlotPane(); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new VanChartAreaConditionPane(plot); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new VanChartAreaSeriesPane(parent, plot); + } + + /** + * plot面板的标题 + * 插件兼容 + */ + public String getPlotTypeTitle4PopupWindow(){ + return VanChartAreaPlotPane.TITLE; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java new file mode 100644 index 0000000000..3d452a358e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java @@ -0,0 +1,96 @@ +package com.fr.plugin.chart.area; + +import com.fr.chart.base.AttrBackground; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.plugin.chart.attr.EffectHelper; +import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; +import com.fr.plugin.chart.base.AttrDataSheet; +import com.fr.plugin.chart.base.AttrEffect; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.base.VanChartAttrLine; +import com.fr.plugin.chart.base.VanChartAttrMarker; +import com.fr.plugin.chart.base.VanChartAttrTrendLine; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.other.condition.item.VanChartAreaFillColorConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartLineTypeConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartMarkerConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane; +import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint; +import com.fr.plugin.chart.scatter.large.VanChartLargeModelMarkerConditionPane; + +import java.awt.*; + +/** + * Created by Mitisky on 15/11/18. + */ +public class VanChartAreaConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = -7180705321732069806L; + + public VanChartAreaConditionPane(Plot plot) { + super(plot); + } + + protected void initComponents() { + super.initComponents(); + //添加全部条件属性后被遮挡 + liteConditionPane.setPreferredSize(new Dimension(300, 400)); + } + + @Override + protected void addBasicAction() { + classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); + classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); + classPaneMap.put(AttrAreaSeriesFillColorBackground.class, new VanChartAreaFillColorConditionPane(this, plot)); + classPaneMap.put(VanChartAttrLine.class, new VanChartLineTypeConditionPane(this)); + classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); + //是否使用数据表 + if (plot.getDataSheet().isVisible()) { + classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot)); + } + if(PlotFactory.largeDataModel(plot)){ + classPaneMap.put(VanChartAttrMarker.class, new VanChartLargeModelMarkerConditionPane(this)); + } else { + classPaneMap.put(VanChartAttrMarker.class, new VanChartMarkerConditionPane(this)); + classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getAreaPlotDefaultEffect())); + classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); + } + } + + protected void addStyleAction() { + + } + + @Override + protected ChartConditionPane createListConditionPane() { + return new ChartConditionPane(){ + @Override + public String[] columns2Populate() { + return new String[]{ + ChartConstants.CATEGORY_INDEX, + ChartConstants.CATEGORY_NAME, + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + ChartConstants.VALUE, + VanChartMultiCategoryDataPoint.CATEGORY_ARRAY, + }; + } + }; + } + + /** + * 返回图表class对象 + * @return class对象 + */ + public Class class4Correspond() { + return VanChartAreaPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java new file mode 100644 index 0000000000..2e31b4c93f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java @@ -0,0 +1,95 @@ +package com.fr.plugin.chart.area; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; + +/** + * Created by Mitisky on 15/11/18. + */ +public class VanChartAreaPlotPane extends AbstractVanChartTypePane { + public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewArea"); + private static final long serialVersionUID = -8161581682558781651L; + + @Override + protected String[] getTypeIconPath() { + + return new String[]{"/com/fr/plugin/chart/area/images/area.png", + "/com/fr/plugin/chart/area/images/stack.png", + "/com/fr/plugin/chart/area/images/percentStack.png", + "/com/fr/plugin/chart/area/images/custom.png", + }; + } + + @Override + protected String[] getTypeTipName() { + String area = Inter.getLocText("FR-Chart-Type_Area"); + String stack = Inter.getLocText("FR-Chart-Type_Stacked"); + String percent = Inter.getLocText("FR-Chart-Use_Percent"); + return new String[]{ + area, + stack + area, + percent + stack + area, + Inter.getLocText("FR-Chart-Mode_Custom") + }; + } + + /** + * 返回界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_NewArea"); + } + + /** + * 更新界面内容 + */ + public void populateBean(Chart chart) { + for(ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + Plot plot = chart.getPlot(); + if(plot instanceof VanChartAreaPlot) { + lastTypeIndex = ((VanChartAreaPlot) plot).getVanChartPlotType().ordinal(); + typeDemo.get(lastTypeIndex).isPressing = true; + } + checkDemosBackground(); + } + + + /** + * 获取各图表类型界面ID, 本质是plotID + * + * @return 图表类型界面ID + */ + @Override + protected String getPlotTypeID() { + return VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID; + } + + protected Plot getSelectedClonedPlot(){ + VanChartAreaPlot newPlot = null; + Chart[] areaChart = AreaIndependentVanChart.AreaVanChartTypes; + for(int i = 0, len = areaChart.length; i < len; i++){ + if(typeDemo.get(i).isPressing){ + newPlot = (VanChartAreaPlot)areaChart[i].getPlot(); + } + } + Plot cloned = null; + try { + cloned = (Plot)newPlot.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In AreaChart"); + } + return cloned; + } + + public Chart getDefaultChart() { + return AreaIndependentVanChart.AreaVanChartTypes[0]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java new file mode 100644 index 0000000000..e0bd8852e7 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java @@ -0,0 +1,51 @@ +package com.fr.plugin.chart.area; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane; +import com.fr.plugin.chart.line.VanChartLineSeriesPane; + +import javax.swing.*; +import java.awt.*; + +public class VanChartAreaSeriesPane extends VanChartLineSeriesPane{ + + private static final long serialVersionUID = 5497989595104913025L; + + public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot){ + super(parent, plot); + } + + protected JPanel getContentInPlotType(){ + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p,p,p,p,p,p,p,p,p,p,p}; + double[] col = {f}; + + Component[][] components = new Component[][]{ + new Component[]{createStylePane()}, + new Component[]{stylePane == null ? null : new JSeparator()}, + new Component[]{createLineTypePane()}, + new Component[]{new JSeparator()}, + new Component[]{createMarkerPane()}, + new Component[]{new JSeparator()}, + new Component[]{createAreaFillColorPane()}, + new Component[]{new JSeparator()}, + new Component[]{createStackedAndAxisPane()}, + new Component[]{createLargeDataModelPane()}, + new Component[]{new JSeparator()}, + new Component[]{createTrendLinePane()}, + }; + + contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); + return contentPane; + } + + protected Class getStackAndAxisPaneClass() { + return VanChartCustomStackAndAxisConditionPane.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/area.png b/designer_chart/src/com/fr/plugin/chart/area/images/area.png new file mode 100644 index 0000000000..013b0ab3cc Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/custom.png b/designer_chart/src/com/fr/plugin/chart/area/images/custom.png new file mode 100644 index 0000000000..319a873c33 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png b/designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png new file mode 100644 index 0000000000..78f414eb63 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/stack.png b/designer_chart/src/com/fr/plugin/chart/area/images/stack.png new file mode 100644 index 0000000000..d41ca6010e Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/stack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java new file mode 100644 index 0000000000..1e0917d966 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java @@ -0,0 +1,56 @@ +package com.fr.plugin.chart.bar; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.column.VanChartColumnConditionPane; +import com.fr.plugin.chart.column.VanChartColumnSeriesPane; +import com.fr.plugin.chart.designer.other.VanChartOtherPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; + +/** + * Created by Mitisky on 15/10/20. + */ +public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { + @Override + public String getIconPath() { + return "com/fr/design/images/form/toolbar/bar.png"; + } + + @Override + public AbstractChartTypePane getPlotTypePane() { + return new VanChartBarPlotPane(); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new VanChartColumnConditionPane(plot); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new VanChartColumnSeriesPane(parent, plot); + } + + /** + * 图表的属性界面数组 + * @return 属性界面 + */ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + VanChartStylePane stylePane = new VanChartBarStylePane(listener); + VanChartOtherPane otherPane = new VanChartOtherPane(); + return new AbstractChartAttrPane[]{stylePane, otherPane}; + } + + /** + * plot面板的标题 + * 插件兼容 + */ + public String getPlotTypeTitle4PopupWindow(){ + return VanChartBarPlotPane.TITLE; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java b/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java new file mode 100644 index 0000000000..3156380fa6 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java @@ -0,0 +1,96 @@ +package com.fr.plugin.chart.bar; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.column.VanChartColumnPlot; +import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; + +/** + * Created by Mitisky on 15/10/20. + */ +public class VanChartBarPlotPane extends AbstractVanChartTypePane { + public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBar"); + + private static final long serialVersionUID = 2879689884048643002L; + + @Override + protected String[] getTypeIconPath() { + return new String[]{"/com/fr/plugin/chart/bar/images/bar.png", + "/com/fr/plugin/chart/bar/images/stack.png", + "/com/fr/plugin/chart/bar/images/percentstack.png", + "/com/fr/plugin/chart/bar/images/custom.png", + }; + } + + @Override + protected String[] getTypeTipName() { + String bar = Inter.getLocText("FR-Chart-Type_Bar"); + String stack = Inter.getLocText("FR-Chart-Type_Stacked"); + String percent = Inter.getLocText("FR-Chart-Use_Percent"); + return new String[]{ + bar, + stack + bar, + percent + stack + bar, + Inter.getLocText("FR-Chart-Mode_Custom") + }; + } + + /** + * 返回界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_NewBar"); + } + + /** + * 更新界面内容 + */ + public void populateBean(Chart chart) { + for(ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + Plot plot = chart.getPlot(); + if(plot instanceof VanChartColumnPlot) { + lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal(); + typeDemo.get(lastTypeIndex).isPressing = true; + } + checkDemosBackground(); + } + + /** + * 获取各图表类型界面ID, 本质是plotID + * + * @return 图表类型界面ID + */ + @Override + protected String getPlotTypeID() { + return VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID; + } + + protected Plot getSelectedClonedPlot(){ + VanChartColumnPlot newPlot = null; + Chart[] barChart = BarIndependentVanChart.BarVanChartTypes; + for(int i = 0, len = barChart.length; i < len; i++){ + if(typeDemo.get(i).isPressing){ + newPlot = (VanChartColumnPlot)barChart[i].getPlot(); + } + } + + Plot cloned = null; + try { + cloned = (Plot)newPlot.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In ColumnChart"); + } + return cloned; + } + + public Chart getDefaultChart() { + return BarIndependentVanChart.BarVanChartTypes[0]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java b/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java new file mode 100644 index 0000000000..91b36e90b5 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.bar; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.axis.bar.VanChartBarAxisPane; + +import java.util.List; + +/** + * Created by Mitisky on 16/6/8. + */ +public class VanChartBarStylePane extends VanChartStylePane { + public VanChartBarStylePane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected void createVanChartAxisPane(List paneList, VanChartAxisPlot plot) { + paneList.add(new VanChartBarAxisPane(plot, VanChartBarStylePane.this)); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/bar.png b/designer_chart/src/com/fr/plugin/chart/bar/images/bar.png new file mode 100644 index 0000000000..06191f7ac3 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/bar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/custom.png b/designer_chart/src/com/fr/plugin/chart/bar/images/custom.png new file mode 100644 index 0000000000..7356c36d86 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png b/designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png new file mode 100644 index 0000000000..608292e0ba Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/stack.png b/designer_chart/src/com/fr/plugin/chart/bar/images/stack.png new file mode 100644 index 0000000000..001650f7b0 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/stack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java new file mode 100644 index 0000000000..bd9f0695e2 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java @@ -0,0 +1,85 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane; +import com.fr.plugin.chart.designer.other.VanChartOtherPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI; + +/** + * Created by Mitisky on 16/3/31. + */ +public class BubbleIndependentVanChartInterface extends AbstractIndependentVanChartUI { + /** + * 图表的类型定义界面类型,就是属性表的第一个界面 + * + * @return 图表的类型定义界面类型 + */ + @Override + public AbstractChartTypePane getPlotTypePane() { + return new VanChartBubblePlotPane(); + } + + /** + * 图标路径 + * + * @return 图标路径 + */ + @Override + public String getIconPath() { + return "com/fr/design/images/form/toolbar/bubble.png"; + } + @Override + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new VanChartBubbleSeriesPane(parent, plot); + } + + @Override + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + if(((VanChartBubblePlot) plot).isForceBubble()){ + return super.getTableDataSourcePane(plot, parent); + } + return new VanChartBubblePlotTableDataContentPane(parent); + } + + @Override + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + if(((VanChartBubblePlot) plot).isForceBubble()){ + return super.getReportDataSourcePane(plot, parent); + } + return new BubblePlotReportDataContentPane(parent); + } + + /** + * 图表的属性界面数组 + * @return 属性界面 + */ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); + VanChartOtherPane otherPane = new VanChartOtherPane(){ + protected BasicBeanPane createInteractivePane() { + return new VanChartBubbleInteractivePane(); + } + }; + return new AbstractChartAttrPane[]{stylePane, otherPane}; + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new VanChartBubbleConditionPane(plot); + } + + public String getPlotTypeTitle4PopupWindow(){ + return VanChartBubblePlotPane.TITLE; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java new file mode 100644 index 0000000000..3623c24789 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java @@ -0,0 +1,94 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.base.AttrAlpha; +import com.fr.chart.base.AttrBackground; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; +import com.fr.plugin.chart.attr.EffectHelper; +import com.fr.plugin.chart.base.AttrEffect; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.other.condition.item.VanChartBubbleSetConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; +import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; +import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip; +import com.fr.plugin.chart.scatter.component.label.VanChartScatterLabelConditionPane; +import com.fr.plugin.chart.scatter.component.tooltip.VanChartScatterTooltipConditionPane; + +import java.awt.*; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartBubbleConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = -7180705321732069806L; + + public VanChartBubbleConditionPane(Plot plot) { + super(plot); + } + + protected void initComponents() { + super.initComponents(); + //添加全部条件属性后被遮挡 + liteConditionPane.setPreferredSize(new Dimension(300, 400)); + } + + private boolean forceBubble() { + return plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble(); + } + + @Override + protected ChartConditionPane createListConditionPane() { + return forceBubble() ? new ChartConditionPane() : new VanChartBubbleConditionSelectionPane(); + } + + @Override + protected void addBasicAction() { + classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); + classPaneMap.put(VanChartAttrBubble.class, new VanChartBubbleSetConditionPane(this)); + classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); + + if(forceBubble()){ + addForceAction(); + } else if(PlotFactory.largeDataModel(plot)){ + addLargeAction(); + } else { + addNormalAction(); + } + } + + private void addNormalAction() { + classPaneMap.put(ScatterAttrLabel.class, new VanChartScatterLabelConditionPane(this, plot)); + classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot)); + classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); + } + + private void addForceAction() { + classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); + classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); + classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); + } + + private void addLargeAction() { + classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot)); + } + + + protected void addStyleAction() { + } + + /** + * 返回图表class对象 + * @return class对象 + */ + public Class class4Correspond() { + return VanChartBubblePlot.class; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java new file mode 100644 index 0000000000..0ea9262e6a --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java @@ -0,0 +1,22 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; +import com.fr.plugin.chart.scatter.VanChartScatterDataPoint; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartBubbleConditionSelectionPane extends ChartConditionPane { + + + public String[] columns2Populate() { + return new String[]{ + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + VanChartScatterDataPoint.X, + VanChartScatterDataPoint.Y, + ChartConstants.VALUE + }; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java new file mode 100644 index 0000000000..62bcb60601 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java @@ -0,0 +1,27 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.chartattr.Plot; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartConstants; +import com.fr.plugin.chart.designer.other.VanChartInteractivePaneWithOutSort; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort { + protected String[] getNameArray() { + Plot plot = chart.getPlot(); + if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { + return new String[]{Inter.getLocText("Plugin-ChartF_XYAxis"), Inter.getLocText("Chart-Use_None")}; + } + return super.getNameArray(); + } + + protected String[] getValueArray() { + Plot plot = chart.getPlot(); + if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { + return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; + } + return super.getValueArray(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java new file mode 100644 index 0000000000..8987a6f9ac --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java @@ -0,0 +1,171 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.base.AttrAlpha; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartTools; +import com.fr.plugin.chart.base.VanChartZoom; +import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; +import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; +import com.fr.plugin.chart.vanchart.VanChart; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartBubblePlotPane extends AbstractVanChartTypePane { + public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBubble");; + + private static final long serialVersionUID = -3481633368542654247L; + + private static final float FORCE_ALPHA = 1.0f; + + private static final float ALPHA = 0.7f; + + @Override + protected String[] getTypeIconPath() { + return new String[]{"/com/fr/plugin/chart/bubble/images/bubble.png", + "/com/fr/plugin/chart/bubble/images/force.png" + }; + } + + @Override + protected String[] getTypeTipName() { + return new String[]{ + Inter.getLocText("FR-Chart-Chart_BubbleChart"), + Inter.getLocText("Plugin-ChartF_NewForceBubble") + }; + } + + /** + * 返回界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_NewBubble"); + } + + /** + * 更新界面内容 + */ + public void populateBean(Chart chart) { + for(ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + + + Plot plot = chart.getPlot(); + if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot)plot).isForceBubble()){ + lastTypeIndex = BubblePlotType.FORCE.ordinal(); + } else { + lastTypeIndex = BubblePlotType.NORMAL.ordinal(); + } + + typeDemo.get(lastTypeIndex).isPressing = true; + + checkDemosBackground(); + } + + private void removeDefaultAttr(ConditionAttr conditionAttr, Class targetClass) { + DataSeriesCondition attr = conditionAttr.getExisted(targetClass); + if (attr != null){ + conditionAttr.remove(targetClass); + } + } + + /** + * 获取各图表类型界面ID, 本质是plotID + * + * @return 图表类型界面ID + */ + @Override + protected String getPlotTypeID() { + return VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID; + } + + protected Plot getSelectedClonedPlot(){ + VanChartBubblePlot newPlot = null; + Chart[] bubbleChart = BubbleIndependentVanChart.BubbleVanChartTypes; + for(int i = 0, len = bubbleChart.length; i < len; i++){ + if(typeDemo.get(i).isPressing){ + newPlot = (VanChartBubblePlot)bubbleChart[i].getPlot(); + } + } + + Plot cloned = null; + try { + cloned = (Plot)newPlot.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In BubbleChart"); + } + return cloned; + } + + public Chart getDefaultChart() { + return BubbleIndependentVanChart.BubbleVanChartTypes[0]; + } + + @Override + /** + * 力學氣泡圖切換到其他氣泡圖時,刪除條件屬性 + * 并且将bubbleAttr属性重置 + */ + protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); + } + + @Override + protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + if (oldPlot.getConditionCollection() != null) { + ConditionCollection newCondition = new ConditionCollection(); + newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); + newPlot.setConditionCollection(newCondition); + + ConditionAttr attrList = newCondition.getDefaultAttr(); + + //根据气泡图类型,重设透明度属性 + removeDefaultAttr(attrList, AttrAlpha.class); + + //删除标签属性(防止切换到大数据气泡图标签属性会拷贝过去) + removeDefaultAttr(attrList, ScatterAttrLabel.class); + + AttrAlpha attrAlpha = new AttrAlpha(); + attrAlpha.setAlpha(((VanChartBubblePlot)newPlot).isForceBubble() ? FORCE_ALPHA : ALPHA); + + attrList.addDataSeriesCondition(attrAlpha); + } + } + + @Override + protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { + if(oldPlot instanceof VanChartBubblePlot && newPlot instanceof VanChartBubblePlot){ + if(((VanChartBubblePlot) oldPlot).isForceBubble() == ((VanChartBubblePlot) newPlot).isForceBubble()){ + super.cloneHotHyperLink(oldPlot, newPlot); + } + } + } + + @Override + protected VanChartTools createVanChartTools() { + VanChartTools tools = new VanChartTools(); + tools.setSort(false); + return tools; + } + + /** + * 气泡图相同图表类型之间切换的时候,chart的部分属性也需要重置 + * @param chart + */ + @Override + protected void resetChartAttr4SamePlot(Chart chart){ + VanChartZoom vanChartZoom = new VanChartZoom(); + ((VanChart)chart).setVanChartZoom(vanChartZoom); + //重置监控刷新选项 + resetRefreshMoreLabelAttr((VanChart)chart); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java new file mode 100644 index 0000000000..d64ae34b1c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java @@ -0,0 +1,92 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.general.Inter; +import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; +import com.fr.plugin.chart.bubble.component.VanChartBubblePane; +import com.fr.plugin.chart.custom.component.VanChartCustomAxisConditionPane; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.plugin.chart.designer.style.series.VanChartCustomStackAndAxisEditPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { + private static final long serialVersionUID = 5595016643808487932L; + private VanChartBubblePane bubblePane; + + public VanChartBubbleSeriesPane(ChartStylePane parent, Plot plot) { + super(parent, plot); + } + + protected JPanel getContentInPlotType() { + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p, p, p, p, p, p}; + double[] col = {f}; + + Component[][] components = new Component[][]{ + new Component[]{createBubblePane()}, + new Component[]{new JSeparator()}, + new Component[]{createStackedAndAxisPane()}, + new Component[]{createAlphaPane()}, + new Component[]{new JSeparator()}, + new Component[]{createLargeDataModelPane()} + + }; + + contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); + return contentPane; + } + + @Override + //堆积和坐标轴设置(自定义柱形图等用到) + protected JPanel createStackedAndAxisPane() { + stackAndAxisEditPane = new VanChartCustomStackAndAxisEditPane(){ + @Override + protected Class getStackAndAxisPaneClass() { + return VanChartCustomAxisConditionPane.class; + } + + @Override + protected String getPaneTitle(){ + return Inter.getLocText("Plugin-ChartF_Custom_Axis"); + } + }; + return stackAndAxisEditPane; + } + + private JPanel createBubblePane() { + bubblePane = new VanChartBubblePane(); + return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Bubble"), bubblePane); + } + + protected void populateCondition(ConditionAttr defaultAttr){ + super.populateCondition(defaultAttr); + if(bubblePane != null) { + VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + bubblePane.populateBean(attrBubble); + } + } + + protected void updateCondition(ConditionAttr defaultAttr){ + super.updateCondition(defaultAttr); + if(bubblePane != null){ + VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + if (attrBubble != null) { + defaultAttr.remove(attrBubble); + } + defaultAttr.addDataSeriesCondition(bubblePane.updateBean()); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java new file mode 100644 index 0000000000..e3e76be69b --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java @@ -0,0 +1,57 @@ +package com.fr.plugin.chart.bubble; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; +import com.fr.plugin.chart.bubble.force.VanChartForceBubbleAreaPane; +import com.fr.plugin.chart.bubble.force.VanChartForceBubbleLabelPane; +import com.fr.plugin.chart.bubble.force.VanChartForceBubbleTooltipPane; +import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; +import com.fr.plugin.chart.scatter.component.VanChartScatterStylePane; + +import java.util.List; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartBubbleStylePane extends VanChartScatterStylePane { + + public VanChartBubbleStylePane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected void createVanChartLabelPane(List paneList) { + Plot plot = getChart().getPlot(); + + if(((VanChartBubblePlot) plot).isForceBubble()){ + paneList.add(new VanChartForceBubbleLabelPane(VanChartBubbleStylePane.this)); + } else { + super.createVanChartLabelPane(paneList); + } + } + + protected void addVanChartTooltipPane(List paneList){ + Plot plot = getChart().getPlot(); + if(((VanChartBubblePlot) plot).isForceBubble()){ + paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this)); + } else { + super.addVanChartTooltipPane(paneList); + } + } + + @Override + protected void addVanChartAreaPane(List paneList) { + if (((VanChartBubblePlot)getChart().getPlot()).isForceBubble()){ + paneList.add(new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); + }else { + paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); + } + } + + @Override + protected ChartSeriesPane createChartSeriesPane() { + return new ChartSeriesPane(VanChartBubbleStylePane.this); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java b/designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java new file mode 100644 index 0000000000..208f8203d5 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java @@ -0,0 +1,74 @@ +package com.fr.plugin.chart.bubble.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/3/31. + * 气泡大小等设置界面 + */ +public class VanChartBubblePane extends BasicBeanPane { + private UISpinner minDiameter; + private UISpinner maxDiameter; + private UIButtonGroup shadow; + private UIButtonGroup displayNegative; + + public VanChartBubblePane(){ + minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); + maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); + shadow = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), + Inter.getLocText("Plugin-ChartF_Close")}); + displayNegative = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), + Inter.getLocText("Plugin-ChartF_Close")}); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p, p, p, p}; + double[] col = {p, f}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MinDiameter")), minDiameter}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MaxDiameter")), maxDiameter}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Shadow")), shadow}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DisplayNegative")), displayNegative}, + + }; + JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col); + + this.setLayout(new BorderLayout()); + this.add(content, BorderLayout.CENTER); + } + + public void populateBean(VanChartAttrBubble bubble) { + if(bubble == null){ + bubble = new VanChartAttrBubble(); + } + minDiameter.setValue(bubble.getMinDiameter()); + maxDiameter.setValue(bubble.getMaxDiameter()); + shadow.setSelectedIndex(bubble.isShadow() ? 0 : 1); + displayNegative.setSelectedIndex(bubble.isDisplayNegative() ? 0 : 1); + } + + public VanChartAttrBubble updateBean() { + VanChartAttrBubble bubble = new VanChartAttrBubble(); + bubble.setMinDiameter(minDiameter.getValue()); + bubble.setMaxDiameter(maxDiameter.getValue()); + bubble.setShadow(shadow.getSelectedIndex() == 0); + bubble.setDisplayNegative(displayNegative.getSelectedIndex() == 0); + return bubble; + } + + @Override + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_Bubble"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java new file mode 100644 index 0000000000..007a1490db --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java @@ -0,0 +1,184 @@ +package com.fr.plugin.chart.bubble.data; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.BubblePlot; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.BubbleTableDefinition; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.util.List; + +public class VanChartBubblePlotTableDataContentPane extends AbstractTableDataContentPane { + + private static final Dimension PREFERRED_SIZE = new Dimension(100, 20); + protected UIComboBox seriesName; + protected UIComboBox xCombox; + protected UIComboBox yCombox; + protected UIComboBox bubbleSize; + + private ChartDataFilterPane dataScreeningPane; + + public VanChartBubblePlotTableDataContentPane(ChartDataPane parent) { + seriesName = new UIComboBox(); + xCombox = new UIComboBox(); + yCombox = new UIComboBox(); + + dataScreeningPane = new ChartDataFilterPane(new BubblePlot(), parent); + + seriesName.setPreferredSize(PREFERRED_SIZE); + xCombox.setPreferredSize(PREFERRED_SIZE); + yCombox.setPreferredSize(PREFERRED_SIZE); + + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + + initBubbleSize(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = { p, p,p,p}; + + double[] columnSize_north = {p, f}; + double[] rowSize_north = {p, p, p, p}; + + Component[][] components_north = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Chart-Series_Name")+":", SwingConstants.RIGHT), seriesName}, + new Component[]{new UILabel("x :", SwingConstants.RIGHT), xCombox}, + new Component[]{new UILabel("y :", SwingConstants.RIGHT), yCombox}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart_Bubble_Size")+":", SwingConstants.RIGHT), bubbleSize}, + }; + + JPanel north = TableLayoutHelper.createTableLayoutPane(components_north,rowSize_north,columnSize_north); + north.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); + + Component[][] components = new Component[][]{ + new Component[]{north}, + new Component[]{new JSeparator()}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, + new Component[]{dataScreeningPane} + }; + + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.CENTER); + + seriesName.addItemListener(tooltipListener); + xCombox.addItemListener(tooltipListener); + yCombox.addItemListener(tooltipListener); + bubbleSize.addItemListener(tooltipListener); + } + + protected void initBubbleSize() { + bubbleSize = new UIComboBox(); + bubbleSize.setPreferredSize(new Dimension(100, 20)); + } + + /** + * 检查box是否使用, donothing + * @param hasUse 是否使用. + */ + public void checkBoxUse(boolean hasUse) { + + } + + protected void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(seriesName, list); + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + refreshBoxItems(xCombox, list); + refreshBoxItems(yCombox, list); + refreshBoxItems(bubbleSize, list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(seriesName); + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + clearBoxItems(xCombox); + clearBoxItems(yCombox); + clearBoxItems(bubbleSize); + } + + @Override + public void populateBean(ChartCollection collection) { + super.populateBean(collection); + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); + if (!(top instanceof BubbleTableDefinition)) { + return; + } + BubbleTableDefinition definition = (BubbleTableDefinition) top; + + if(definition.getSeriesName() == null || ComparatorUtils.equals(StringUtils.EMPTY, definition.getSeriesName())) { + seriesName.setSelectedItem(Inter.getLocText("Chart-Use_None")); + } else { + combineCustomEditValue(seriesName, definition.getSeriesName()); + } + + combineCustomEditValue(xCombox, definition.getBubbleX()); + combineCustomEditValue(yCombox, definition.getBubbleY()); + //气泡图不配置“无” + populateBubbleSize(definition); + + dataScreeningPane.populateBean(collection); + } + + protected void populateBubbleSize(BubbleTableDefinition definition) { + if (ComparatorUtils.equals(definition.getBubbleSize(), Inter.getLocText("Chart-Use_None"))){ + combineCustomEditValue(bubbleSize, StringUtils.EMPTY); + }else { + combineCustomEditValue(bubbleSize, definition.getBubbleSize()); + } + } + + @Override + public void updateBean(ChartCollection collection) { + BubbleTableDefinition definition = new BubbleTableDefinition(); + collection.getSelectedChart().setFilterDefinition(definition); + + Object resultName = seriesName.getSelectedItem(); + Object resultX = xCombox.getSelectedItem(); + Object resultY = yCombox.getSelectedItem(); + Object resultSize = bubbleSize.getSelectedItem(); + + if(resultName == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultName)) { + definition.setSeriesName(StringUtils.EMPTY); + } else { + definition.setSeriesName(resultName.toString()); + } + + if (resultX != null) { + definition.setBubbleX(resultX.toString()); + } + if (resultY != null) { + definition.setBubbleY(resultY.toString()); + } + if (resultSize != null) { + definition.setBubbleSize(resultSize.toString()); + } + + dataScreeningPane.updateBean(collection); + } + + /** + * 重新布局 + */ + public void redoLayoutPane(){ + dataScreeningPane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java new file mode 100644 index 0000000000..5db33768ce --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java @@ -0,0 +1,28 @@ +package com.fr.plugin.chart.bubble.force; + +import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.bubble.VanChartBubblePlot; +import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane; +import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; +import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane; + +/** + * Created by mengao on 2017/6/12. + */ +public class VanChartBubbleRefreshTooltipPane extends VanChartPlotRefreshTooltipPane { + + public VanChartBubbleRefreshTooltipPane(Plot plot) { + super(plot); + } + + @Override + protected VanChartTooltipContentPane getTooltipContentPane(Plot plot){ + if (((VanChartBubblePlot)plot).isForceBubble()) { + return new VanChartRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this); + } else { + return new VanChartScatterRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this); + } + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java new file mode 100644 index 0000000000..39e0b57deb --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.bubble.force; + +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane; + +import java.awt.*; + +//图表区|绘图区 边框和背景 +public class VanChartForceBubbleAreaBackgroundPane extends VanChartAreaBackgroundPane { + + + public VanChartForceBubbleAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) { + super(isPlot, parent); + } + + @Override + protected Component[][] initComponents() { + return new Component[][]{ + new Component[]{chartBorderPane}, + new Component[]{chartBackgroundPane}, + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java new file mode 100644 index 0000000000..1e5c780f7e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java @@ -0,0 +1,26 @@ +package com.fr.plugin.chart.bubble.force; + +import com.fr.chart.chartattr.Plot; + +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; + + +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; + + +/** + * 属性表, 图表样式-背景界面. + */ +public class VanChartForceBubbleAreaPane extends VanChartAreaPane { + + public VanChartForceBubbleAreaPane(Plot plot, VanChartStylePane parent) { + super(plot, parent); + } + + @Override + protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { + plotPane = new VanChartForceBubbleAreaBackgroundPane(true, parent); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java new file mode 100644 index 0000000000..4886c9f1dd --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java @@ -0,0 +1,19 @@ +package com.fr.plugin.chart.bubble.force; + +import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.label.VanChartLabelPane; +import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartForceBubbleLabelPane extends VanChartLabelPane { + public VanChartForceBubbleLabelPane(VanChartStylePane parent) { + super(parent); + } + + protected VanChartPlotLabelPane getLabelPane(Plot plot) { + return new VanChartPlotLabelPane(plot, parent); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java new file mode 100644 index 0000000000..67f1412aa6 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java @@ -0,0 +1,18 @@ +package com.fr.plugin.chart.bubble.force; + +import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartTooltipPane; + +/** + * Created by Mitisky on 16/3/31. + */ +public class VanChartForceBubbleTooltipPane extends VanChartTooltipPane { + public VanChartForceBubbleTooltipPane(VanChartStylePane parent) { + super(parent); + } + protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { + return new VanChartPlotTooltipPane(plot, parent); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png b/designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png new file mode 100644 index 0000000000..86853335dd Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/images/force.png b/designer_chart/src/com/fr/plugin/chart/bubble/images/force.png new file mode 100644 index 0000000000..d6a7304a30 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bubble/images/force.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/images/large.png b/designer_chart/src/com/fr/plugin/chart/bubble/images/large.png new file mode 100644 index 0000000000..d6301bc690 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bubble/images/large.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java b/designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java new file mode 100644 index 0000000000..a955618fba --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java @@ -0,0 +1,43 @@ +package com.fr.plugin.chart.column; + +import com.fr.design.chart.comp.BorderAttriPane; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; + +import java.awt.*; + +/** + * Created by hufan on 2016/8/11. + */ +public class ColumnBorderAttriPane extends BorderAttriPane { + private UISpinner radius; + + public ColumnBorderAttriPane() { + this(Inter.getLocText("plugin-ChartF_Radius")); + } + + public ColumnBorderAttriPane(String radiusString) { + this.add(new UILabel(radiusString + ":")); + radius = new UISpinner(0,1000,1,0); + this.add(radius); + radius.setPreferredSize(new Dimension(60, 18)); + } + + public void setRadius(int value) { + this.radius.setValue(value); + } + + public double getRadius() { + return this.radius.getValue(); + } + + @Override + protected String title4PopupWindow() { + return "Border"; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java new file mode 100644 index 0000000000..04aaa070f4 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java @@ -0,0 +1,36 @@ +package com.fr.plugin.chart.column; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; + +/** + * Created by Mitisky on 15/9/24. + */ +public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { + @Override + public String getIconPath() { + return "com/fr/design/images/form/toolbar/column.png"; + } + + @Override + public AbstractChartTypePane getPlotTypePane() { + return new VanChartColumnPlotPane(); + } + + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new VanChartColumnConditionPane(plot); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new VanChartColumnSeriesPane(parent, plot); + } + + public String getPlotTypeTitle4PopupWindow(){ + return VanChartColumnPlotPane.TITLE; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java new file mode 100644 index 0000000000..86421dd6b0 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java @@ -0,0 +1,93 @@ +package com.fr.plugin.chart.column; + +import com.fr.chart.base.AttrAlpha; +import com.fr.chart.base.AttrBackground; +import com.fr.chart.base.AttrBorder; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; +import com.fr.plugin.chart.attr.EffectHelper; +import com.fr.plugin.chart.base.AttrDataSheet; +import com.fr.plugin.chart.base.AttrEffect; +import com.fr.plugin.chart.base.AttrFloatColor; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrSeriesImageBackground; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.base.VanChartAttrTrendLine; +import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartFloatColorConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesImageBackgroundConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; +import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane; +import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint; + +import java.awt.*; + +/** + * Created by Mitisky on 15/9/28. + */ +public class VanChartColumnConditionPane extends DataSeriesConditionPane{ + private static final long serialVersionUID = -7180705321732069806L; + + public VanChartColumnConditionPane(Plot plot) { + super(plot); + } + + protected void initComponents() { + super.initComponents(); + //添加全部条件属性后被遮挡 + liteConditionPane.setPreferredSize(new Dimension(300, 400)); + } + + @Override + protected void addBasicAction() { + classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); + classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); + classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this)); + classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); + classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this)); + classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); + classPaneMap.put(AttrSeriesImageBackground.class, new VanChartSeriesImageBackgroundConditionPane(this)); + classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getColumnPlotDefaultEffect())); + classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); + //是否使用数据表 + //自定义柱形图设置多X坐标轴时,不支持数据表 + if (plot.getDataSheet().isVisible() && ((VanChartColumnPlot) plot).getXAxisList().size() == 1) { + classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot)); + } + } + + protected void addStyleAction() { + + } + + @Override + protected ChartConditionPane createListConditionPane() { + return new ChartConditionPane(){ + @Override + public String[] columns2Populate() { + return new String[]{ + ChartConstants.CATEGORY_INDEX, + ChartConstants.CATEGORY_NAME, + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + ChartConstants.VALUE, + VanChartMultiCategoryDataPoint.CATEGORY_ARRAY, + }; + } + }; + } + + /** + * 返回图表class对象 + * @return class对象 + */ + public Class class4Correspond() { + return VanChartColumnPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java new file mode 100644 index 0000000000..6dc0f3ccd1 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java @@ -0,0 +1,34 @@ +package com.fr.plugin.chart.column; +import com.fr.chart.base.AttrBorder; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.chart.comp.BorderAttriPane; +import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; +import com.fr.design.condition.ConditionAttributesPane; + +/** + * Created by hufan on 2016/8/11. + */ +public class VanChartColumnLabelBorderPane extends LabelBorderPane { + public VanChartColumnLabelBorderPane(ConditionAttributesPane conditionAttributesPane) { + super(conditionAttributesPane); + } + + @Override + protected BorderAttriPane initBorderAttrPane(){ + return new ColumnBorderAttriPane(); + } + + public void populate(DataSeriesCondition condition) { + super.populate(condition); + if (condition instanceof AttrBorder) { + ((ColumnBorderAttriPane)linePane).setRadius(attrBorder.getRoundRadius()); + } + } + + public DataSeriesCondition update() { + super.update(); + attrBorder.setRoundRadius((int) ((ColumnBorderAttriPane)linePane).getRadius()); + attrBorder.setRoundBorder(true); + return attrBorder; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java new file mode 100644 index 0000000000..978823b573 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java @@ -0,0 +1,96 @@ +package com.fr.plugin.chart.column; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; + +/** + * Created by Mitisky on 15/9/24. + */ +public class VanChartColumnPlotPane extends AbstractVanChartTypePane { + public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewColumn"); + + private static final long serialVersionUID = 5950923001789733745L; + + + @Override + protected String[] getTypeIconPath() { + return new String[]{"/com/fr/plugin/chart/column/images/column.png", + "/com/fr/plugin/chart/column/images/stack.png", + "/com/fr/plugin/chart/column/images/percentstack.png", + "/com/fr/plugin/chart/column/images/custom.png", + }; + } + + @Override + protected String[] getTypeTipName() { + String column = Inter.getLocText("FR-Chart-Type_Column"); + String stack = Inter.getLocText("FR-Chart-Type_Stacked"); + String percent = Inter.getLocText("FR-Chart-Use_Percent"); + return new String[]{ + column, + stack + column, + percent + stack + column, + Inter.getLocText("FR-Chart-Mode_Custom") + }; + } + + /** + * 返回界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_NewColumn"); + } + + /** + * 更新界面内容 + */ + public void populateBean(Chart chart) { + for(ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + Plot plot = chart.getPlot(); + if(plot instanceof VanChartColumnPlot) { + lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal(); + typeDemo.get(lastTypeIndex).isPressing = true; + } + checkDemosBackground(); + } + + /** + * 获取各图表类型界面ID, 本质是plotID + * + * @return 图表类型界面ID + */ + @Override + protected String getPlotTypeID() { + return VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID; + } + + protected Plot getSelectedClonedPlot(){ + VanChartColumnPlot newPlot = null; + Chart[] columnChart = ColumnIndependentVanChart.ColumnVanChartTypes; + for(int i = 0, len = columnChart.length; i < len; i++){ + if(typeDemo.get(i).isPressing){ + newPlot = (VanChartColumnPlot)columnChart[i].getPlot(); + } + } + + Plot cloned = null; + try { + cloned = (Plot)newPlot.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In ColumnChart"); + } + return cloned; + } + + public Chart getDefaultChart() { + return ColumnIndependentVanChart.ColumnVanChartTypes[0]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java new file mode 100644 index 0000000000..cb418b1635 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java @@ -0,0 +1,194 @@ +package com.fr.plugin.chart.column; + +import com.fr.base.background.ImageBackground; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.AttrSeriesImageBackground; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.designer.component.border.VanChartBorderPane; +import com.fr.plugin.chart.designer.component.border.VanChartBorderWithRadiusPane; +import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.stable.Constants; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 新条形图系列界面 + */ +public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { + + private static final long serialVersionUID = -8875943419420081420L; + private UIButtonGroup isFixedWidth;//是否固定宽度 + private UISpinner columnWidth;//宽度 + + private UINumberDragPane categoryGap;//分类间隔 + private UINumberDragPane seriesGap;//系列间隔 + private UIButtonGroup isFillWithImage;//是否使用图片填充 + private ImageBackgroundQuickPane imagePane;//填充图片选择界面 + + public VanChartColumnSeriesPane(ChartStylePane parent, Plot plot) { + super(parent, plot); + } + + protected JPanel getContentInPlotType() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{createStylePane()}, + new Component[]{stylePane == null ? null : new JSeparator()}, + new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{p,f})}, + new Component[]{new JSeparator()}, + new Component[]{createBorderPane()}, + new Component[]{createStackedAndAxisPane()}, + new Component[]{createTrendLinePane()}, + }; + + contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + return contentPane; + } + + //边框(有圆角) + protected VanChartBorderPane createDiffBorderPane() { + return new VanChartBorderWithRadiusPane(); + } + + private JPanel createSeriesStylePane(double[] row, double[] col) { + isFixedWidth = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); + columnWidth = new UISpinner(0,1000,1,0); + seriesGap = new UINumberDragPane(-100, 100); + categoryGap = new UINumberDragPane(0, 100); + isFillWithImage = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); + imagePane = new ImageBackgroundQuickPane(false); + + Component[][] components1 = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Fixed_Column_Width")),isFixedWidth}, + new Component[]{null,columnWidth}, + }; + JPanel panel1 = TableLayoutHelper.createTableLayoutPane(components1, row, col); + + Component[][] components2 = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Series")),seriesGap}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Category")),categoryGap}, + }; + JPanel panel2 = TableLayoutHelper.createTableLayoutPane(components2, row, col); + + Component[][] components3 = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Filled_With_Image")),isFillWithImage}, + }; + JPanel panel3 = TableLayoutHelper.createTableLayoutPane(components3, row, col); + + JPanel panel = new JPanel(new BorderLayout(0, 4)); + panel.add(panel1, BorderLayout.NORTH); + panel.add(panel2, BorderLayout.CENTER); + panel.add(panel3, BorderLayout.SOUTH); + + JPanel borderPane = new JPanel(new BorderLayout()); + borderPane.add(panel, BorderLayout.NORTH); + borderPane.add(imagePane, BorderLayout.CENTER); + isFixedWidth.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkColumnWidth(); + } + }); + isFillWithImage.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkImagePane(); + } + }); + return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), borderPane); + } + + private void checkAll() { + checkColumnWidth(); + checkImagePane(); + } + + private void checkColumnWidth() { + columnWidth.setEnabled(isFixedWidth.getSelectedIndex() == 0); + } + + private void checkImagePane() { + GUICoreUtils.setEnabled(imagePane, isFillWithImage.getSelectedIndex() == 0); + } + + public void populateBean(Plot plot) { + if(plot == null) { + return; + } + super.populateBean(plot); + + if(plot instanceof VanChartColumnPlot){ + VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot; + + isFixedWidth.setSelectedIndex(columnPlot4VanChart.isFixedWidth() ? 0 : 1); + columnWidth.setValue(columnPlot4VanChart.getColumnWidth()); + categoryGap.populateBean(columnPlot4VanChart.getCategoryIntervalPercent()); + seriesGap.populateBean(columnPlot4VanChart.getSeriesOverlapPercent()); + isFillWithImage.setSelectedIndex(columnPlot4VanChart.isFilledWithImage() ? 0 : 1); + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + + if(columnPlot4VanChart.isFilledWithImage()){ + AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); + if(attrSeriesImageBackground != null){ + imagePane.populateBean(attrSeriesImageBackground.getSeriesBackground()); + } + } + } + checkAll(); + } + + public void updateBean(Plot plot) { + if(plot == null) { + return; + } + super.updateBean(plot); + + if(plot instanceof VanChartColumnPlot){ + VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot; + + columnPlot4VanChart.setFixedWidth(isFixedWidth.getSelectedIndex() == 0); + columnPlot4VanChart.setColumnWidth((int)columnWidth.getValue()); + columnPlot4VanChart.setCategoryIntervalPercent(categoryGap.updateBean()); + columnPlot4VanChart.setSeriesOverlapPercent(seriesGap.updateBean()); + columnPlot4VanChart.setFilledWithImage(isFillWithImage.getSelectedIndex() == 0); + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + if(isFillWithImage.getSelectedIndex() == 0){ + AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); + if(attrSeriesImageBackground == null){ + attrSeriesImageBackground = new AttrSeriesImageBackground(); + defaultAttr.addDataSeriesCondition(attrSeriesImageBackground); + } + attrSeriesImageBackground.setSeriesBackground(imagePane.updateBean()); + //设置背景图片平铺方式 + ImageBackground imageBackground = (ImageBackground) attrSeriesImageBackground.getSeriesBackground(); + if (imageBackground != null){ + imageBackground.setLayout(Constants.IMAGE_TILED); + } + + } else { + AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); + if(attrSeriesImageBackground != null){ + defaultAttr.remove(attrSeriesImageBackground); + } + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java new file mode 100644 index 0000000000..dfb8664e88 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -0,0 +1,143 @@ +package com.fr.plugin.chart.column; + +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.data.condition.AbstractCondition; +import com.fr.data.condition.ListCondition; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.LiteConditionPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; +import com.fr.plugin.chart.designer.style.series.VanChartSeriesConditionPane; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 堆积和坐标轴设置 + */ +public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane { + private static final long serialVersionUID = 2713124322060048526L; + + protected UIButtonGroup XAxis; + protected UIButtonGroup YAxis; + protected UIButtonGroup isStacked; + protected UIButtonGroup isPercentStacked; + + private LiteConditionPane liteConditionPane; + + public VanChartCustomStackAndAxisConditionPane(){ + + } + + private void doLayoutPane(){ + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + //配置界面 + JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.add(deployPane); + + deployPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Plugin-ChartF_Deploy") + ":", null)); + deployPane.add(createDeployPane()); + + //条件界面 + JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.add(conditionPane); + conditionPane.setBorder(BorderFactory.createEmptyBorder()); + + conditionPane.add(liteConditionPane = new VanChartSeriesConditionPane()); + liteConditionPane.setPreferredSize(new Dimension(300, 300)); + } + + private JPanel createDeployPane() + { + isStacked = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); + isPercentStacked = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); + double p = TableLayout.PREFERRED; + double[] columnSize = {p,p}; + double[] rowSize = {p,p,p,p}; + + return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize); + } + + protected Component[][] getDeployComponents() { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis}, + new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Type_Stacked")),isStacked}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")),isPercentStacked}, + }; + + isStacked.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkBox(); + } + }); + return components; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_StackAndSeries"); + } + + private void checkBox() { + isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0); + } + + public void populateBean(ConditionAttr conditionAttr){ + AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class); + XAxis = new UIButtonGroup(seriesStackAndAxis.getXAxisNamesArray()); + YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); + + doLayoutPane(); + XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex()); + YAxis.setSelectedIndex(seriesStackAndAxis.getYAxisIndex()); + isStacked.setSelectedIndex(seriesStackAndAxis.isStacked() ? 0 : 1); + isPercentStacked.setSelectedIndex(seriesStackAndAxis.isPercentStacked() ? 0 : 1); + + if (conditionAttr.getCondition() == null) { + this.liteConditionPane.populateBean(new ListCondition()); + } else { + this.liteConditionPane.populateBean(conditionAttr.getCondition()); + } + + checkBox(); + } + + public void updateBean(ConditionAttr conditionAttr){ + AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class); + + seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex()); + seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex()); + + updateStackAndPercent(seriesStackAndAxis); + + AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean(); + conditionAttr.setCondition(con); + } + + protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) { + seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0); + if(seriesStackAndAxis.isStacked()){ + seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0); + } else { + seriesStackAndAxis.setPercentStacked(false); + } + } + + public ConditionAttr updateBean(){ + ConditionAttr conditionAttr = new ConditionAttr(); + updateBean(conditionAttr); + return conditionAttr; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/column.png b/designer_chart/src/com/fr/plugin/chart/column/images/column.png new file mode 100644 index 0000000000..4561cf945b Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/column.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/custom.png b/designer_chart/src/com/fr/plugin/chart/column/images/custom.png new file mode 100644 index 0000000000..6a8c71f8d6 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png b/designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png new file mode 100644 index 0000000000..ee380e28e8 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/stack.png b/designer_chart/src/com/fr/plugin/chart/column/images/stack.png new file mode 100644 index 0000000000..ef43ac2587 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/stack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java new file mode 100644 index 0000000000..473cdbce92 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java @@ -0,0 +1,56 @@ +package com.fr.plugin.chart.custom; + +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.custom.other.VanChartCustomOtherPane; +import com.fr.plugin.chart.custom.style.VanChartCustomStylePane; +import com.fr.plugin.chart.designer.other.VanChartOtherPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI; + +/** + * Created by Mitisky on 16/2/16. + */ +public class CustomIndependentVanChartInterface extends AbstractIndependentVanChartUI { + /** + * 图表的类型定义界面类型,就是属性表的第一个界面 + * + * @return 图表的类型定义界面类型 + */ + @Override + public AbstractChartTypePane getPlotTypePane() { + return new VanChartCustomPlotPane(); + } + + /** + * 图标路径 + * + * @return 图标路径 + */ + @Override + public String getIconPath() { + return "com/fr/design/images/form/toolbar/custom.png"; + } + + + @Override + /** + * 图表的属性界面数组 + * @return 属性界面 + */ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + VanChartStylePane stylePane = new VanChartCustomStylePane(listener); + VanChartOtherPane otherPane = new VanChartCustomOtherPane(); + return new AbstractChartAttrPane[]{stylePane, otherPane}; + } + + public ChartDataPane getChartDataPane(AttributeChangeListener listener){ + return new VanChartCustomDataPane(listener); + } + + public String getPlotTypeTitle4PopupWindow(){ + return VanChartCustomPlotPane.TITLE; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java b/designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java new file mode 100644 index 0000000000..b4f4138a4c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java @@ -0,0 +1,134 @@ +package com.fr.plugin.chart.custom; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.general.FRLogger; +import com.fr.plugin.chart.PiePlot4VanChart; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.bubble.VanChartBubblePlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.component.CustomPlotLocationPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane; +import com.fr.plugin.chart.scatter.data.VanChartScatterPlotTableDataContentPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; +import com.fr.plugin.chart.designer.style.axis.gauge.VanChartGaugeAxisPane; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.radar.VanChartRadarPlot; +import com.fr.plugin.chart.scatter.VanChartScatterPlot; + +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Mitisky on 16/6/23. + */ +public class CustomPlotDesignerPaneFactory { + + //图表类型对应数据配置界面 + private static Map, Class> plotTableDataContentPaneMap = new HashMap, Class>(); + + + + + //图表类型对应的位置面板 + private static Map, Class>> plotPositionMap = new HashMap, Class>>(); + + static { + plotPositionMap.put(PiePlot4VanChart.class, CustomPlotLocationPane.class); + plotPositionMap.put(VanChartRadarPlot.class, CustomPlotLocationPane.class); + plotPositionMap.put(VanChartGaugePlot.class, CustomPlotLocationPane.class); + } + + /** + * 根据图表类型创建位置面板 + * @param plot 图表 + * @return 位置面板 + */ + public static BasicBeanPane createCustomPlotPositionPane(Plot plot) { + Class key = plot.getClass(); + if(plotPositionMap.containsKey(key)){ + try{ + Class> cl = plotPositionMap.get(key); + Constructor > constructor = cl.getConstructor(); + return constructor.newInstance(); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return null; + } + + + /** + * 每种类型对应的数据配置界面 + * @return + */ + static { + plotTableDataContentPaneMap.put(VanChartScatterPlot.class, VanChartScatterPlotTableDataContentPane.class); + plotTableDataContentPaneMap.put(VanChartBubblePlot.class, VanChartBubblePlotTableDataContentPane.class); + } + + /** + * 根据图表类型创建数据配置 + * @param plot 图表 + * @param parent + * @return 数据配置界面 + */ + public static AbstractTableDataContentPane createCustomPlotTableDataContentPane(Plot plot, ChartDataPane parent) { + Class key = plot.getClass(); + if(plotTableDataContentPaneMap.containsKey(key)){ + try{ + Class cl = plotTableDataContentPaneMap.get(key); + Constructor constructor = cl.getConstructor(ChartDataPane.class); + return constructor.newInstance(parent); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new CategoryPlotTableDataContentPane(parent); + } + + + /** + * plotType是否需要建立新的坐标系面板 + */ + private static Map> diffAxisMap = new HashMap>(); + static { + diffAxisMap.put(CustomPlotType.POINTER_360, VanChartGaugeAxisPane.class); + diffAxisMap.put(CustomPlotType.POINTER_180, VanChartGaugeAxisPane.class); + diffAxisMap.put(CustomPlotType.RING, VanChartGaugeAxisPane.class); + diffAxisMap.put(CustomPlotType.SLOT, VanChartGaugeAxisPane.class); + diffAxisMap.put(CustomPlotType.CUVETTE, VanChartGaugeAxisPane.class); + diffAxisMap.put(CustomPlotType.RADAR, null);//默认的为null,直接new,不用反射 + diffAxisMap.put(CustomPlotType.STACK_RADAR, null); + } + + public static Boolean isUseDiffAxisPane(VanChartPlot plot){ + CustomPlotType customPlotType = CustomPlotFactory.getCustomType(plot); + return diffAxisMap.containsKey(customPlotType); + } + + public static VanChartAxisPane createAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) { + CustomPlotType key = CustomPlotFactory.getCustomType((VanChartPlot)plot); + if(diffAxisMap.containsKey(key)){ + try{ + Class cl = diffAxisMap.get(key); + if(cl != null) { + Constructor constructor = cl.getConstructor(VanChartAxisPlot.class, VanChartStylePane.class); + return constructor.newInstance(plot, parent); + } + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartAxisPane(plot,parent); + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java new file mode 100644 index 0000000000..73a95537a3 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java @@ -0,0 +1,66 @@ +package com.fr.plugin.chart.custom; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/29. + */ +public class VanChartCustomDataPane extends ChartDataPane { + private VanChartCustomPlotDataContentsTabPane contentsTabPane; + private Chart chart; + public VanChartCustomDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected JPanel createContentPane() { + JPanel content = new JPanel(new BorderLayout()); + if (chart == null) { + return content; + } + + contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener); + + content.add(contentsTabPane, BorderLayout.CENTER); + return content; + + + } + + public void populate(ChartCollection collection) { + this.chart = collection.getSelectedChart(); + this.remove(leftContentPane); + initContentPane(); + this.removeAttributeChangeListener(); + contentsTabPane.populateBean(collection); + this.addAttributeChangeListener(listener); + this.initAllListeners(); + + } + + @Override + /** + * 返回绑定的属性事件. + * @param listener 增加监听 + */ + public void addAttributeChangeListener(AttributeChangeListener listener) { + super.addAttributeChangeListener(listener); + contentsTabPane.addAttributeChangeListener(listener); + } + + @Override + /** + * 保存 数据界面内容 + */ + public void update(ChartCollection collection){ + if(contentsTabPane != null) { + contentsTabPane.updateBean(collection); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java new file mode 100644 index 0000000000..f3c91a3a71 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java @@ -0,0 +1,175 @@ +package com.fr.plugin.chart.custom; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.component.VanChartDataPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by Fangjie on 2016/4/29. + */ +public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { + super(plot, parent, listener); + } + + @Override + protected void initTabTitle() { + + if (plot == null){ + return; + } + + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + } + } + + @Override + protected List initPaneList() { + + if (plot == null){ + return null; + } + + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + ChartDataPane contentPane = new VanChartDataPane(listener); + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(ChartCollection chartCollection){ + + plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot(); + + if (paneList == null){ + paneList = initPaneList(); + } + + if (paneList != null){ + + try { + + List customPlotList = plot.getCustomPlotList(); + + + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { + //將plot包裝起来,主要是为了获取dataDefinition + ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); + + //设置collection的plot + cloneCollection.getSelectedChart().setPlot(customPlotList.get(i)); + + //获取definitionMap中的dataDefinition + TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition(); + TopDefinitionProvider dataDefinition = null; + if (definition != null && definition instanceof CustomDefinition) { + Map definitionProviderMap = ((CustomDefinition)definition).getDefinitionProviderMap(); + dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i))); + } + cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition); + + ((ChartDataPane) paneList.get(i)).populate(cloneCollection); + } + }catch (Exception e){ + return; + } + } + } + + @Override + public ChartCollection updateBean() { + return null; + } + + @Override + public void updateBean(ChartCollection collection){ + if (paneList == null || plot == null){ + return; + } + try { + + Map definitionMap = new HashMap(); + + //已经有的数据配置不允许重置 + + for (int i = 0; i < paneList.size() && i < plot.getCustomPlotList().size(); i++) { + //将plot包裝起来,主要是为了获取dataDefinition + ChartCollection cloneCollection = (ChartCollection) collection.clone(); + + //设置Collection的plot + cloneCollection.getSelectedChart().setPlot(plot.getCustomPlotList().get(i)); + + //重置 + cloneCollection.getSelectedChart().setFilterDefinition(null); + + //更新 + ((ChartDataPane) paneList.get(i)).update(cloneCollection); + + CustomPlotFactory.setCustomCategoryAttr(plot); + + //将处理好的dataDefinition剥离出来并存储 + definitionMap.put(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i)), cloneCollection.getSelectedChart().getFilterDefinition()); + + } + + CustomDefinition customDefinition = new CustomDefinition(); + customDefinition.setDefinitionProviderMap(definitionMap); + collection.getSelectedChart().setFilterDefinition(customDefinition); + + }catch (Exception e){ + return; + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } + + /** + * 返回绑定的属性事件. + * @param listener 增加监听 + */ + public void addAttributeChangeListener(AttributeChangeListener listener) { + for (int i = 0; i < paneList.size(); i++){ + ((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java new file mode 100644 index 0000000000..94be28fd21 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java @@ -0,0 +1,296 @@ +package com.fr.plugin.chart.custom; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartTools; +import com.fr.plugin.chart.base.VanChartAttrLine; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotSelectPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.awt.*; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Mitisky on 16/2/16. + */ +public class VanChartCustomPlotPane extends AbstractVanChartTypePane { + public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewCustom"); + + //是否选择自定义 + private boolean isCustom = false; + + private static final long serialVersionUID = -3481633368542654247L; + + //切换到自定义组合图时,显示的版面 + private JPanel customPane; + private VanChartCustomPlotSelectPane customSelectPane; + + private JPanel autoPane; + + //自定义和自动版面的容器,cardLayOut布局 + private JPanel contentPane; + + protected Component[][] getPaneComponents(JPanel typePane){ + + initContent(); + + return new Component[][]{ + new Component[]{typePane}, + new Component[]{stylePane}, + new Component[]{contentPane} + }; + } + + + private void initContent() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + autoPane = new JPanel(); + + customSelectPane = new VanChartCustomPlotSelectPane(); + + Component[][] components = new Component[][]{ + new Component[]{new JSeparator()}, + new Component[]{customSelectPane} + }; + + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + customPane = TableLayoutHelper.createTableLayoutPane(components, rowSize , columnSize); + + contentPane = new JPanel(new CardLayout()){ + @Override + public Dimension getPreferredSize() { + if(isCustom){ + return customPane.getPreferredSize(); + } else{ + return new Dimension(autoPane.getWidth(), 0); + } + } + }; + contentPane.add(autoPane, "auto"); + contentPane.add(customPane, "custom"); + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) contentPane.getLayout(); + if (isCustom) { + cardLayout.show(contentPane, "custom"); + } else { + cardLayout.show(contentPane, "auto"); + } + } + + + + @Override + protected String[] getTypeIconPath() { + return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png", + "/com/fr/plugin/chart/custom/images/column_area.png", + "/com/fr/plugin/chart/custom/images/stack_column_line.png", + "/com/fr/plugin/chart/custom/images/custom.png", + + }; + } + + @Override + protected String[] getTypeTipName() { + return new String[]{ + Inter.getLocText("Plugin-ChartF_NewCustom_ColumnLine"), + Inter.getLocText("Plugin-ChartF_NewCustom_ColumnArea"), + Inter.getLocText("Plugin-ChartF_NewCustom_StackColumnLine"), + Inter.getLocText("Plugin-ChartF_NewCustom_Custom") + }; + } + + @Override + /** + * 返回界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_NewCustom"); + } + + + @Override + public void updateBean(Chart chart) { + + //保存上次选中的值,其会在super中更新 + int lastState = lastTypeIndex; + + super.updateBean(chart); + + //如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置 + if (lastState != lastTypeIndex) { + chart.setFilterDefinition(null); + } + + Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; + for(int i = 0, len = customChart.length; i < len; i++){ + if(typeDemo.get(i).isPressing){ + if (i == customChart.length-1){ + isCustom = true; + + //先重置自定义组合面板,如果不重置,无法获取选择顺序 + if (lastState == customChart.length-1 && samePlot) { + //更新数据配置,刪除已经不在的图表数据 + dealCustomDefinition(chart); + + customSelectPane.updateBean(chart); + }else if (samePlot){//如果是同一个图表切换过来,则重置面板 + customSelectPane.populateBean(chart); + } + } + }else { + isCustom = false; + } + } + + checkCardPane(); + + } + + private void dealCustomDefinition(Chart chart) { + CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition(); + + if (definition == null){ + return; + } + + Map definitionMap = definition.getDefinitionProviderMap(); + + if (definitionMap == null){ + return; + } + + Map newDefinitionMap = new HashMap(); + + VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); + for (int i = 0; i < customPlot.getCustomPlotList().size(); i++){ + CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)); + TopDefinitionProvider definitionProvider = definitionMap.get(plotType); + + newDefinitionMap.put(plotType, definitionProvider); + } + + definition.setDefinitionProviderMap(newDefinitionMap); + } + + /** + * 不同图表切換,重置chart屬性 + * @param chart + * @param newPlot + */ + @Override + protected void resetChartAttr(Chart chart, Plot newPlot){ + super.resetChartAttr(chart, newPlot); + //切换图表清空数据配置 + chart.setFilterDefinition(null); + //设置默认不排序 + VanChartTools tools = ((VanChart)chart).getVanChartTools(); + if (tools != null) { + tools.setSort(false); + } + } + + /** + * 更新界面内容 + */ + public void populateBean(Chart chart) { + for(ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + + //获取上次选中的图标 + VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot(); + lastTypeIndex = customPlot.getCustomStyle().ordinal(); + typeDemo.get(lastTypeIndex).isPressing = true; + + isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM; + + //自定义选择时,更新自定义面板 + if (isCustom){ + customSelectPane.populateBean(chart); + } + + checkCardPane(); + + checkDemosBackground(); + + } + + /** + * 获取各图表类型界面ID, 本质是plotID + * + * @return 图表类型界面ID + */ + @Override + protected String getPlotTypeID() { + return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID; + } + + protected Plot getSelectedClonedPlot(){ + VanChartCustomPlot newPlot = null; + Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; + for(int i = 0, len = customChart.length; i < len; i++){ + if(typeDemo.get(i).isPressing){ + newPlot = (VanChartCustomPlot)customChart[i].getPlot(); + } + } + Plot cloned = null; + try { + cloned = (Plot)newPlot.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In ScatterChart"); + } + return cloned; + } + + public Chart getDefaultChart() { + return CustomIndependentVanChart.CustomVanChartTypes[0]; + } + + @Override + /** + *删除配置的条件属性 + */ + protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); + } + + @Override + /** + * 删除线型配置 + */ + protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + if (oldPlot.getConditionCollection() != null) { + ConditionCollection newCondition = new ConditionCollection(); + newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); + newPlot.setConditionCollection(newCondition); + + //删除线型设置 + ConditionAttr attrList = newCondition.getDefaultAttr(); + DataSeriesCondition attr = attrList.getExisted(VanChartAttrLine.class); + if (attr != null){ + attrList.remove(VanChartAttrLine.class); + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java new file mode 100644 index 0000000000..ac1b055386 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java @@ -0,0 +1,27 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; + +/** + * Created by Fangjie on 2016/5/18. + */ +public class CategoryCustomPlotTableDataContentPane extends CategoryPlotTableDataContentPane { + public CategoryCustomPlotTableDataContentPane() { + super(); + } + + public CategoryCustomPlotTableDataContentPane(ChartDataPane parent) { + super(parent); + } + + /** + * 检查 某些Box是否可用 + * 分类不可用 + * @param hasUse 是否使用 + */ + public void checkBoxUse(boolean hasUse) { + categoryCombox.setEnabled(false); + checkSeriseUse(hasUse); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java new file mode 100644 index 0000000000..fc36decc9d --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java @@ -0,0 +1,103 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.type.CustomPlotType; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.util.ArrayList; + +/** + * Created by Fangjie on 2016/4/19. + */ +public class ChartImageCheckOutPane extends BasicPane implements UIObserver { + + private JCheckBox checkBox; + private CustomPlotType customPlotType; + private ArrayList changeListeners = new ArrayList(); + + public ChartImageCheckOutPane(CustomPlotType type){ + this(type, false); + } + + public ChartImageCheckOutPane( CustomPlotType type, boolean isSelected){ + this.customPlotType = type; + + initCheckBox(isSelected); + + this.add(checkBox, BorderLayout.CENTER); + } + + public CustomPlotType getCustomPlotType() { + return customPlotType; + } + + private void initCheckBox(boolean isSelected) { + this.checkBox = new JCheckBox(); + this.checkBox.setSelected(isSelected); + //设置提示 + this.checkBox.setToolTipText(CustomPlotFactory.getTooltipText(this.customPlotType)); + //背景 + checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType,isSelected)))); + + this.setLayout(new BorderLayout()); + } + + private String getIconPath(CustomPlotType customPlotType, boolean isSelected) { + return isSelected ? CustomPlotFactory.getTypeIconPath(customPlotType)[0] : CustomPlotFactory.getTypeIconPath(customPlotType)[1]; + } + + + public JCheckBox getCheckBox() { + return checkBox; + } + + public void checkIconImage(){ + checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType, checkBox.isSelected())))); + } + + public void setPaneBorder(boolean isRightLine, boolean isBottomLine){ + this.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR)); + } + + public void setSelected(boolean isSelected){ + checkBox.setSelected(isSelected); + } + + public boolean isSelected(){ + return checkBox.isSelected(); + } + + + + @Override + protected String title4PopupWindow() { + return null; + } + + public void fireStateChange() { + for (int i = 0; i < changeListeners.size(); i++) { + changeListeners.get(i).stateChanged(new ChangeEvent(this)); + } + } + + @Override + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + @Override + public boolean shouldResponseChangeListener() { + return false; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java new file mode 100644 index 0000000000..b3bd29de89 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java @@ -0,0 +1,84 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.PiePlot4VanChart; +import com.fr.plugin.chart.attr.plot.VanChartPositionPlot; +import com.fr.plugin.chart.base.Position; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/26. + */ +public class CustomPlotLocationPane extends BasicBeanPane{ + private UISpinner radius; + private UISpinner xDirection; + private UISpinner yDirection; + private static final double MIN_ANGLE = PiePlot4VanChart.START_ANGLE; + private static final double MAX_ANGLE = PiePlot4VanChart.END_ANGLE; + + public CustomPlotLocationPane(){ + init(); + } + + private void init() { + radius = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 50); + + xDirection = new UISpinner(0, 100, 1, 20); + yDirection = new UISpinner(0, 100, 1, 20); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Position") + "(%): " + Inter.getLocText("Plugin-ChartF_X_Direction"), SwingConstants.LEFT),xDirection}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Y_Direction"), SwingConstants.RIGHT),yDirection}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Radius") + "(px): ",SwingConstants.LEFT),radius} + + }; + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, new double[]{-2, -2, -2}, new double[]{-2, -1}); + + this.setLayout(new BorderLayout(0,0)); + + this.add(TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Location"), panel), BorderLayout.CENTER); + } + + @Override + public void populateBean(Plot plot) { + if (plot instanceof VanChartPositionPlot) { + Position position = ((VanChartPositionPlot) plot).getPosition(); + + if (position != null) { + radius.setValue(position.getRadius()); + xDirection.setValue(position.getX()); + yDirection.setValue(position.getY()); + } + } + } + + @Override + public void updateBean(Plot plot) { + if (plot instanceof VanChartPositionPlot) { + Position position = new Position(); + position.setRadius(radius.getValue()); + position.setX(xDirection.getValue()); + position.setY(yDirection.getValue()); + + ((VanChartPositionPlot) plot).setPosition(position); + } + } + + @Override + public Plot updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java new file mode 100644 index 0000000000..ec45eaf2ab --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java @@ -0,0 +1,36 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.chart.chartdata.MeterReportDefinition; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.MeterPlotReportDataContentPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/5/23. + */ +public class MeterCustomPlotReportDataContentPane extends MeterPlotReportDataContentPane{ + private UITextField singCateText; + public MeterCustomPlotReportDataContentPane(ChartDataPane parent) { + super(parent); + } + + @Override + protected Component getSingCatePane() { + return singCateText = new UITextField(); + } + + @Override + protected void populateSingCatePane(String name) { + singCateText.setText(name); + } + + @Override + protected void updateSingCatePane(MeterReportDefinition meterDefinition) { + + meterDefinition.setName(singCateText.getText()); + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java new file mode 100644 index 0000000000..efece3b851 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java @@ -0,0 +1,44 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.base.Utils; +import com.fr.chart.chartdata.MeterTableDefinition; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.table.MeterPlotTableDataContentPane; +import com.fr.plugin.chart.data.VanChartMeterCustomTableDefinition; + +import java.awt.*; + +/** + * Created by Fangjie on 2016/5/18. + */ +public class MeterCustomPlotTableDataContentPane extends MeterPlotTableDataContentPane { + private static final int TEXT_HT = 20; + private static final int TEXT_WD = 80; + private UITextField nameField; + public MeterCustomPlotTableDataContentPane(ChartDataPane parent) { + super(parent); + } + + @Override + protected Component getNameComponent() { + nameField = new UITextField(); + nameField.setPreferredSize(new Dimension(TEXT_WD, TEXT_HT)); + return nameField; + } + + @Override + protected void populateNameComponent(MeterTableDefinition meter) { + nameField.setText(meter.getName()); + } + + @Override + protected void updateNameComponent(MeterTableDefinition meter) { + meter.setName(Utils.objectToString(nameField.getText())); + } + + @Override + protected MeterTableDefinition getMeterTableDefinition(){ + return new VanChartMeterCustomTableDefinition(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java new file mode 100644 index 0000000000..65241fc0b7 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java @@ -0,0 +1,19 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.plugin.chart.custom.style.VanChartCustomAxisAreaPane; +import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane; +import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane; + +/** + * Created by Fangjie on 2016/5/19. + */ +public class VanChartCustomAreaBackgroundPane extends VanChartAreaBackgroundPane { + public VanChartCustomAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) { + super(isPlot, parent); + } + + protected VanChartAxisAreaPane initAxisAreaPane() { + return new VanChartCustomAxisAreaPane(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java new file mode 100644 index 0000000000..daa479a2ac --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java @@ -0,0 +1,43 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.gui.ilable.UILabel; + +import com.fr.general.Inter; + +import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; +import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane; + +import java.awt.*; +/** + * 自定义坐标轴设置 + * 散点图和气泡图用到 + * 堆积和百分比属性为false + */ +public class VanChartCustomAxisConditionPane extends VanChartCustomStackAndAxisConditionPane { + + public VanChartCustomAxisConditionPane(){ + + } + + protected Component[][] getDeployComponents() { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis}, + new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis}, + }; + + return components; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_Custom_Axis"); + } + + + @Override + protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) { + seriesStackAndAxis.setStacked(false); + seriesStackAndAxis.setPercentStacked(false); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java new file mode 100644 index 0000000000..4b274e56e1 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java @@ -0,0 +1,55 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; + +import java.util.List; + +/** + * Created by Fangjie on 2016/5/12. + */ +public class VanChartCustomPlotAxisPane extends VanChartAxisPane { + + public VanChartCustomPlotAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) { + super(plot, parent); + } + + //删除此坐标轴相关堆积属性的设置 + protected void removeOthers(int axisIndex, boolean isXAxis){ + //堆积和坐标轴 + + VanChartCustomPlot customPlot = (VanChartCustomPlot)editingPlot; + List plotList = customPlot.getCustomPlotList(); + for (int k = 0; k < plotList.size(); k++) { + if (customPlot.getStandardAxisOrder().contains(k)){ + VanChartRectanglePlot vanChartPlot = (VanChartRectanglePlot) plotList.get(k); + if (vanChartPlot.isHaveAxis() && !CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlot)){ + remove(axisIndex, isXAxis, vanChartPlot); + } + } + } + } + + private void remove(int axisIndex, boolean isXAxis, VanChartRectanglePlot vanChartPlot){ + ConditionCollection stackAndAxisCondition = vanChartPlot.getStackAndAxisCondition(); + if (stackAndAxisCondition == null) { + return; + } + for (int i = 0, len = stackAndAxisCondition.getConditionAttrSize(); i < len; i++) { + ConditionAttr conditionAttr = stackAndAxisCondition.getConditionAttr(i); + AttrSeriesStackAndAxis stackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class); + int index = isXAxis ? stackAndAxis.getXAxisIndex() : stackAndAxis.getYAxisIndex(); + if (index == axisIndex) { + stackAndAxisCondition.removeConditionAttr(conditionAttr); + } + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java new file mode 100644 index 0000000000..02761a1952 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java @@ -0,0 +1,396 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/19. + */ +public class VanChartCustomPlotSelectPane extends BasicBeanPane { + + private static final int NO_DIRTY = -1; + private static final int NOT_LAST = -1; + private static final int REC_WIDTH = 58; + private static final int REC_HEIGHT = 50; + private static final int CUSTOM_TYPE_NUM = 4; + + + public static final String MASSAGE = Inter.getLocText("Plugin-ChartF_At_Least_One_Chart"); + + private List customTypeList = new ArrayList(); + + //该列表记录上次每个checkout的状态 + private List oldSelectedList; + + //保存点击的checkout顺序 + private List selectedPlotTypeList = new ArrayList(); + + //将所有面板排布后的面板 + private JPanel content; + + + public VanChartCustomPlotSelectPane(){ + initCustomType(); + } + + private void initCustomType() { + + initAllCheckOutPane(); + + initContentPane(); + + updateOldSelectedList(); + + addCheckBoxListener(); + + checkoutSelected(); + } + + private void updateOldSelectedList() { + oldSelectedList = new ArrayList(); + for (int i = 0; i < customTypeList.size(); i++){ + oldSelectedList.add(customTypeList.get(i).getCheckBox().isSelected()); + } + } + + private void checkoutSelected() { + for (int i = 0; i < customTypeList.size(); i++){ + //根据是否选中重置背景 + customTypeList.get(i).checkIconImage(); + } + } + + private void initContentPane() { + + content = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(CUSTOM_TYPE_NUM, 0, 0); + for (int i = 0; i < customTypeList.size(); i++){ + customTypeList.get(i).setPreferredSize(new Dimension(REC_WIDTH,REC_HEIGHT)); + + //是否画右边线 + boolean isRightLine = (i == customTypeList.size() - 1) ? true : ((i + 1)%CUSTOM_TYPE_NUM == 0) ? true : false; + //是否画下边线 + int row = i / CUSTOM_TYPE_NUM; + int column = i % CUSTOM_TYPE_NUM; + boolean isBottomLine = ((row+1)*CUSTOM_TYPE_NUM + column < customTypeList.size()) ? false : true; + + customTypeList.get(i).setPaneBorder(isRightLine, isBottomLine); + + content.add(customTypeList.get(i)); + } + + this.setLayout(new BorderLayout()); + this.add(content, BorderLayout.CENTER); + } + + private void addCheckBoxListener() { + for (int i = 0; i < customTypeList.size(); i++){ + + //初始化每个customType的listener + + customTypeList.get(i).getCheckBox().addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + int index = isLastSelected(); + if (index != NOT_LAST) {//如果是最后一个 + customTypeList.get(index).getCheckBox().setSelected(true); + + //彈出警告框 + JOptionPane.showMessageDialog(new JPanel(), MASSAGE,"", JOptionPane.WARNING_MESSAGE); + } + + //点击后更新已选顺序 + checkoutSelectedPlotTypeList(); + + //点击后,更新背景 + checkoutSelected(); + + //响应观察者事件,以便更新chart + fireDirty(); + } + }); + } + } + + + /** + * 根据选择更新顺序 + */ + private void checkoutSelectedPlotTypeList() { + int index = getDirtySelectedIndex(oldSelectedList); + + if (index == NO_DIRTY){ + return; + } + + boolean isAdd = getDirtyState(index); + + //获取选中的自定义图表类型 + CustomPlotType plotType = customTypeList.get(index).getCustomPlotType(); + + //根据类型处理增加或者删除 + dealSelectedPlotTypeList(isAdd, plotType, selectedPlotTypeList); + } + + private void fireDirty() { + int index = getDirtySelectedIndex(oldSelectedList); + if (index != NO_DIRTY) { + customTypeList.get(index).fireStateChange(); + } + } + + @Override + public void populateBean(Chart chart) { + + VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); + + populateCustomTypeList(customPlot); + + populateSelectedPlotTypeList(customPlot); + + checkoutSelected(); + } + + private void populateSelectedPlotTypeList(VanChartCustomPlot customPlot) { + + selectedPlotTypeList = new ArrayList(); + + List customPlotList = customPlot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + selectedPlotTypeList.add(CustomPlotFactory.getCustomType(customPlotList.get(i))); + } + } + + private void populateCustomTypeList(VanChartCustomPlot customPlot) { + if (customPlot.getCustomStyle() != CustomStyle.CUSTOM){ + return; + } + + List customPlotList = customPlot.getCustomPlotList(); + + oldSelectedList = new ArrayList(); + + for (int i = 0; i < customTypeList.size(); i++){ + boolean isSelected = false; + CustomPlotType customPlotType = customTypeList.get(i).getCustomPlotType(); + //更新选中项 + if (customPlotTypeContained(customPlotType, customPlotList)) { + isSelected = true; + } + + customTypeList.get(i).setSelected(isSelected); + + //同时设置oldList + oldSelectedList.add(isSelected); + } + + } + + private boolean customPlotTypeContained(CustomPlotType customPlotType, List customPlotList) { + boolean contained = false; + + for (int i = 0; i < customPlotList.size(); i++){ + if (ComparatorUtils.equals(customPlotType, CustomPlotFactory.getCustomType(customPlotList.get(i)))){ + contained = true; + break; + } + } + + return contained; + } + + @Override + public Chart updateBean() { + return null; + } + + @Override + public void updateBean(Chart chart) { + VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot(); + + //根据选择的组合图更新,根据保存的顺序更新组合图 + updateCustomPlotList(customPlot); + + //响应完毕后,更新状态 + updateOldSelectedList(); + } + + private void updateCustomPlotList(VanChartCustomPlot customPlot) { + //根据selectedPlotTypeList更新customPlotList + //切换之后,给与全新构建的plotList,这回导致其他面板上的设置无效,也是合理的 + List newCustomPlotList = new ArrayList(); + List oldCustomPlotList = customPlot.getCustomPlotList(); + + //复制已经设置的plot + try { + for (int i = 0; i < oldCustomPlotList.size(); i++){ + VanChartPlot vanChartPlot = oldCustomPlotList.get(i); + if (selectedPlotTypeList.contains(CustomPlotFactory.getCustomType(vanChartPlot))){ + newCustomPlotList.add((VanChartPlot) vanChartPlot.clone()); + } + } + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error(e.getMessage()); + } + + + //没有复制到的plot重创 + for (int i = 0; i < selectedPlotTypeList.size(); i++){ + CustomPlotType customPlotType = selectedPlotTypeList.get(i); + if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ + VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); + vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); + //设置公共属性 + setCommonAttr(vanChartPlot, customPlot); + + newCustomPlotList.add(vanChartPlot); + } + } + + customPlot.setCustomPlotList(newCustomPlotList); + } + + private void setCommonAttr(VanChartPlot vanChartPlot, VanChartCustomPlot customPlot) { + //坐标轴公共属性 + dealAxisAttr(vanChartPlot, customPlot); + } + + private void dealAxisAttr(VanChartPlot vanChartPlot, VanChartCustomPlot customPlot) { + if (vanChartPlot.isHaveAxis() && !CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlot) && customPlot.isHaveStandardAxis()){ + VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)vanChartPlot; + + //指针指向同一个标准坐标轴 + rectanglePlot.setXAxisList(customPlot.getXAxisList()); + rectanglePlot.setYAxisList(customPlot.getYAxisList()); + } + } + + private void dealSelectedPlotTypeList(boolean isAdd, CustomPlotType plotType, List customPlotTypeList) { + + //根据isAdd删除或者增加 + if (isAdd){ + customPlotTypeList.add(plotType); + }else { + //定位选中的是那个plot + int index = -1; + + for (int i = 0; i < customPlotTypeList.size(); i++){ + if (ComparatorUtils.equals(plotType, customPlotTypeList.get(i))){ + index = i; + break; + } + } + + if (index == -1){ + return; + } + + customPlotTypeList.remove(index); + } + + } + + /** + * 获取id为index的图表是选中还是删除 + * 增加则返回true + * 删除返回false + * @param index + * @return + */ + private boolean getDirtyState(int index) { + boolean isAdd = true; + + boolean newState = customTypeList.get(index).getCheckBox().isSelected(); + boolean oldState = oldSelectedList.get(index); + + //true->false为删除;false->true为增加 + if (oldState == true && newState == false){ + isAdd = false; + }else if (oldState == false && newState == true){ + isAdd = true; + } + + return isAdd; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + /** + * 如果是最后一个,则返回最后一个checkout的index + * 否则返回-1 + * @return + */ + private int isLastSelected() { + int count = 0; + int index = NOT_LAST; + for (int i = 0; i < customTypeList.size(); i++){ + if (customTypeList.get(i).getCheckBox().isSelected()){ + count++; + } + } + if (count == 0){ + //查找是哪一个变化了 + index = getDirtySelectedIndex(oldSelectedList); + } + return index; + } + + /** + * 获取改变状态的index + * 如果有两个都改变了,改函数获取的是排在前面的index + * 如果没找到 + * @param oldSelectedList + * @return + */ + private int getDirtySelectedIndex(List oldSelectedList) { + for (int i = 0; i < oldSelectedList.size(); i++){ + if ((oldSelectedList.get(i)) != customTypeList.get(i).getCheckBox().isSelected()){ + return i; + } + } + return NO_DIRTY; + } + + /** + * 构建所有可用的组合图面板 + */ + private void initAllCheckOutPane() { + //将所有工厂中的图表都加入到可选面板中 + + CustomPlotType[] customPlotTypes = CustomPlotType.getTypes(); + for(int i = 0; i < customPlotTypes.length; i++){ + boolean isSelected = false; + CustomPlotType customPlotType = customPlotTypes[i]; + //前两个默认选中 + if (i == 0 || i == 1) { + isSelected = true; + selectedPlotTypeList.add(customPlotType); + } + ChartImageCheckOutPane checkOutPane = new ChartImageCheckOutPane(customPlotType, isSelected); + + customTypeList.add(checkOutPane); + } + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotTabPane.java new file mode 100644 index 0000000000..755441d94b --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotTabPane.java @@ -0,0 +1,81 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.designer.component.VanChartPlotMultiTabPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/22. + */ +public abstract class VanChartCustomPlotTabPane extends VanChartPlotMultiTabPane { + private static final long serialVersionUID = 8633385688766835241L; + + public VanChartCustomPlotTabPane(E plot, BasicPane parent) { + this(plot, parent, null); + } + + public VanChartCustomPlotTabPane(E plot, BasicPane parent, AttributeChangeListener listener) { + super(plot, parent, listener); + } + + protected abstract void initTabTitle(); + + @Override + protected void initLayout() { + JPanel tabPanel = new JPanel(new BorderLayout()); + tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); + tabPanel.add(tabPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout(0, 6)); + this.add(tabPanel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + /** + * 设置选中的界面id + */ + public void setSelectedByIds(int level, String... id) { + tabPane.setSelectedIndex(-1); + for (int i = 0; i < paneList.size(); i++) { + if (ComparatorUtils.equals(id[level], NameArray[i])) { + tabPane.setSelectedIndex(i); + tabPane.tabChanged(i); + if (id.length >= level + 2) { + ((AutoSelectedPane)paneList.get(i)).setSelectedIndex(id[level + 1]); + } + break; + } + } + } + + @Override + public void relayoutWhenListChange() { + centerPane = new JPanel(cardLayout) { + @Override + public Dimension getPreferredSize() { + if (tabPane.getSelectedIndex() == -1) { + return super.getPreferredSize(); + } else { + return paneList.get(tabPane.getSelectedIndex()).getPreferredSize(); + } + } + }; + + //获取tab的标题 + initTabTitle(); + + tabPane = new VanChartCustomPlotUITabGroup(NameArray) { + @Override + public void tabChanged(int index) { + dealWithTabChanged(index); + } + }; + tabPane.setSelectedIndex(0); + tabPane.tabChanged(0); + initLayout(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotUITabGroup.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotUITabGroup.java new file mode 100644 index 0000000000..3819b76b25 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotUITabGroup.java @@ -0,0 +1,130 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UITabGroup; +import com.fr.design.gui.ibutton.UIToggleButton; + +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/21. + */ +public class VanChartCustomPlotUITabGroup extends UITabGroup{ + + private static final int WIDTH = 198; + private static final int BUTTON_HEIGHT = 30; + private int listNum = 0; + + public VanChartCustomPlotUITabGroup(Icon[] iconArray) { + super(iconArray); + } + + public VanChartCustomPlotUITabGroup(String[] textArray) { + super(textArray); + } + + @Override + protected LayoutManager getGridLayout(int number) { + //这个地方可以顺便获取list个数 + listNum = number; + return new GridBagLayout(); + } + + @Override + protected void paintBorder(Graphics g) { + Border border = getBorder(); + if (border != null) { + border.paintBorder(this, g, 0, 0, getWidth(), getHeight()); + } + } + + @Override + protected Border getGroupBorder() { + return BorderFactory.createEmptyBorder(1, 1, 1, 1); + } + + @Override + protected void initButton(UIToggleButton labelButton) { + + int ButtonWidth = WIDTH / 3; + if (listNum <= 1){ + return; + }else if (listNum == 2){ + ButtonWidth = WIDTH / 2; + } + + //将button加入到pane中,以便可以对边框进行控制 + labelButton.setRoundBorder(false); + labelButton.setBorderPainted(false); + + + + labelButtonList.add(labelButton); + + int index = labelButtonList.size() - 1; + + JPanel panel = getButtonPanel(labelButton, index); + + GridBagConstraints constraints=new GridBagConstraints(); + + int end = listNum % 3; + + if (end == 1 && index == 0){ + constraints.gridy = 0; + constraints.gridx = 0; + constraints.gridheight = 1; + constraints.gridwidth = 6; + ButtonWidth = WIDTH + 2; + }else if (end == 2 && (index == 0 || index == 1) && listNum != 2){ + constraints.gridy = 0; + constraints.gridx = index == 1 ? 4 : 0; + constraints.gridheight = 1; + constraints.gridwidth = index == 0 ? 4 : 2; + ButtonWidth = index == 0 ? ButtonWidth * 2 + 1 : ButtonWidth; + }else { + int l = ((index + ((end == 0) ? end : (3 - end))) / 3); + constraints.gridy = l; + constraints.gridx = ((index - (l * 3 - (end == 0 ? end : 3 - end))))*2; + constraints.gridheight = 1; + constraints.gridwidth = 2; + } + labelButton.setPreferredSize(new Dimension(ButtonWidth, BUTTON_HEIGHT)); + + this.add(panel, constraints); + } + + private JPanel getButtonPanel(UIToggleButton labelButton, int index) { + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + panel.add(labelButton,BorderLayout.CENTER); + + setPanelBorder(panel, index); + + return panel; + } + + public void setPanelBorder(JPanel panel, int index) { + int end = listNum % 3; + int num = listNum; + + //调整index + if (end == 1 && index != 0){ + index += 2; + num += 2; + }else if (end == 2 && index != 0 && index != 1){ + index += 1; + num += 1; + } + boolean isRightLine = (index+1) % 3 == 0 ? true : false; + isRightLine = (end == 2 && index == 1) ? true : isRightLine; + isRightLine = (end == 1 && index == 0) ? true : isRightLine; + //是否画下边线 + int row = index / 3; + int column = index % 3; + boolean isBottomLine = ((row+1)*3 + column < num) ? false : true; + + panel.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR)); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartDataPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartDataPane.java new file mode 100644 index 0000000000..cd0c729380 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartDataPane.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; + +import javax.swing.*; + +/** + * Created by Fangjie on 2016/5/18. + */ +public class VanChartDataPane extends ChartDataPane { + + public VanChartDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected JPanel createContentPane() { + contentsPane = new NormalChartDataPane(listener, VanChartDataPane.this); + return contentsPane; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java new file mode 100644 index 0000000000..9f41e7b86f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java @@ -0,0 +1,133 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.chart.web.ChartHyperRelateCellLink; +import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.javascript.ChartEmailPane; +import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.frpane.UICorrelationComboBoxPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.Inter; +import com.fr.js.*; +import com.fr.plugin.chart.designer.other.HyperlinkMapFactory; +import com.fr.stable.bridge.StableFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartHyperLinkPane extends UICorrelationComboBoxPane { + + public VanChartHyperLinkPane() { + super(); + } + + public void populate(Plot plot) { + HashMap paneMap = getHyperlinkMap(plot); + + //安装平台内打开插件时,添加相应按钮 + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + //todo@shine9.0 + // paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); + } + + java.util.List list = refreshList(paneMap); + refreshMenuAndAddMenuAction(list); + + java.util.List hyperList = new ArrayList(); + NameJavaScriptGroup nameGroup = populateHotHyperLink(plot); + for(int i = 0; nameGroup != null && i < nameGroup.size(); i++) { + NameJavaScript javaScript = nameGroup.getNameHyperlink(i); + if(javaScript != null && javaScript.getJavaScript() != null) { + JavaScript script = javaScript.getJavaScript(); + hyperList.add(new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass()))); + } + } + + populateBean(hyperList); + doLayout(); + } + + protected NameJavaScriptGroup populateHotHyperLink(Plot plot) { + return plot.getHotHyperLink(); + } + + protected HashMap getHyperlinkMap(Plot plot){ + return HyperlinkMapFactory.getHyperlinkMap(plot); + } + + public void update(Plot plot) { + + NameJavaScriptGroup nameGroup = updateNameGroup(); + + updateHotHyperLink(plot, nameGroup); + } + + protected void updateHotHyperLink(Plot plot, NameJavaScriptGroup nameGroup) { + plot.setHotHyperLink(nameGroup); + } + + private NameJavaScriptGroup updateNameGroup() { + NameJavaScriptGroup nameGroup = new NameJavaScriptGroup(); + nameGroup.clear(); + + resetItemName(); + java.util.List list = updateBean(); + for(int i = 0; i < list.size(); i++) { + UIMenuNameableCreator menu = (UIMenuNameableCreator)list.get(i); + NameJavaScript nameJava = new NameJavaScript(menu.getName(), (JavaScript)menu.getObj()); + nameGroup.addNameHyperlink(nameJava); + } + + return nameGroup; + } + + + protected java.util.List refreshList(HashMap map) { + java.util.List list = new ArrayList(); + + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"), + new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class)); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"), + new WebHyperlink(), getUseMap(map, WebHyperlink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"), + new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); + list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); + + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"), + new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"), + new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Float"), + new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); + + FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Form"), + hyperlink, getUseMap(map, FormHyperlinkProvider.class))); + + return list; + } + + protected Class getUseMap(HashMap map, Object key) { + if(map.get(key) != null){ + return (Class)map.get(key); + } + //引擎在这边放了个provider,当前表单对象 + for(Object tempKey : map.keySet()){ + if(((Class)tempKey).isAssignableFrom((Class)key)){ + return (Class)map.get(tempKey); + } + } + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/column_area.png b/designer_chart/src/com/fr/plugin/chart/custom/images/column_area.png new file mode 100644 index 0000000000..34a2c08c83 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/column_area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/column_line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/column_line.png new file mode 100644 index 0000000000..8994612e0a Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/column_line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom.png new file mode 100644 index 0000000000..2d272307cf Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/area.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/area.png new file mode 100644 index 0000000000..35fa7d2186 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/bubble.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/bubble.png new file mode 100644 index 0000000000..b75e78bb53 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/bubble.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/column.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/column.png new file mode 100644 index 0000000000..73fe7be526 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/column.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/cuvette.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/cuvette.png new file mode 100644 index 0000000000..680f9ed18e Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/cuvette.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/different_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/different_pie.png new file mode 100644 index 0000000000..68d759c11d Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/different_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/line.png new file mode 100644 index 0000000000..c518095541 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pie.png new file mode 100644 index 0000000000..6afa8095eb Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_180.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_180.png new file mode 100644 index 0000000000..b20420280c Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_180.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_360.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_360.png new file mode 100644 index 0000000000..d4058631fb Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_360.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/radar.png new file mode 100644 index 0000000000..391e2f0d54 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/ring.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/ring.png new file mode 100644 index 0000000000..f3bf1b31d8 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/ring.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/same_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/same_pie.png new file mode 100644 index 0000000000..3a1485fb50 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/same_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/scatter.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/scatter.png new file mode 100644 index 0000000000..ef86df32ba Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/scatter.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/area.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/area.png new file mode 100644 index 0000000000..2fac0316b4 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/bubble.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/bubble.png new file mode 100644 index 0000000000..93f559ffd1 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/bubble.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/column.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/column.png new file mode 100644 index 0000000000..6481b4de1d Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/column.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/cuvette.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/cuvette.png new file mode 100644 index 0000000000..57847bc24a Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/cuvette.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/different_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/different_pie.png new file mode 100644 index 0000000000..aec7300393 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/different_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/line.png new file mode 100644 index 0000000000..4d84cf2041 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pie.png new file mode 100644 index 0000000000..52c6051d42 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_180.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_180.png new file mode 100644 index 0000000000..2c9cc91339 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_180.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_360.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_360.png new file mode 100644 index 0000000000..db13dc1a26 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_360.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/radar.png new file mode 100644 index 0000000000..8d52d5f263 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/ring.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/ring.png new file mode 100644 index 0000000000..88a25aa898 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/ring.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/same_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/same_pie.png new file mode 100644 index 0000000000..b5a1598965 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/same_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/scatter.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/scatter.png new file mode 100644 index 0000000000..2a7ded617e Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/scatter.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/slot.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/slot.png new file mode 100644 index 0000000000..920cf6cc0b Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/slot.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/stack_radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/stack_radar.png new file mode 100644 index 0000000000..b2e5a108e3 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/stack_radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/slot.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/slot.png new file mode 100644 index 0000000000..bb44ca5136 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/slot.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/stack_radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/stack_radar.png new file mode 100644 index 0000000000..4019b360a6 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/stack_radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/stack_column_line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/stack_column_line.png new file mode 100644 index 0000000000..adc50348a5 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/stack_column_line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomConditionAttrPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomConditionAttrPane.java new file mode 100644 index 0000000000..abbc5133da --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomConditionAttrPane.java @@ -0,0 +1,71 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.custom.VanChartCustomPlot; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomConditionAttrPane extends BasicScrollPane { + private VanChartCustomPlotConditionAttrTabPane conditionAttrPane; + private Chart chart; + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initConditionAttrPane((VanChartCustomPlot) chart.getPlot()); + if(conditionAttrPane != null) { + contentPane.add(conditionAttrPane, BorderLayout.CENTER); + } + return contentPane; + } + + private void initConditionAttrPane(VanChartCustomPlot plot) { + conditionAttrPane = new VanChartCustomPlotConditionAttrTabPane(plot, null); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + if(conditionAttrPane == null) { + this.remove(leftcontentPane); + layoutContentPane(); + } + if(conditionAttrPane != null) { + conditionAttrPane.populateBean((VanChartCustomPlot)chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart) { + + if (chart == null){ + return; + } + + if (conditionAttrPane != null) { + conditionAttrPane.updateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + /** + * 是否显示滚动条 + * @return + */ + @Override + protected boolean isShowScrollBar() { + return false; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Chart-Condition_Display"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java new file mode 100644 index 0000000000..c4ed1ec2d3 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java @@ -0,0 +1,56 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Plot; +import com.fr.general.Inter; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.designer.other.AutoRefreshPane; +import com.fr.plugin.chart.designer.other.AutoRefreshPaneWithoutTooltip; +import com.fr.plugin.chart.designer.other.VanChartInteractivePane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomInteractivePane extends VanChartInteractivePane { + + private VanChartCustomPlotHyperlinkPane hyperlinkPane; + + /** + * 组合图无排序按钮 + * @return + */ + @Override + protected Component[][] createToolBarComponents() { + return createToolBarComponentsWithOutSort(); + } + + protected JPanel createHyperlinkPane() { + hyperlinkPane = new VanChartCustomPlotHyperlinkPane(); + return TableLayout4VanChartHelper.createTitlePane(Inter.getLocText("M_Insert-Hyperlink"), hyperlinkPane, 0); + } + + @Override + protected void populateHyperlink(Plot plot) { + hyperlinkPane.populateBean(chart); + } + + @Override + protected void updateHyperlink(Plot plot){ + hyperlinkPane.updateBean(chart); + } + + protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { + boolean isLargeModel = largeModel(plot); + //自定义组合图不支持自动数据点提示 + if (((VanChartCustomPlot)plot).getCustomStyle().equals(CustomStyle.CUSTOM)) { + return new AutoRefreshPaneWithoutTooltip((VanChart) chart, isLargeModel); + } + return new AutoRefreshPane((VanChart) chart, isLargeModel); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomOtherPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomOtherPane.java new file mode 100644 index 0000000000..7538690586 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomOtherPane.java @@ -0,0 +1,19 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.beans.BasicBeanPane; +import com.fr.plugin.chart.designer.other.VanChartOtherPane; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomOtherPane extends VanChartOtherPane { + protected BasicBeanPane createInteractivePane() { + return new VanChartCustomInteractivePane(); + } + + @Override + protected BasicBeanPane createConditionAttrPane() { + return new VanChartCustomConditionAttrPane(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java new file mode 100644 index 0000000000..18285dfd16 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java @@ -0,0 +1,112 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.other.VanChartConditionAttrPane; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[paneList.size()]; + for (int i = 0, j = 0 ; i < paneList.size() && j < customPlotList.size(); i++, j++) { + if (customPlotList.get(j).isSupportDataSeriesCondition()) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(j); + + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + }else { + //如果不支持,则i不动 + i -- ; + } + } + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + if (customPlotList.get(i).isSupportDataSeriesCondition()) { + //根据不同的plot创建不同的数据配置界面 + VanChartConditionAttrPane contentPane = new VanChartConditionAttrPane(); + + paneList.add(contentPane); + } + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0, j = 0 ; i < paneList.size() && j < customPlotList.size(); i++, j++){ + if (customPlotList.get(j).isSupportDataSeriesCondition()) { + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(j); + + ((VanChartConditionAttrPane) paneList.get(i)).populateBean(vanChartPlot); + }else { + i -- ; + } + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0, j = 0; i < paneList.size() && j < customPlotList.size(); i++, j++){ + if (customPlotList.get(j).isSupportDataSeriesCondition()) { + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(j); + + VanChartConditionAttrPane conditionPane = (VanChartConditionAttrPane) paneList.get(i); + + conditionPane.updateBean(vanChartPlot); + }else { + i --; + } + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkPane.java new file mode 100644 index 0000000000..56f5bff185 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkPane.java @@ -0,0 +1,66 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.plugin.chart.custom.VanChartCustomPlot; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomPlotHyperlinkPane extends BasicScrollPane { + private VanChartCustomPlotHyperlinkTabPane linkPane; + protected Chart chart; + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initLinkPane((VanChartCustomPlot) chart.getPlot()); + if(linkPane != null) { + contentPane.add(linkPane, BorderLayout.CENTER); + } + return contentPane; + } + + private void initLinkPane(VanChartCustomPlot plot) { + linkPane = new VanChartCustomPlotHyperlinkTabPane(plot, null); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + if(linkPane == null) { + this.remove(leftcontentPane); + layoutContentPane(); + } + if(linkPane != null) { + linkPane.populateBean((VanChartCustomPlot)chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart) { + this.chart = chart; + + if(linkPane != null) { + linkPane.updateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + @Override + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); + this.setLayout(new BorderLayout()); + this.add(leftcontentPane, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkTabPane.java new file mode 100644 index 0000000000..073a845207 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkTabPane.java @@ -0,0 +1,93 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.component.VanChartHyperLinkPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomPlotHyperlinkTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotHyperlinkTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + String name = CustomPlotFactory.getTitle(plotType); + NameArray[i] = name.length() > 3 ? name.substring(0, 3) : name; + centerPane.add(pane, NameArray[i]); + } + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + VanChartHyperLinkPane contentPane = new VanChartHyperLinkPane(); + + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + ((VanChartHyperLinkPane)paneList.get(i)).populate(vanChartPlot); + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + ((VanChartHyperLinkPane)paneList.get(i)).update(vanChartPlot); + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAreaPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAreaPane.java new file mode 100644 index 0000000000..61c99cd406 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAreaPane.java @@ -0,0 +1,21 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.plugin.chart.custom.component.VanChartCustomAreaBackgroundPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; + +/** + * Created by Fangjie on 2016/5/19. + */ +public class VanChartCustomAreaPane extends VanChartAreaPane { + public VanChartCustomAreaPane(Plot plot, VanChartStylePane parent) { + super(plot, parent); + } + + @Override + protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { + plotPane = new VanChartCustomAreaBackgroundPane(true, parent); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java new file mode 100644 index 0000000000..64554aa539 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java @@ -0,0 +1,54 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane; + +import java.util.List; + + +/** + * Created by Fangjie on 2016/5/19. + */ +public class VanChartCustomAxisAreaPane extends VanChartAxisAreaPane { + + + @Override + public void updateBean(Plot plot){ + VanChartCustomPlot customPlot = (VanChartCustomPlot)plot; + + super.updateBean(customPlot); + + List vanChartPlotList = customPlot.getCustomPlotList(); + + //更新后同步坐标轴 + CustomPlotFactory.axisSynchronization(customPlot); + + //使用其他坐标轴的图形 + for (int i = 0; i < vanChartPlotList.size(); i++){ + if (vanChartPlotList.get(i).isSupportPlotBackground() && CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlotList.get(i))){ + super.updateBean(vanChartPlotList.get(i)); + } + } + } + + + public void populateBean(Plot plot){ + VanChartCustomPlot customPlot = (VanChartCustomPlot)plot; + + if (customPlot.isHaveStandardAxis()){ + super.populateBean(customPlot); + } else { + List vanChartPlotList = customPlot.getCustomPlotList(); + //使用其他坐標軸的圖形 + for (int i = 0; i < vanChartPlotList.size(); i++) { + if (vanChartPlotList.get(i).isSupportPlotBackground() && CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlotList.get(i))) { + super.populateBean(vanChartPlotList.get(i)); + } + } + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisPane.java new file mode 100644 index 0000000000..b7e226d629 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisPane.java @@ -0,0 +1,84 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.awt.*; + + +/** + * Created by Fangjie on 2016/4/27. + */ +public class VanChartCustomAxisPane extends BasicScrollPane { + private static final long serialVersionUID = -2974722365840564105L; + private VanChartCustomAxisTabPane axisPane; + private Chart chart; + protected VanChartStylePane parent; + + public VanChartCustomAxisPane(VanChartStylePane parent) { + super(); + this.parent = parent; + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initAxisPane((VanChartCustomPlot) chart.getPlot()); + contentPane.add(axisPane, BorderLayout.CENTER); + return contentPane; + } + + private void initAxisPane(VanChartCustomPlot plot) { + axisPane = new VanChartCustomAxisTabPane(plot, parent); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + + if(axisPane == null){ + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + + if(axisPane != null) { + axisPane.populateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart){ + if(chart == null){ + return; + } + VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); + axisPane.updateBean(plot); + } + + @Override + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); + this.setLayout(new BorderLayout()); + this.add(leftcontentPane, BorderLayout.CENTER); + } + + @Override + public VanChart updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_AXIS_TITLE; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisTabPane.java new file mode 100644 index 0000000000..8fc7a774c1 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisTabPane.java @@ -0,0 +1,156 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.design.dialog.BasicPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotAxisPane; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/27. + */ +public class VanChartCustomAxisTabPane extends VanChartCustomPlotTabPane { + + public VanChartCustomAxisTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + VanChartCustomPlot customPlot = plot; + + List customPlotList = customPlot.getCustomPlotList(); + + /** + * 判断是否有使用标准坐标轴的点 + */ + ArrayList plotOrder = customPlot.getDiffAxisOrder(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plotOrder创建不同的数据配置界面 + if (plotOrder.contains(i)) { + VanChartAxisPane contentPane = CustomPlotDesignerPaneFactory.createAxisPane((VanChartAxisPlot) customPlotList.get(i), (VanChartStylePane) parent); + paneList.add(contentPane); + } + } + + //判断是否使用标准坐标轴系,标准坐标系即使用customPlot的坐标轴属性,如果有,放在最后 + if (customPlot.isHaveStandardAxis()){ + VanChartAxisPane contentPane = new VanChartCustomPlotAxisPane(customPlot, (VanChartStylePane) parent); + paneList.add(contentPane); + } + + return paneList; + } + + @Override + protected void initTabTitle(){ + VanChartCustomPlot customPlot = plot; + List customPlotList = customPlot.getCustomPlotList(); + ArrayList plotOrder = customPlot.getDiffAxisOrder(); + + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + + + for (int i = 0;i < paneList.size() && i < plotOrder.size(); i++) { + JPanel pane = paneList.get(i); + + VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + } + + //如果有标准坐标系,则放在最后一个tab按钮上 + if (customPlot.isHaveStandardAxis()){ + JPanel pane = paneList.get(paneList.size() - 1); + + //获取点的tooltip作为标题 + NameArray[paneList.size() - 1] = Inter.getLocText("Plugin-ChartF_Rectangular_Coordinate_System"); + centerPane.add(pane, NameArray[paneList.size() - 1]); + } + } + + @Override + /** + * 标准坐标轴属性存在最外层的customPlot的坐标轴变量中 + * 不使用标准坐标轴的坐标轴属性存在相应的plot中的坐标轴变量中 + */ + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + + ArrayList plotOrder = plot.getDiffAxisOrder(); + + for (int i = 0; i < paneList.size() && i < plotOrder.size(); i++){ + //先更新标准坐标轴界面 + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); + ((VanChartAxisPane)paneList.get(i)).populateBean(vanChartPlot); + } + + if (plot.isHaveStandardAxis()){ + ((VanChartAxisPane)paneList.get(paneList.size() - 1)).populateBean(plot); + + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + VanChartCustomPlot customPlot = plot; + List customPlotList = customPlot.getCustomPlotList(); + + ArrayList plotOrder = customPlot.getDiffAxisOrder(); + + for (int i = 0; i < paneList.size() && i < plotOrder.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); + ((VanChartAxisPane)paneList.get(i)).updateBean(vanChartPlot); + } + + if (customPlot.isHaveStandardAxis()){ + //用VanChart包裝plot + VanChart chart = new VanChart(); + chart.setPlot(customPlot); + ((VanChartAxisPane)paneList.get(paneList.size() - 1)).updateBean(chart); + + } + + //将标准坐标轴属性存入使用标准坐标轴的点的坐标轴变量中 + CustomPlotFactory.axisSynchronization(plot); + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomLabelPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomLabelPane.java new file mode 100644 index 0000000000..1fc0affd55 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomLabelPane.java @@ -0,0 +1,73 @@ +package com.fr.plugin.chart.custom.style; + + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; + +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomLabelPane extends BasicScrollPane { + private VanChartCustomPlotLabelTabPane labelPane; + private Chart chart; + protected VanChartStylePane parent; + private static final long serialVersionUID = -5449293740965811991L; + + public VanChartCustomLabelPane(VanChartStylePane parent) { + super(); + this.parent = parent; + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initLabelPane((VanChartCustomPlot) chart.getPlot()); + + contentPane.add(labelPane, BorderLayout.NORTH); + return contentPane; + } + + private void initLabelPane(VanChartCustomPlot plot) { + labelPane = new VanChartCustomPlotLabelTabPane(plot, parent); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + + if(labelPane == null){ + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + + if(labelPane != null) { + labelPane.populateBean((VanChartCustomPlot)chart.getPlot()); + } + } + + + @Override + public void updateBean(Chart chart) { + if(chart == null) { + return; + } + + labelPane.updateBean((VanChartCustomPlot)chart.getPlot()); + } + + @Override + protected String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_LABEL_TITLE; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java new file mode 100644 index 0000000000..15cba4ff78 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java @@ -0,0 +1,115 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotLabelTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + } + } + + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + VanChartPlotLabelPane contentPane = PlotFactory.createPlotLabelPane(customPlotList.get(i), (VanChartStylePane) parent); + + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + DataSeriesCondition attr = vanChartPlot.getAttrLabelFromConditionCollection(); + ((VanChartPlotLabelPane)paneList.get(i)).populate((AttrLabel) attr); + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + + if (plot == null){ + return; + } + + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { + ConditionAttr attrList = customPlotList.get(i).getConditionCollection().getDefaultAttr(); + DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection(); + if (attr != null) { + attrList.remove(attr); + } + + VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane) paneList.get(i); + AttrLabel attrLabel = labelPane.update(); + + if (attrLabel != null) { + attrList.addDataSeriesCondition(attrLabel); + } + + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesPane.java new file mode 100644 index 0000000000..767bb27ab2 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesPane.java @@ -0,0 +1,84 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/26. + */ +public class VanChartCustomPlotSeriesPane extends BasicBeanPane { + private static final int WIDTH = 210; + private static final int DELTA_HEIGHT = 300; + private BasicBeanPane axisPane; + private AbstractPlotSeriesPane seriesPane; + public VanChartCustomPlotSeriesPane(BasicBeanPane axisPane, AbstractPlotSeriesPane seriesPane) { + this.axisPane = axisPane; + this.seriesPane = seriesPane; + + initContentPane(); + } + + private void initContentPane() { + + seriesPane.setPreferredSize(new Dimension(WIDTH, (int) (seriesPane.getPreferredSize().getHeight() + DELTA_HEIGHT))); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; + + if (axisPane == null) { + this.add(seriesPane); + }else { + Component[][] components = new Component[][]{ + new Component[]{axisPane}, + new Component[]{new JSeparator()}, + new Component[]{seriesPane} + }; + this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); + } + + } + + + @Override + protected String title4PopupWindow() { + return null; + } + + @Override + public void populateBean(Plot plot) { + //获取位置信息 + if (axisPane != null) { + axisPane.populateBean(plot); + } + //获取界面信息 + seriesPane.populateBean(plot); + } + + @Override + public void updateBean(Plot plot) { + if(plot == null) { + return; + } + if(seriesPane != null) { + seriesPane.updateBean(plot); + } + if (axisPane != null){ + axisPane.updateBean(plot); + } + } + + @Override + public Plot updateBean() { + return null; + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesTabPane.java new file mode 100644 index 0000000000..5171f0be2c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesTabPane.java @@ -0,0 +1,116 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomPlotSeriesTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotSeriesTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + } + } + + @Override + protected List initPaneList() { + /** + * 獲取不同plot的系列面板 + */ + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + AbstractPlotSeriesPane seriesPane = (AbstractPlotSeriesPane) ChartTypeInterfaceManager.getInstance().getPlotSeriesPane((VanChartStylePane)parent, customPlotList.get(i)); + //根据不同的plot获取不同的控制控制位置界面,从Factory中获取 + BasicBeanPane plotPositionPane = CustomPlotDesignerPaneFactory.createCustomPlotPositionPane(customPlotList.get(i)); + + VanChartCustomPlotSeriesPane contentPane = new VanChartCustomPlotSeriesPane(plotPositionPane, seriesPane); + + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + /** + * 更新各个点的系列界面 + */ + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + + ((VanChartCustomPlotSeriesPane)paneList.get(i)).populateBean(vanChartPlot); + } + + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + /** + * 更新每个图表的数据 + */ + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + + VanChartCustomPlotSeriesPane plotSeriesPane = (VanChartCustomPlotSeriesPane) paneList.get(i); + + plotSeriesPane.updateBean(vanChartPlot); + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotTooltipTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotTooltipTabPane.java new file mode 100644 index 0000000000..09bdddb9fd --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotTooltipTabPane.java @@ -0,0 +1,118 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; +import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomPlotTooltipTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotTooltipTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + } + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + VanChartPlotTooltipPane contentPane = PlotFactory.createPlotTooltipPane(customPlotList.get(i), (VanChartStylePane) parent); + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + DataSeriesCondition attr = vanChartPlot.getAttrTooltipFromConditionCollection(); + ((VanChartPlotTooltipPane)paneList.get(i)).populate((AttrTooltip) attr); + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + if(plot == null) { + return; + } + + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + + ConditionAttr attrList = vanChartPlot.getConditionCollection().getDefaultAttr(); + + //移除所有数据点提示相关属性 + if(attrList.getExisted(AttrTooltip.class) != null){ + attrList.remove(AttrTooltip.class); + }else if (attrList.getExisted(ScatterAttrTooltip.class) != null){ + attrList.remove(ScatterAttrTooltip.class); + } + + VanChartPlotTooltipPane tooltipPane = (VanChartPlotTooltipPane) paneList.get(i); + + AttrTooltip attrTooltip = tooltipPane.update(); + if (attrTooltip != null) { + attrList.addDataSeriesCondition(attrTooltip); + } + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomSeriesPane.java new file mode 100644 index 0000000000..267f1e64c4 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomSeriesPane.java @@ -0,0 +1,145 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; +import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.component.VanChartBeautyPane; + +import javax.swing.*; +import java.awt.*; + + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomSeriesPane extends ChartSeriesPane { + + private JPanel seriesPane; + protected VanChartCustomPlotSeriesTabPane plotSeriesPane; + private ChartFillStylePane fillStylePane;//配色 + private VanChartBeautyPane stylePane;//风格 + + + + public VanChartCustomSeriesPane(ChartStylePane parent) { + super(parent); + } + + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initSeriesPane((VanChartCustomPlot) chart.getPlot()); + + //公共使用的部分 + seriesPane.add(plotSeriesPane, BorderLayout.CENTER); + + //每种不同的图表单独的设置部分 + if(seriesPane != null) { + contentPane.add(seriesPane, BorderLayout.CENTER); + } + return contentPane; + } + + /** + * 创建組合图系列界面 + */ + private void initSeriesPane(VanChartCustomPlot plot) { + + seriesPane = new JPanel(new BorderLayout(0, 10)); + //获取公共的属性面板 + seriesPane.add(initCommonPane(), BorderLayout.NORTH); + + plotSeriesPane = new VanChartCustomPlotSeriesTabPane(plot, parent); + } + + private JPanel initCommonPane() { + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p,p,p}; + double[] col = {f}; + + fillStylePane = new ChartFillStylePane(); + + stylePane = new VanChartBeautyPane(); + + Component[][] components = new Component[][]{ + new Component[]{fillStylePane}, //配色 + new Component[]{new JSeparator()}, + new Component[]{stylePane},//风格 + new Component[]{new JSeparator()} + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + + } + + /** + * 保存界面属性 + */ + @Override + public void updateBean(Chart chart) { + + if(chart == null) { + return; + } + + VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); + + if (fillStylePane != null){ + plot.setPlotFillStyle(fillStylePane.updateBean()); + } + if(stylePane != null) { + plot.setPlotStyle(stylePane.updateBean()); + + //风格属性传递 + for (int i = 0; i < plot.getCustomPlotList().size(); i++){ + VanChartPlot vanChartPlot = plot.getCustomPlotList().get(i); + vanChartPlot.setPlotStyle(plot.getPlotStyle()); + } + + } + if (seriesPane != null){ + plotSeriesPane.updateBean(plot); + } + } + + /** + * 更新界面 + */ + @Override + public void populateBean(Chart chart) { + this.chart = chart; + if(seriesPane == null) { + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + if(seriesPane != null) { + //更新渐变色和风格 + VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); + if(plot == null) { + return; + } + + + if(fillStylePane != null) {//配色 + fillStylePane.populateBean(plot.getPlotFillStyle()); + } + if(stylePane != null){//风格 + stylePane.populateBean(plot.getPlotStyle()); + } + + //更新不同点的系列界面 + plotSeriesPane.populateBean(plot); + } + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomStylePane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomStylePane.java new file mode 100644 index 0000000000..9ce02be6a6 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomStylePane.java @@ -0,0 +1,71 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomStylePane extends VanChartStylePane { + public VanChartCustomStylePane(AttributeChangeListener listener) { + super(listener); + } + + /** + * 根据不同的plot类型创建不同的标签界面 + * @param paneList + */ + @Override + protected void createVanChartLabelPane(List paneList) { + paneList.add(new VanChartCustomLabelPane(VanChartCustomStylePane.this)); + } + + /** + * 根据不同的plot类型创建不同的数据点提示界面 + * @param paneList + */ + @Override + protected void addVanChartTooltipPane(List paneList){ + paneList.add(new VanChartCustomTooltipPane(VanChartCustomStylePane.this)); + } + + /** + * 组合图以外的新图表类型都是使用ChartSeriesPane然后通过接口创建不同的seriesStyleContentPane + * 组合图类型不走那个接口,因为需要的系列界面完全是新的,需要像标签界面那样处理 + * @return + */ + @Override + protected ChartSeriesPane createChartSeriesPane() { + return new VanChartCustomSeriesPane(VanChartCustomStylePane.this); + } + + /** + * 当所有图表都不支持坐标轴时,则无坐标轴选项,否则创建和自定义柱形图一样的坐标轴 + * @param paneList + */ + @Override + protected void createVanChartAxisPane(List paneList, VanChartAxisPlot plot) { + paneList.add(new VanChartCustomAxisPane(VanChartCustomStylePane.this)); + } + + + @Override + protected void addVanChartAreaPane(List paneList) { + paneList.add(new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this)); + } + + @Override + public void update(ChartCollection collection) { + super.update(collection); + CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot()); + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomTooltipPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomTooltipPane.java new file mode 100644 index 0000000000..5a2ec5bbfc --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomTooltipPane.java @@ -0,0 +1,73 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomTooltipPane extends BasicScrollPane { + + private static final long serialVersionUID = -2974722365840564105L; + private VanChartCustomPlotTooltipTabPane tooltipPane; + private Chart chart; + protected VanChartStylePane parent; + + + public VanChartCustomTooltipPane(VanChartStylePane parent){ + super(); + this.parent = parent; + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initTooltipPane((VanChartCustomPlot) chart.getPlot()); + contentPane.add(tooltipPane, BorderLayout.NORTH); + return contentPane; + } + + private void initTooltipPane(VanChartCustomPlot plot) { + tooltipPane = new VanChartCustomPlotTooltipTabPane(plot, parent); + } + + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + + if(tooltipPane == null){ + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + + if(tooltipPane != null) { + tooltipPane.populateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart) { + if(chart == null) { + return; + } + + tooltipPane.updateBean((VanChartCustomPlot)chart.getPlot()); + + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Plugin-Chart_Tooltip"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/AbstractVanChartScrollPane.java b/designer_chart/src/com/fr/plugin/chart/designer/AbstractVanChartScrollPane.java new file mode 100644 index 0000000000..7d9eae143f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/AbstractVanChartScrollPane.java @@ -0,0 +1,30 @@ +package com.fr.plugin.chart.designer; + +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.iscrollbar.UIScrollBar; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by mengao on 2017/8/11. + */ +public abstract class AbstractVanChartScrollPane extends BasicScrollPane { + + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, original)); + this.add(leftcontentPane); + } + + protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) { + int width = parent.getWidth(); + int height = parent.getHeight(); + if (leftcontentPane.getPreferredSize().height > maxheight) { + leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth(), height + beginY); + scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); + } else { + leftcontentPane.setBounds(0, 0, width, height); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/PlotFactory.java b/designer_chart/src/com/fr/plugin/chart/designer/PlotFactory.java new file mode 100644 index 0000000000..b5a3828e06 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/PlotFactory.java @@ -0,0 +1,368 @@ +package com.fr.plugin.chart.designer; + +import com.fr.base.chart.chartdata.model.LargeDataModel; +import com.fr.chart.chartattr.Plot; +import com.fr.data.core.FormatField; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.gui.style.FormatPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.area.VanChartAreaPlot; +import com.fr.plugin.chart.bubble.VanChartBubblePlot; +import com.fr.plugin.chart.bubble.force.VanChartBubbleRefreshTooltipPane; +import com.fr.plugin.chart.column.VanChartColumnPlot; +import com.fr.plugin.chart.designer.component.VanChartLabelContentPane; +import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane; +import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane; +import com.fr.plugin.chart.designer.style.HeatMapRangeLegendPane; +import com.fr.plugin.chart.designer.style.VanChartPlotLegendPane; +import com.fr.plugin.chart.designer.style.VanChartRangeLegendPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.VanLegendPaneWidthOutHighlight; +import com.fr.plugin.chart.designer.style.label.VanChartGaugePlotLabelPane; +import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.funnel.VanChartFunnelPlot; +import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelLabelContentPane; +import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelRefreshTooltipContentPane; +import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelTooltipContentPane; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.plugin.chart.gantt.designer.style.VanChartGanttLabelContentPane; +import com.fr.plugin.chart.gantt.designer.style.tooltip.VanChartGanttPlotTooltipPane; +import com.fr.plugin.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.gauge.VanChartGaugePlotRefreshTooltipPane; +import com.fr.plugin.chart.gauge.VanChartGaugePlotTooltipPane; +import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; +import com.fr.plugin.chart.line.VanChartLinePlot; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.designer.style.label.VanChartMapLabelContentPane; +import com.fr.plugin.chart.map.designer.style.tooltip.VanChartMapRefreshTooltipContentPane; +import com.fr.plugin.chart.map.designer.style.tooltip.VanChartMapTooltipContentPane; +import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; +import com.fr.plugin.chart.multilayer.style.VanChartMultiPieLabelContentPane; +import com.fr.plugin.chart.multilayer.style.VanChartMultiPiePlotTooltipPane; +import com.fr.plugin.chart.multilayer.style.VanChartMultiPieTooltipContentPane; +import com.fr.plugin.chart.multilayer.style.VanChartMutiPieRefreshTooltipContentPane; +import com.fr.plugin.chart.scatter.VanChartScatterPlot; +import com.fr.plugin.chart.scatter.VanChartScatterPlotTooltipPane; +import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane; +import com.fr.plugin.chart.scatter.component.label.VanChartScatterPlotLabelPane; +import com.fr.plugin.chart.structure.VanChartStructurePlot; +import com.fr.plugin.chart.structure.desinger.style.VanChartStructureLabelContentPane; +import com.fr.plugin.chart.structure.desinger.style.VanChartStructureRefreshTooltipContentPane; +import com.fr.plugin.chart.structure.desinger.style.VanChartStructureTooltipContentPane; +import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; +import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; +import com.fr.plugin.chart.wordcloud.designer.style.VanChartWordCloudRefreshTootipContentPane; +import com.fr.plugin.chart.wordcloud.designer.style.VanChartWordCloudTooltipContentPane; + +import javax.swing.*; +import java.awt.*; +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Mitisky on 16/3/1. + * 图表配置界面的工厂 + */ +public class PlotFactory { + + private static Set> autoAdjustLabelPlots = new HashSet>(); + + static { + autoAdjustLabelPlots.add(VanChartColumnPlot.class); + autoAdjustLabelPlots.add(VanChartLinePlot.class); + autoAdjustLabelPlots.add(VanChartAreaPlot.class); + autoAdjustLabelPlots.add(VanChartStructurePlot.class); + } + + public static boolean plotAutoAdjustLabelPosition(Plot plot){ + return autoAdjustLabelPlots.contains(plot.getClass()); + } + /** + * + * 标签Map + */ + private static Map, Class> labelMap = new HashMap, Class>(); + static { + labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); + labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); + labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class); + } + + /** + * 图例Map + */ + private static Map, Class> legendMap = new HashMap, Class>(); + static { + legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); + legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); + legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartMapPlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartDrillMapPlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartHeatMapPlot.class, HeatMapRangeLegendPane.class); + legendMap.put(VanChartWordCloudPlot.class, VanChartRangeLegendPane.class); + } + + /** + * 数据点提示Map + */ + private static Map, Class> toolTipMap = new HashMap, Class>(); + static { + toolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotTooltipPane.class); + toolTipMap.put(VanChartScatterPlot.class, VanChartScatterPlotTooltipPane.class); + toolTipMap.put(VanChartBubblePlot.class, VanChartScatterPlotTooltipPane.class); + toolTipMap.put(VanChartMultiPiePlot.class, VanChartMultiPiePlotTooltipPane.class); + toolTipMap.put(VanChartTreeMapPlot.class, VanChartMultiPiePlotTooltipPane.class); + toolTipMap.put(VanChartGanttPlot.class, VanChartGanttPlotTooltipPane.class); + } + + private static Map, Class> labelContentMap = new HashMap, Class>(); + + static { + labelContentMap.put(VanChartMapPlot.class, VanChartMapLabelContentPane.class); + labelContentMap.put(VanChartDrillMapPlot.class, VanChartMapLabelContentPane.class); + labelContentMap.put(VanChartMultiPiePlot.class, VanChartMultiPieLabelContentPane.class); + labelContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieLabelContentPane.class); + labelContentMap.put(VanChartFunnelPlot.class, VanChartFunnelLabelContentPane.class); + labelContentMap.put(VanChartHeatMapPlot.class, VanChartMapLabelContentPane.class); + labelContentMap.put(VanChartGanttPlot.class, VanChartGanttLabelContentPane.class); + labelContentMap.put(VanChartStructurePlot.class, VanChartStructureLabelContentPane.class); + } + + private static Map, Class> tooltipContentMap = new HashMap, Class>(); + + static { + tooltipContentMap.put(VanChartMapPlot.class, VanChartMapTooltipContentPane.class); + tooltipContentMap.put(VanChartDrillMapPlot.class, VanChartMapTooltipContentPane.class); + tooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMultiPieTooltipContentPane.class); + tooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieTooltipContentPane.class); + tooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelTooltipContentPane.class); + tooltipContentMap.put(VanChartHeatMapPlot.class, VanChartMapTooltipContentPane.class); + tooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudTooltipContentPane.class); + tooltipContentMap.put(VanChartGanttPlot.class, VanChartGanttTooltipContentPane.class); + tooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureTooltipContentPane.class); + } + + + + /** + * 监控刷新 自动数据点提示Map + */ + + + private static Map, Class> refreshToolTipMap = new HashMap, Class>(); + static { + refreshToolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotRefreshTooltipPane.class); + refreshToolTipMap.put(VanChartBubblePlot.class, VanChartBubbleRefreshTooltipPane.class); + + } + private static Map, Class> refreshTooltipContentMap = new HashMap, Class>(); + + static { + refreshTooltipContentMap.put(VanChartMapPlot.class, VanChartMapRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartHeatMapPlot.class, VanChartMapRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartDrillMapPlot.class, VanChartMapRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartScatterPlot.class, VanChartScatterRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartBubblePlot.class, VanChartScatterRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMutiPieRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMutiPieRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTootipContentPane.class); + refreshTooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureRefreshTooltipContentPane.class); + + } + + /** + * 根据图表类型创建标签界面 + * @param plot 图表 + * @param stylePane 样式界面 + * @return 标签界面 + */ + public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane) { + Class key = plot.getClass(); + if(labelMap.containsKey(key)){ + try{ + Class cl = labelMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + return constructor.newInstance(plot, stylePane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotLabelPane(plot, stylePane); + } + + /** + * 根据图表类型创建图例界面 + * @param plot 图表 + * @param stylePane 样式界面 + * @return 图例界面 + */ + public static VanChartPlotLegendPane createPlotLegendPane(Plot plot, VanChartStylePane stylePane) { + Class key = plot.getClass(); + if(legendMap.containsKey(key)){ + try{ + Class cl = legendMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class); + return constructor.newInstance(stylePane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotLegendPane(stylePane); + } + + /** + * 根据图表类型创建数据点提示界面 + * @param plot 图表 + * @param stylePane 样式界面 + * @return 数据点提示界面 + */ + public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { + Class key = plot.getClass(); + if(toolTipMap.containsKey(key)){ + try{ + Class cl = toolTipMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + return constructor.newInstance(plot, stylePane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotTooltipPane(plot, stylePane); + } + + /** + * 根据图表类型创建标签的具体内容界面.分类名系列名等 + * @param plot 图表 + * @param parent 样式界面 + * @param showOnPane formatpane用到 + * @return 标签的具体内容界面 + */ + public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + Class key = plot.getClass(); + if(labelContentMap.containsKey(key)){ + try{ + Class cl = labelContentMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + return constructor.newInstance(parent, showOnPane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartLabelContentPane(parent, showOnPane); + } + + /** + * 根据图表类型创建数据点提示的具体内容界面.分类名系列名等 + * @param plot 图表 + * @param parent 样式界面 + * @param showOnPane formatpane用到 + * @return 数据点提示的具体内容界面 + */ + public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + Class key = plot.getClass(); + if(tooltipContentMap.containsKey(key)){ + try{ + Class cl = tooltipContentMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + return constructor.newInstance(parent, showOnPane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartTooltipContentPane(parent, showOnPane); + } + + + + /** + * 根据图表类型创建数据点提示界面 + * @param plot 图表 + * @return 数据点提示界面 + */ + public static VanChartPlotTooltipPane createPlotRefreshTooltipPane(Plot plot) { + Class key = plot.getClass(); + if(refreshToolTipMap.containsKey(key)){ + try{ + Class cl = refreshToolTipMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class); + return constructor.newInstance(plot); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotRefreshTooltipPane(plot); + } + /** + * 根据图表类型创建监控刷新中数据点提示的具体内容界面.分类名系列名等 + * @param plot 图表 + * @param parent 交互属性界面 + * @param showOnPane formatpane用到 + * @return 数据点提示的具体内容界面 + */ + public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + Class key = plot.getClass(); + if(refreshTooltipContentMap.containsKey(key)){ + try{ + Class cl = refreshTooltipContentMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + return constructor.newInstance(parent, showOnPane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartRefreshTooltipContentPane(parent, showOnPane); + } + + public static FormatPane createAutoFormatPane(){ + FormatPane formatPane = new FormatPane(){ + protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { + return new Component[][]{ + new Component[]{typePane,null}, + new Component[]{centerPane, null}, + }; + } + protected UIComboBoxRenderer createComBoxRender(){ + return new UIComboBoxRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (value instanceof Integer) { + String text = ComparatorUtils.equals(value, FormatField.FormatContents.NULL) + ? Inter.getLocText("Plugin-ChartF_Auto") + : FormatField.getInstance().getName((Integer) value); + label.setText(" " + text); + } + return label; + } + }; + } + }; + + formatPane.setComboBoxModel(true); + + return formatPane; + } + + /** + * 判断是否为大数据模式 + */ + public static boolean largeDataModel(Plot plot){ + return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; + } + + public static boolean lineMapLargeModel(Plot plot){ + return plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getLineMapDataProcessor().getMark() == LargeDataModel.MARK; + } +} + diff --git a/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java new file mode 100644 index 0000000000..cda309aaa8 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java @@ -0,0 +1,112 @@ +package com.fr.plugin.chart.designer; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 布局 标题+组件 + */ +public class TableLayout4VanChartHelper { + + private static final int SMALL_GAP = 20; + public static final int EXPANDABLE_PANE_WIDTH =290; + public static final int EXPANDABLE_PANE_HIGHT =24; + + + public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { + return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel); + } + + public static JPanel createGapTableLayoutPane(String title, Component component) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText(title)), component}, + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, SMALL_GAP, LayoutConstants.VGAP_LARGE); + } + + public static JPanel createGapTableLayoutPane(Component[][] components, + double[] rowSize, double[] columnSize) { + + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, SMALL_GAP, LayoutConstants.VGAP_LARGE); + } + + public static JPanel createGapTableLayoutPane(Component[][] components, + double[] rowSize, double[] columnSize, int[][] rowCount) { + + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, + SMALL_GAP, LayoutConstants.VGAP_LARGE); + } + + /** + * 标题布局(二级菜单距左边框46) + * @param title 标题 + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ + return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); + } + + /** + * 标题布局(二级菜单距左边框46) + * @param label 标题label + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component){ + return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN); + } + + /** + * 标题布局(三级菜单距二级左侧20) + * @param title 标题 + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component){ + return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP); + } + + /** + * 标题布局(指定gap) + * @param title 标题 + * @param component 组件 + * @param gap 距左侧距离 + * @return 布局好的组件 + */ + public static JPanel createTitlePane(String title, Component component, int gap){ + return createTitlePaneWithUILabel(new UILabel(title), component, gap); + } + + /** + * 标题布局(指定gap) + * @param label 标题label + * @param component 组件 + * @param gap 距左侧距离 + * @return 布局好的组件 + */ + public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {gap, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{label,null}, + new Component[]{null,component}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/ConditionUIMenuNameableCreator.java b/designer_chart/src/com/fr/plugin/chart/designer/component/ConditionUIMenuNameableCreator.java new file mode 100644 index 0000000000..5b78f970a8 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/ConditionUIMenuNameableCreator.java @@ -0,0 +1,44 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.FRLogger; + +import java.lang.reflect.Constructor; + +/** + * Created by hufan on 2016/11/15. + */ +public class ConditionUIMenuNameableCreator extends UIMenuNameableCreator { + private Plot plot; + + public ConditionUIMenuNameableCreator(Plot plot, String name, Object obj, Class paneClazz) { + super(name, obj, paneClazz); + this.plot = plot; + } + + public UIMenuNameableCreator clone() { + Object cloneObj = null; + try { + cloneObj = obj.getClass().newInstance(); + } catch (InstantiationException e) { + FRLogger.getLogger().error("UIMenuNameableCreator InstantiationException"); + } catch (IllegalAccessException e) { + FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); + } + return new ConditionUIMenuNameableCreator(plot, name, cloneObj, (Class) this.paneClazz); + + } + + public BasicBeanPane getPane() { + try { + Constructor constructor = paneClazz.getConstructor(Plot.class); + return constructor.newInstance(plot); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage(), e); + } + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartAreaSeriesFillColorPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartAreaSeriesFillColorPane.java new file mode 100644 index 0000000000..0387dd365d --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartAreaSeriesFillColorPane.java @@ -0,0 +1,64 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.VanChartAttrHelper; +import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; +import com.fr.plugin.chart.designer.component.background.VanChartMarkerBackgroundPane; + +import java.awt.*; + +/** + * 面积图填充色设置界面 + */ +public class VanChartAreaSeriesFillColorPane extends BasicPane { + private static final long serialVersionUID = 9166866984438854779L; + private VanChartMarkerBackgroundPane fillColorPane; + private UINumberDragPane transparent; + + public VanChartAreaSeriesFillColorPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p}; + double[] col = {f}; + fillColorPane = new VanChartMarkerBackgroundPane(); + transparent = new UINumberDragPane(0, 100); + + Component[][] components = new Component[][]{ + new Component[]{fillColorPane}, + new Component[]{transparent}, + }; + + this.add(TableLayoutHelper.createTableLayoutPane(components, row, col)); + } + + protected String title4PopupWindow(){ + return Inter.getLocText("Plugin-ChartF_FillColor"); + } + + public void populate(AttrAreaSeriesFillColorBackground fillColorBackground) { + if(fillColorBackground == null){ + fillColorBackground = new AttrAreaSeriesFillColorBackground(); + } + fillColorPane.populate(fillColorBackground.getColorBackground()); + transparent.populateBean(fillColorBackground.getAlpha() * VanChartAttrHelper.PERCENT); + } + + public AttrAreaSeriesFillColorBackground update() { + AttrAreaSeriesFillColorBackground fillColorBackground = new AttrAreaSeriesFillColorBackground(); + fillColorBackground.setColorBackground(fillColorPane.update()); + fillColorBackground.setAlpha(transparent.updateBean()/VanChartAttrHelper.PERCENT); + return fillColorBackground; + } + + /** + * 检查透明的设置是否有效 + * @param enable + */ + public void checkoutAlpha(boolean enable) { + transparent.setEnabled(enable); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartBeautyPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartBeautyPane.java new file mode 100644 index 0000000000..e8c85515c5 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartBeautyPane.java @@ -0,0 +1,69 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 15/9/8. + */ +//系列-风格 +public class VanChartBeautyPane extends BasicBeanPane { + private UIButtonGroup styleBox; + + public VanChartBeautyPane() { + styleBox = new UIButtonGroup(getNameArray()); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Style")), styleBox}, + } ; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected String[] getNameArray(){ + return new String[]{Inter.getLocText("Chart-Default_Name"), + Inter.getLocText("Plugin-Chart_TopDownShade") + }; + } + @Override + public void populateBean(Integer ob) { + int finalIndex; + switch (ob){ + case ChartConstants.STYLE_NONE: finalIndex = 0; break; + case ChartConstants.STYLE_SHADE: finalIndex = 1; break; + default: finalIndex = 0; + } + styleBox.setSelectedIndex(finalIndex); + } + + @Override + public Integer updateBean() { + int index = styleBox.getSelectedIndex(); + int style; + switch (index){ + case 0: style = ChartConstants.STYLE_NONE; break; + case 1: style = ChartConstants.STYLE_SHADE; break; + default: style = ChartConstants.STYLE_NONE; + } + return style; + } + + @Override + protected String title4PopupWindow() { + return ""; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFillStylePane4Condition.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFillStylePane4Condition.java new file mode 100644 index 0000000000..ee431e1c8f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFillStylePane4Condition.java @@ -0,0 +1,41 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * 配色 只有下拉框控件无配色title。 条件属性 配色中用到 + */ +public class VanChartFillStylePane4Condition extends ChartFillStylePane { + private static final long serialVersionUID = 2470094484790112401L; + + @Override + protected void initLayout() { + customPane.setPreferredSize(new Dimension(200, 130)); + colorGradient.setPreferredSize(new Dimension(120, 30)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { f }; + double[] rowSize = { p, p}; + Component[][] components = new Component[][]{ + new Component[]{styleSelectBox}, + new Component[]{customPane} + } ; + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + @Override + public Dimension getPreferredSize() { + if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { + return new Dimension(styleSelectBox.getPreferredSize().width, 20); + } + return super.getPreferredSize(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFloatPositionPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFloatPositionPane.java new file mode 100644 index 0000000000..753bcd389f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFloatPositionPane.java @@ -0,0 +1,81 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; + +/** + * 悬浮位置 标题和图例用到 + */ +public class VanChartFloatPositionPane extends BasicBeanPane { + private static final long serialVersionUID = -4773313488161065678L; + private UISpinner floatPosition_x; + private UISpinner floatPosition_y; + + public VanChartFloatPositionPane(){ + + this.setLayout(new BorderLayout()); + + this.add(new UILabel(Inter.getLocText("plugin-ChartF_XYFromTheUpLeft")), BorderLayout.CENTER); + + this.add(createCustomFloatPositionPane(), BorderLayout.SOUTH); + } + + private JPanel createCustomFloatPositionPane(){ + floatPosition_x = new UISpinner(0,100,1,0); + floatPosition_y = new UISpinner(0,100,1,0); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_positionX")+": "),floatPosition_x}, + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_positionY")+": "),floatPosition_y} + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + public void setFloatPosition_x(double floatPosition_x) { + this.floatPosition_x.setValue(floatPosition_x); + } + + public void setFloatPosition_y(double floatPosition_y) { + this.floatPosition_y.setValue(floatPosition_y); + } + + public double getFloatPosition_x() { + return floatPosition_x.getValue(); + } + + public double getFloatPosition_y() { + return floatPosition_y.getValue(); + } + + + /** + * 弹出框标题 + * @return 标题 + */ + public String title4PopupWindow() { + return StringUtils.EMPTY; + } + + @Override + public Chart updateBean() { + return null; + } + + @Override + public void populateBean(Chart ob) { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPane.java new file mode 100644 index 0000000000..107ec5b667 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPane.java @@ -0,0 +1,199 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.KeyWords; +import com.fr.design.gui.autocomplete.AutoCompletion; +import com.fr.design.gui.autocomplete.BasicCompletion; +import com.fr.design.gui.autocomplete.DefaultCompletionProvider; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartHtmlLabel; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by Mitisky on 16/2/19. + */ +public class VanChartHtmlLabelPane extends JPanel{ + + private static final long serialVersionUID = -5512128966013558611L; + private static final int JS_HEIGHT = 100; + + private RSyntaxTextArea contentTextArea; + private UIToggleButton useHtml; + + private UICheckBox isCustomWidth; + private UITextField customWidth; + private UICheckBox isCustomHeight; + private UITextField customHeight; + + private VanChartStylePane parent; + + public void setCustomFormatterText(String text){ + contentTextArea.setText(text); + } + + public void setParent(VanChartStylePane parent) { + this.parent = parent; + } + + public VanChartHtmlLabelPane() { + useHtml = new UIToggleButton(Inter.getLocText("Plugin-ChartF_Html")); + JPanel widthAndHeightPane = createWidthAndHeightPane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{createJSContentPane()}, + new Component[]{useHtml}, + new Component[]{widthAndHeightPane} + }; + + JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + this.setLayout(new BorderLayout()); + this.add(contentPane, BorderLayout.CENTER); + } + + private JComponent createJSContentPane() { + contentTextArea = new RSyntaxTextArea(); + contentTextArea.setCloseCurlyBraces(true); + contentTextArea.setLineWrap(true); + contentTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT); + contentTextArea.setCodeFoldingEnabled(true); + contentTextArea.setAntiAliasingEnabled(true); + contentTextArea.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + fireJSChange(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + fireJSChange(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + fireJSChange(); + } + }); + + DefaultCompletionProvider provider = new DefaultCompletionProvider(); + + for (String key : KeyWords.JAVASCRIPT) { + provider.addCompletion(new BasicCompletion(provider, key)); + } + + AutoCompletion ac = new AutoCompletion(provider); + String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts(); + + ac.setTriggerKey(KeyStroke.getKeyStroke(shortCuts.replace("+", "pressed"))); + ac.install(contentTextArea); + + return new UIScrollPane(contentTextArea){ + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, JS_HEIGHT); + } + }; + } + + private void fireJSChange() { + if(parent != null){ + parent.attributeChanged(); + } + } + + protected JPanel createWidthAndHeightPane() { + isCustomWidth = new UICheckBox(Inter.getLocText("Plugin-ChartF_Custom_Width")); + customWidth = new UITextField(6); + isCustomHeight = new UICheckBox(Inter.getLocText("Plugin-ChartF_Custom_Height")); + customHeight = new UITextField(6); + + isCustomWidth.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + checkWidth(); + } + }); + isCustomHeight.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkHeight(); + } + }); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p, f }; + double[] rowSize = { p, p}; + + Component[][] components = new Component[][]{ + new Component[]{isCustomWidth, customWidth}, + new Component[]{isCustomHeight, customHeight}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + private void checkWidth() { + customWidth.setEnabled(isCustomWidth.isSelected()); + } + + private void checkHeight() { + customHeight.setEnabled(isCustomHeight.isSelected()); + } + + private void checkBoxUse() { + checkHeight(); + checkWidth(); + } + + public void populate(VanChartHtmlLabel htmlLabel){ + if(htmlLabel == null){ + return; + } + setCustomFormatterText(htmlLabel.getCustomText()); + useHtml.setSelected(htmlLabel.isUseHtml()); + populateWidthAndHeight(htmlLabel); + } + + protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + isCustomWidth.setSelected(htmlLabel.isCustomWidth()); + customWidth.setText(htmlLabel.getWidth()); + isCustomHeight.setSelected(htmlLabel.isCustomHeight()); + customHeight.setText(htmlLabel.getHeight()); + checkBoxUse(); + } + + public void update(VanChartHtmlLabel htmlLabel) { + if(htmlLabel == null){ + return; + } + htmlLabel.setCustomText(contentTextArea.getText()); + htmlLabel.setUseHtml(useHtml.isSelected()); + updateWidthAndHeight(htmlLabel); + } + + protected void updateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + htmlLabel.setCustomWidth(isCustomWidth.isSelected()); + htmlLabel.setWidth(customWidth.getText()); + htmlLabel.setCustomHeight(isCustomHeight.isSelected()); + htmlLabel.setHeight(customHeight.getText()); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java new file mode 100644 index 0000000000..3204cec2ab --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.plugin.chart.base.VanChartHtmlLabel; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/19. + * 不能设置宽高 + */ +public class VanChartHtmlLabelPaneWithOutWidthAndHeight extends VanChartHtmlLabelPane { + private static final long serialVersionUID = -9213286452724939880L; + + protected JPanel createWidthAndHeightPane() { + return new JPanel(); + } + + protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + } + protected void updateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLabelContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLabelContentPane.java new file mode 100644 index 0000000000..182adca90f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLabelContentPane.java @@ -0,0 +1,18 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +public class VanChartLabelContentPane extends VanChartTooltipContentPane { + + private static final long serialVersionUID = 5630276526789839288L; + + public VanChartLabelContentPane(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected VanChartHtmlLabelPane createHtmlLabelPane() { + return new VanChartHtmlLabelPane(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineTypePane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineTypePane.java new file mode 100644 index 0000000000..df37ecced0 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineTypePane.java @@ -0,0 +1,95 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.type.LineStyle; +import com.fr.plugin.chart.base.VanChartAttrLine; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; + +/** + * line相关设置 + */ +public class VanChartLineTypePane extends BasicPane { + + private static final long serialVersionUID = -6581862503009962973L; + protected LineComboBox lineWidth;//线型 + protected UIButtonGroup lineStyle;//形态 + protected UIButtonGroup nullValueBreak;//空值断开 + + public VanChartLineTypePane() { + lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + + createLineStyle(); + + nullValueBreak = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); + + this.setLayout(new BorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + this.add(createContentPane(p, f), BorderLayout.CENTER); + } + + protected void createLineStyle() { + String[] textArray = new String[]{Inter.getLocText("Plugin-ChartF_NormalLine"), + Inter.getLocText("Plugin-ChartF_StepLine"), Inter.getLocText("Plugin-ChartF_CurveLine")}; + lineStyle = new UIButtonGroup(textArray, LineStyle.values()); + } + + protected JPanel createContentPane(double p, double f) { + double[] row = {p, p, p, p, p, p}; + double[] col = {p, f}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle"))}, + new Component[]{lineWidth, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Style_Present"))}, + new Component[]{lineStyle, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Null_Value_Break"))}, + new Component[]{nullValueBreak, null}, + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + } + + public void checkLarge(boolean large){ + if(large){ + lineWidth.setSelectedLineStyle(Constants.LINE_NONE); + } + lineWidth.setEnabled(!large); + lineStyle.setEnabled(!large); + } + + protected String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_Line"); + } + + public void populate(VanChartAttrLine line) { + if (line == null) { + line = initVanChartAttrLine(); + } + lineWidth.setSelectedLineStyle(line.getLineWidth()); + lineStyle.setSelectedItem(line.getLineStyle()); + nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1); + } + + protected VanChartAttrLine initVanChartAttrLine() { + return new VanChartAttrLine(); + } + + public VanChartAttrLine update() { + VanChartAttrLine line = new VanChartAttrLine(); + line.setLineWidth(lineWidth.getSelectedLineStyle()); + line.setLineStyle(lineStyle.getSelectedItem()); + line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0); + return line; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineWidthPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineWidthPane.java new file mode 100644 index 0000000000..3703458444 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineWidthPane.java @@ -0,0 +1,27 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 线-线型 + */ +public class VanChartLineWidthPane extends VanChartLineTypePane { + private static final long serialVersionUID = 4537158946119294689L; + + protected JPanel createContentPane(double p, double f) { + double[] row = {p, p}; + double[] col = {p,f}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")), lineWidth}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Null_Value_Break")), nullValueBreak}, + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartMarkerPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartMarkerPane.java new file mode 100644 index 0000000000..16a5dde8cc --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartMarkerPane.java @@ -0,0 +1,120 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartAttrMarker; +import com.fr.plugin.chart.designer.component.marker.VanChartCommonMarkerPane; +import com.fr.plugin.chart.designer.component.marker.VanChartImageMarkerPane; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * 标记点设置界面 + */ +public class VanChartMarkerPane extends BasicPane { + private static final long serialVersionUID = 7206339620703021514L; + private UIButtonGroup commonORCustom; + private JPanel centerPane; + private CardLayout cardLayout; + + private BasicBeanPane commonMarkerPane; + + private BasicBeanPane imageMarkerPane; + + public VanChartMarkerPane() { + this.setLayout(new BorderLayout(0, 4)); + + String[] array = new String[]{Inter.getLocText("Plugin-ChartF_Rule"), Inter.getLocText("Plugin-ChartF_Custom")}; + commonORCustom = new UIButtonGroup(array, array); + + commonORCustom.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCenterPane(); + } + }); + + commonMarkerPane = createCommonMarkerPane(); + imageMarkerPane = createImageMarkerPane(); + + cardLayout = new CardLayout(); + centerPane = new JPanel(cardLayout) { + + @Override + public Dimension getPreferredSize() { + if(commonORCustom.getSelectedIndex() == 0){ + return commonMarkerPane.getPreferredSize(); + } else { + return imageMarkerPane.getPreferredSize(); + } + } + }; + centerPane.add(commonMarkerPane, Inter.getLocText("Plugin-ChartF_Rule")); + centerPane.add(imageMarkerPane, Inter.getLocText("Plugin-ChartF_Custom")); + + layoutComponents(); + } + + public void checkLargePlot(boolean large){ + if(large){ + commonORCustom.setSelectedIndex(0); + checkCenterPane(); + } + commonORCustom.setEnabled(!large); + } + + protected BasicBeanPane createImageMarkerPane() { + return new VanChartImageMarkerPane(); + } + + protected BasicBeanPane createCommonMarkerPane() { + return new VanChartCommonMarkerPane(); + } + + protected void layoutComponents() { + this.add(commonORCustom, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + protected void layoutComponentsWithOutNorth() { + this.add(centerPane, BorderLayout.CENTER); + } + + private void checkCenterPane() { + cardLayout.show(centerPane, commonORCustom.getSelectedItem()); + } + + protected String title4PopupWindow(){ + return Inter.getLocText("Plugin-ChartF_Marker"); + } + + public void populate(VanChartAttrMarker marker) { + if(marker == null){ + marker = new VanChartAttrMarker(); + } + commonORCustom.setSelectedIndex(marker.isCommon() ? 0 : 1); + if(marker.isCommon()){ + commonMarkerPane.populateBean(marker); + } else { + imageMarkerPane.populateBean(marker); + } + + checkCenterPane(); + } + + public VanChartAttrMarker update() { + VanChartAttrMarker marker = new VanChartAttrMarker(); + if(commonORCustom.getSelectedIndex() == 0){ + commonMarkerPane.updateBean(marker); + } else { + imageMarkerPane.updateBean(marker); + } + return marker; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartPlotMultiTabPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartPlotMultiTabPane.java new file mode 100644 index 0000000000..3e1fa02f78 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartPlotMultiTabPane.java @@ -0,0 +1,104 @@ +package com.fr.plugin.chart.designer.component; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Dimension; +import java.util.List; + +import javax.swing.JPanel; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ibutton.UITabGroup; + +/** + * + * 标准的多层Tab切换类型. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-4-22 上午10:31:03 + */ +public abstract class VanChartPlotMultiTabPane extends FurtherBasicBeanPane{ + private static final long serialVersionUID = 2298609199400393886L; + protected UITabGroup tabPane; + protected String[] NameArray; + protected JPanel centerPane; + protected CardLayout cardLayout; + protected List paneList; + + //提供一个可以根据plot信息创建paneList的类 + protected E plot; + //承载该容器的父类容器 + protected BasicPane parent; + + //屬性變化的監聽器,在構造數據配置面板時用到 + protected AttributeChangeListener listener = null; + + protected abstract List initPaneList(); + + public abstract void populateBean(T ob); + public abstract void updateBean(T ob); + + public VanChartPlotMultiTabPane(E plot, BasicPane parent) { + this(plot, parent, null); + } + + public VanChartPlotMultiTabPane(E plot, BasicPane parent, AttributeChangeListener listener) { + this.plot = plot; + this.parent = parent; + this.listener = listener; + cardLayout = new CardLayout(); + paneList = initPaneList(); + relayoutWhenListChange(); + } + + public int getSelectedIndex() { + return tabPane.getSelectedIndex(); + } + + /** + * 当List中的界面变化时, 重新布局 + */ + public void relayoutWhenListChange() { + centerPane = new JPanel(cardLayout) { + @Override + public Dimension getPreferredSize() { + if (tabPane.getSelectedIndex() == -1) { + return super.getPreferredSize(); + } else { + return paneList.get(tabPane.getSelectedIndex()).getPreferredSize(); + } + } + }; + NameArray = new String[paneList.size()]; + for (int i = 0; i < paneList.size(); i++) { + BasicPane pane = (BasicPane) paneList.get(i); + NameArray[i] = pane.getTitle(); + centerPane.add(pane, NameArray[i]); + } + + tabPane = new UITabGroup(NameArray) { + @Override + public void tabChanged(int index) { + dealWithTabChanged(index); + } + }; + tabPane.setSelectedIndex(0); + tabPane.tabChanged(0); + initLayout(); + } + + protected void dealWithTabChanged(int index) { + cardLayout.show(centerPane, NameArray[index]); + tabChanged(); + } + + protected void tabChanged() { + + } + + protected void initLayout() { + this.setLayout(new BorderLayout(0, 4)); + this.add(tabPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartRefreshTooltipContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartRefreshTooltipContentPane.java new file mode 100644 index 0000000000..8bd8fc4e16 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartRefreshTooltipContentPane.java @@ -0,0 +1,42 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.plugin.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by mengao on 2017/6/5. + */ +public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPane { + + public VanChartRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { + super(null, showOnPane); + } + + protected double[] getRowSize(double p){ + return new double[]{p,p,p,p,p,p}; + } + + @Override + protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initFormatPane(parent, showOnPane); + + changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); + changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); + } + + protected Component[][] getPaneComponents(){ + return new Component[][]{ + new Component[]{categoryNameFormatPane,null}, + new Component[]{seriesNameFormatPane,null}, + new Component[]{valueFormatPane,null}, + new Component[]{changedValueFormatPane,null}, + new Component[]{percentFormatPane,null}, + new Component[]{changedPercentFormatPane,null}, + }; + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTooltipContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTooltipContentPane.java new file mode 100644 index 0000000000..bebe2af7c6 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTooltipContentPane.java @@ -0,0 +1,243 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.PercentFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.ValueFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 内容界面 。数据点提示 + */ +public class VanChartTooltipContentPane extends BasicBeanPane { + + private static final long serialVersionUID = 8825929000117843641L; + + protected UIButtonGroup content; + protected ValueFormatPaneWithCheckBox valueFormatPane; + protected PercentFormatPaneWithCheckBox percentFormatPane; + protected CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; + protected SeriesNameFormatPaneWithCheckBox seriesNameFormatPane; + + //监控刷新时,自动数据点提示使用 + protected ChangedValueFormatPaneWithCheckBox changedValueFormatPane; + protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; + + private JPanel centerPane; + private VanChartHtmlLabelPane htmlLabelPane; + + private VanChartStylePane parent; + private JPanel showOnPane; + + public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ + this.parent = parent; + this.showOnPane = showOnPane; + + this.setLayout(new BorderLayout()); + this.add(createLabelContentPane(),BorderLayout.CENTER); + } + + private JPanel createLabelContentPane() { + content = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Common"), + Inter.getLocText("Plugin-ChartF_Custom")}); + + initFormatPane(parent, showOnPane); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, p}; + double[] rowSize = getRowSize(p); + + final JPanel commonPanel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); + + htmlLabelPane = createHtmlLabelPane(); + htmlLabelPane.setParent(parent); + + centerPane = new JPanel(new CardLayout()){ + @Override + public Dimension getPreferredSize() { + if(content.getSelectedIndex() == 0){ + return commonPanel.getPreferredSize(); + } else { + return new Dimension(commonPanel.getPreferredSize().width,htmlLabelPane.getPreferredSize().height); + } + } + }; + centerPane.add(htmlLabelPane, Inter.getLocText("Plugin-ChartF_Custom")); + centerPane.add(commonPanel,Inter.getLocText("Plugin-ChartF_Common")); + + double[] column = {p, f}; + double[] row = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{null,null}, + new Component[]{new UILabel(getLabelContentTitle()),content}, + new Component[]{null,centerPane}, + }; + initContentListener(); + JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); + return getLabelContentPane(contentPane); + } + + protected String getLabelContentTitle () { + return Inter.getLocText("FR-Designer_Text"); + } + + protected JPanel getLabelContentPane(JPanel contentPane) { + return createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Content"), contentPane); + } + + protected VanChartHtmlLabelPane createHtmlLabelPane() { + return new VanChartHtmlLabelPaneWithOutWidthAndHeight(); + } + + protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ + categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); + seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); + valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); + percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); + } + + protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); + } + + protected double[] getRowSize(double p){ + return new double[]{p,p,p,p}; + } + + protected Component[][] getPaneComponents(){ + return new Component[][]{ + new Component[]{categoryNameFormatPane,null}, + new Component[]{seriesNameFormatPane,null}, + new Component[]{valueFormatPane,null}, + new Component[]{percentFormatPane,null}, + }; + } + + private void initContentListener() { + content.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + } + + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (content.getSelectedIndex() == 1) { + cardLayout.show(centerPane,Inter.getLocText("Plugin-ChartF_Custom")); + if(isDirty()){ + setCustomFormatterText(); + setDirty(false); + } + } else { + cardLayout.show(centerPane, Inter.getLocText("Plugin-ChartF_Common")); + } + } + + protected void setCustomFormatterText() { + htmlLabelPane.setCustomFormatterText(updateBean().getFormatterTextFromCommon()); + } + + public boolean isDirty() { + return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty(); + } + + public void setDirty(boolean isDirty) { + categoryNameFormatPane.setDirty(isDirty); + seriesNameFormatPane.setDirty(isDirty); + valueFormatPane.setDirty(isDirty); + percentFormatPane.setDirty(isDirty); + + if (changedValueFormatPane != null) { + changedValueFormatPane.setDirty(isDirty); + } + if (changedPercentFormatPane != null) { + changedPercentFormatPane.setDirty(isDirty); + } + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + + @Override + public void populateBean(AttrTooltipContent attrTooltipContent){ + if(attrTooltipContent == null){ + return; + } + + content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1); + + populateFormatPane(attrTooltipContent); + + htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); + if(!attrTooltipContent.isCommon()){ + setDirty(false); + } + checkCardPane(); + } + + protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { + categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat()); + seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat()); + valueFormatPane.populate(attrTooltipContent.getValueFormat()); + percentFormatPane.populate(attrTooltipContent.getPercentFormat()); + + if (changedValueFormatPane != null) { + changedValueFormatPane.populate(attrTooltipContent.getChangedValueFormat()); + } + if (changedPercentFormatPane != null) { + changedPercentFormatPane.populate(attrTooltipContent.getChangedPercentFormat()); + } + } + + public AttrTooltipContent updateBean() { + AttrTooltipContent attrTooltipContent = createAttrTooltip(); + + attrTooltipContent.setCommon(content.getSelectedIndex() == 0); + + updateFormatPane(attrTooltipContent); + + htmlLabelPane.update(attrTooltipContent.getHtmlLabel()); + + return attrTooltipContent; + } + + protected AttrTooltipContent createAttrTooltip() { + return new AttrTooltipContent(); + } + + protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { + categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); + seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); + valueFormatPane.update(attrTooltipContent.getValueFormat()); + percentFormatPane.update(attrTooltipContent.getPercentFormat()); + + if (changedValueFormatPane != null) { + changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat()); + } + if (changedPercentFormatPane != null) { + changedPercentFormatPane.update(attrTooltipContent.getChangedPercentFormat()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTrendLinePane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTrendLinePane.java new file mode 100644 index 0000000000..1bf26b3bde --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTrendLinePane.java @@ -0,0 +1,101 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.base.AttrLineStyle; +import com.fr.chart.base.LineStyleInfo; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.TrendLineType; +import com.fr.plugin.chart.base.VanChartAttrTrendLine; +import com.fr.plugin.chart.base.VanChartConstants; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 15/10/19. + */ +public class VanChartTrendLinePane extends BasicPane{ + private static final TrendLineType[] TYPES = new TrendLineType[] {TrendLineType.EXP, TrendLineType.LINE, TrendLineType.LOG, TrendLineType.POLY}; + + private UITextField trendLineName; + private ColorSelectBox trendLineColor; + private LineComboBox trendLineStyle;//线型 + + private UIComboBox trendLineType;//趋势线函数类型 + private UISpinner prePeriod; + private UISpinner afterPeriod; + + public VanChartTrendLinePane() { + this.setLayout(new BorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p,p,p,p}; + double[] col = {p,f}; + trendLineName = new UITextField(); + trendLineColor = new ColorSelectBox(100); + trendLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE); + + trendLineType = new UIComboBox(TYPES); + prePeriod = new UISpinner(0,Integer.MAX_VALUE,1,0); + afterPeriod = new UISpinner(0,Integer.MAX_VALUE,1,0); + double[] r = {p,p}; + double[] c = {p,f,p}; + Component[][] periodComps = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Chart_TrendLine_Forward")), prePeriod, new UILabel(Inter.getLocText("Plugin-ChartF_Cycle"))}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_After_Period")), afterPeriod, new UILabel(Inter.getLocText("Plugin-ChartF_Cycle"))}, + }; + JPanel periodPane = TableLayoutHelper.createTableLayoutPane(periodComps, r, c); + + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Name")), trendLineName}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")), trendLineStyle}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")), trendLineColor}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_type")), trendLineType}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Period")), periodPane} + }; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); + this.add(panel, BorderLayout.CENTER); + } + protected String title4PopupWindow(){ + return Inter.getLocText("Chart-Trend_Line"); + } + + public void populate(VanChartAttrTrendLine trendLine) { + if(trendLine != null){ + trendLineName.setText(trendLine.getTrendLineName()); + LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); + trendLineColor.setSelectObject(lineStyleInfo.getAttrLineColor().getSeriesColor()); + trendLineStyle.setSelectedLineStyle(lineStyleInfo.getAttrLineStyle().getLineStyle()); + trendLineType.setSelectedItem(trendLine.getTrendLineType()); + prePeriod.setValue(trendLine.getPrePeriod()); + afterPeriod.setValue(trendLine.getAfterPeriod()); + } + } + + public VanChartAttrTrendLine update() { + VanChartAttrTrendLine trendLine = new VanChartAttrTrendLine(); + trendLine.setTrendLineName(trendLineName.getText()); + + LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); + lineStyleInfo.setAttrLineStyle(new AttrLineStyle(trendLineStyle.getSelectedLineStyle())); + lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject())); + + trendLine.setTrendLineType((TrendLineType) trendLineType.getSelectedItem()); + trendLine.setPrePeriod((int) prePeriod.getValue()); + trendLine.setAfterPeriod((int) afterPeriod.getValue()); + + return trendLine; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIMenuNameableCreator.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIMenuNameableCreator.java new file mode 100644 index 0000000000..3f41920d98 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIMenuNameableCreator.java @@ -0,0 +1,28 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.FRLogger; +import com.fr.stable.FCloneable; + +/** + * 新的obj是clone出来的,非new + */ +public class VanChartUIMenuNameableCreator extends UIMenuNameableCreator { + public VanChartUIMenuNameableCreator(String name, FCloneable obj, Class paneClazz) { + super(name, obj, paneClazz); + } + /** + * 覆盖的clone方法 + */ + public UIMenuNameableCreator clone() { + Object cloneObj = null; + try { + cloneObj = ((FCloneable)obj).clone(); + } catch (CloneNotSupportedException e){ + FRLogger.getLogger().error("VanChartUIMenuNameableCreator CloneNotSupportedException"); + } + return new UIMenuNameableCreator(name, cloneObj, this.paneClazz); + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPane.java new file mode 100644 index 0000000000..09d72d413a --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPane.java @@ -0,0 +1,165 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.base.background.ImageBackground; +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.general.Background; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.stable.Constants; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 图表 属性表.背景设置 界面.(包括 无, 颜色, 图片, 渐变)+开启阴影 + * 图片背景没有布局方式,默认为拉伸。 + */ +public class VanChartBackgroundPane extends BasicPane { + private static final long serialVersionUID = 6955952013135176051L; + private static final double ALPHA_V = 100.0; + protected List paneList; + + protected UIComboBox typeComboBox; + protected UINumberDragPane transparent; + protected UIButtonGroup shadow; + + protected JPanel centerPane; + + public VanChartBackgroundPane() { + initComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {p, f}; + double[] rowSize = { p,p,p,p,p,p}; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getPaneComponents(), rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected void initComponents() { + typeComboBox = new UIComboBox(); + final CardLayout cardlayout = new CardLayout(); + paneList = new ArrayList(); + + initList(); + + centerPane = new JPanel(cardlayout) { + + @Override + public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度 + int index = typeComboBox.getSelectedIndex(); + return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height); + } + }; + for (int i = 0; i < paneList.size(); i++) { + BackgroundQuickPane pane = paneList.get(i); + typeComboBox.addItem(pane.title4PopupWindow()); + centerPane.add(pane, pane.title4PopupWindow()); + } + + typeComboBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + cardlayout.show(centerPane, (String)typeComboBox.getSelectedItem()); + fireStateChanged(); + } + }); + + transparent = new UINumberDragPane(0, 100); + } + + protected Component[][] getPaneComponents() { + shadow = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_On"), Inter.getLocText("Plugin-ChartF_Off")}, new Boolean[]{true, false}); + + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill")), typeComboBox}, + new Component[]{null, centerPane}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Alpha")), transparent}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Shadow")), shadow}, + }; + } + + protected void initList() { + paneList.add(new NullBackgroundQuickPane()); + paneList.add(new ColorBackgroundQuickPane()); + paneList.add(new ImageBackgroundQuickPane(false)); + paneList.add(new VanChartGradientPane()); + } + + + private void fireStateChanged() { + Object[] listeners = listenerList.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener)listeners[i + 1]).stateChanged(e); + } + } + } + + /** + * 返回标题 + * @return 标题 + */ + public String title4PopupWindow() { + return ""; + } + + public void populate(GeneralInfo attr) { + if(attr == null) { + return; + } + Background background = attr.getBackground(); + double alpha = attr.getAlpha() * ALPHA_V; + transparent.populateBean(alpha); + if(shadow != null){ + shadow.setSelectedIndex(attr.isShadow() == true ? 0 : 1); + } + for (int i = 0; i < paneList.size(); i++) { + BackgroundQuickPane pane = paneList.get(i); + if (pane.accept(background)) { + pane.populateBean(background); + typeComboBox.setSelectedIndex(i); + return; + } + } + } + + public void update(GeneralInfo attr) { + if (attr == null) { + attr = new GeneralInfo(); + } + attr.setBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean()); + if(attr.getBackground() instanceof ImageBackground){ + ((ImageBackground) attr.getBackground()).setLayout(Constants.IMAGE_EXTEND); + } + attr.setAlpha((float) (transparent.updateBean() / ALPHA_V)); + if(shadow != null){ + attr.setShadow(shadow.getSelectedIndex() == 0); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java new file mode 100644 index 0000000000..f364562164 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java @@ -0,0 +1,59 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/6/29. + * 默认+颜色.+透明度 + */ +public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgroundPane { + + public VanChartBackgroundPaneWithOutImageAndShadow() { + initComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {p, f}; + double[] rowSize = { p,p,p,p,p}; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(),rowSize,columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + @Override + protected void initList() { + paneList.add(new NullBackgroundQuickPane(){ + /** + * 名称 + * + * @return 名称 + */ + @Override + public String title4PopupWindow() { + return Inter.getLocText("Chart-Default_Name"); + } + }); + paneList.add(new ColorBackgroundQuickPane()); + } + + @Override + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill")), typeComboBox}, + new Component[]{null, centerPane}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Alpha")), transparent}, + }; + } +} + diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java new file mode 100644 index 0000000000..b39aa918a9 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java @@ -0,0 +1,22 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; + +/** + * 图表 属性表.背景设置 界面.(包括 无, 颜色, 渐变)+开启阴影 + */ + +public class VanChartBackgroundWithOutImagePane extends VanChartBackgroundPane { + private static final long serialVersionUID = 1322979785605013853L; + + public VanChartBackgroundWithOutImagePane() { + super(); + } + + protected void initList() { + paneList.add(new NullBackgroundQuickPane()); + paneList.add(new ColorBackgroundQuickPane()); + paneList.add(new VanChartGradientPane()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java new file mode 100644 index 0000000000..f1d1c9ca48 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java @@ -0,0 +1,50 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.general.Inter; + +import java.awt.*; + +/** + * 图表 属性表.背景设置 界面.(包括 无, 颜色, 渐变) + 圆角半径 + */ +public class VanChartBackgroundWithOutShadowWithRadiusPane extends VanChartBackgroundWithOutImagePane { + private static final long serialVersionUID = -3387661350545592763L; + + private UISpinner radius; + + public VanChartBackgroundWithOutShadowWithRadiusPane(){ + super(); + } + + protected Component[][] getPaneComponents() { + radius = new UISpinner(0,1000,1,0); + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill")), typeComboBox}, + new Component[]{null, centerPane}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Alpha")), transparent}, + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_Radius")+":"),radius} + }; + } + + public void populate(GeneralInfo attr) { + if(attr == null) { + return; + } + super.populate(attr); + radius.setValue(attr.getRoundRadius()); + + } + + public void update(GeneralInfo attr) { + super.update(attr); + if (attr == null) { + attr = new GeneralInfo(); + } + attr.setRoundRadius((int)radius.getValue()); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartGradientPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartGradientPane.java new file mode 100644 index 0000000000..e3052d8910 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartGradientPane.java @@ -0,0 +1,104 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.base.background.GradientBackground; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; +import com.fr.design.style.background.gradient.FixedGradientBar; +import com.fr.general.Background; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * 渐变色设置界面,bar无法拖拽 + */ +public class VanChartGradientPane extends GradientBackgroundQuickPane { + protected static final int CHART_GRADIENT_WIDTH = 150; + private static final long serialVersionUID = 256594362341221087L; + + private FixedGradientBar gradientBar; + private UIButtonGroup directionPane; + + public VanChartGradientPane() { + constructPane(); + } + + protected void constructPane(){ + String[] textArray = {Inter.getLocText("Utils-Left_to_Right"), Inter.getLocText("Utils-Top_to_Bottom")}; + Integer[] valueArray = {GradientBackground.LEFT2RIGHT, GradientBackground.TOP2BOTTOM}; + directionPane = new UIButtonGroup(textArray, valueArray); + directionPane.setSelectedIndex(0); + gradientBar = new FixedGradientBar(4, CHART_GRADIENT_WIDTH); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{gradientBar, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Gradient_Direction")),directionPane}, + }; + JPanel Gradient = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(Gradient, BorderLayout.CENTER); + } + + public void populateBean(Background background) { + GradientBackground bg = (GradientBackground) background; + this.gradientBar.getSelectColorPointBtnP1().setColorInner(bg.getStartColor()); + this.gradientBar.getSelectColorPointBtnP2().setColorInner(bg.getEndColor()); + directionPane.setSelectedItem(bg.getDirection()); + this.gradientBar.repaint(); + } + + public GradientBackground updateBean() { + GradientBackground gb = new GradientBackground(gradientBar.getSelectColorPointBtnP1().getColorInner(), gradientBar.getSelectColorPointBtnP2().getColorInner()); + gb.setDirection(directionPane.getSelectedItem()); + + return gb; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + gradientBar.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + directionPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 是否接受 + * @param background 背景 + * @return 是则返回true + */ + public boolean accept(Background background) { + return background instanceof GradientBackground; + } + + /** + * 名称 + * @return 名称 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-Chart_Gradient_Color"); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartMarkerBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartMarkerBackgroundPane.java new file mode 100644 index 0000000000..67ea1c9d4b --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartMarkerBackgroundPane.java @@ -0,0 +1,72 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.base.background.ColorBackground; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 系列色(无背景颜色)、颜色面板 + */ +public class VanChartMarkerBackgroundPane extends VanChartBackgroundPane { + private static final long serialVersionUID = -1032221277140976934L; + + public VanChartMarkerBackgroundPane(){ + initComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill")), typeComboBox}, + new Component[]{null, centerPane}, + }; + } + + protected void initList() { + paneList.add(new NullBackgroundQuickPane(){ + @Override + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_SeriesColor"); + } + + }); + paneList.add(new ColorBackgroundQuickPane()); + } + + public void populate(ColorBackground colorBackground) { + if(colorBackground == null) { + return; + } + + for (int i = 0; i < paneList.size(); i++) { + BackgroundQuickPane pane = paneList.get(i); + if (pane.accept(colorBackground)) { + pane.populateBean(colorBackground); + typeComboBox.setSelectedIndex(i); + return; + } + } + } + + public ColorBackground update() { + return (ColorBackground)paneList.get(typeComboBox.getSelectedIndex()).updateBean(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderPane.java new file mode 100644 index 0000000000..2c79f63161 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderPane.java @@ -0,0 +1,99 @@ +package com.fr.plugin.chart.designer.component.border; + + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; + +//线型 + 颜色 +public class VanChartBorderPane extends BasicPane { + private static final long serialVersionUID = -7770029552989609464L; + protected LineComboBox currentLineCombo; + protected ColorSelectBox currentLineColorPane; + + public VanChartBorderPane() { + initComponents(); + } + + protected void initComponents() { + currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + currentLineColorPane = new ColorSelectBox(100); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p,f }; + double[] rowSize = {p, p, p, p}; + Component[][] components = getUseComponent(); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected Component[][] getUseComponent() { + return new Component[][]{ + new Component[]{null,null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")),currentLineCombo}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")),currentLineColorPane}, + }; + } + + /** + * 标题 + * @return 标题 + */ + public String title4PopupWindow() { + return null; + } + + public void populate(GeneralInfo attr) { + if(attr == null) { + return; + } + currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); + currentLineColorPane.setSelectObject(attr.getBorderColor()); + + } + + public void update(GeneralInfo attr) { + if(attr == null) { + attr = new GeneralInfo(); + } + attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + attr.setBorderColor(currentLineColorPane.getSelectObject()); + + } + + public void update(AttrBorder attrBorder){ + if(attrBorder == null){ + return; + } + attrBorder.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + attrBorder.setBorderColor(currentLineColorPane.getSelectObject()); + } + + public void populate(AttrBorder attr) { + if(attr == null) { + return; + } + currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); + currentLineColorPane.setSelectObject(attr.getBorderColor()); + } + + public AttrBorder update() { + AttrBorder attr = new AttrBorder(); + + attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + attr.setBorderColor(currentLineColorPane.getSelectObject()); + + return attr; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithAlphaPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithAlphaPane.java new file mode 100644 index 0000000000..a794f0cbc0 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithAlphaPane.java @@ -0,0 +1,51 @@ +package com.fr.plugin.chart.designer.component.border; + +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.Inter; +import com.fr.plugin.chart.VanChartAttrHelper; +import com.fr.plugin.chart.base.AttrBorderWithAlpha; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/5/19. + * 边框,线型/颜色/不透明度 + */ +public class VanChartBorderWithAlphaPane extends VanChartBorderPane{ + private UINumberDragPane transparent; + + @Override + protected void initComponents() { + transparent = new UINumberDragPane(0,100); + this.add(new JSeparator(), BorderLayout.SOUTH); + + super.initComponents(); + } + + @Override + protected Component[][] getUseComponent() { + return new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")+":"),currentLineCombo}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")+":"),currentLineColorPane}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Alpha")+":"), transparent} + }; + } + + public void populate(AttrBorderWithAlpha attr) { + if(attr == null){ + return; + } + super.populate(attr); + transparent.populateBean(attr.getAlpha() * VanChartAttrHelper.PERCENT); + } + + @Override + public AttrBorderWithAlpha update() { + AttrBorderWithAlpha attrBorderWithAlpha = new AttrBorderWithAlpha(); + super.update(attrBorderWithAlpha); + attrBorderWithAlpha.setAlpha(transparent.updateBean()/ VanChartAttrHelper.PERCENT); + return attrBorderWithAlpha; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithRadiusPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithRadiusPane.java new file mode 100644 index 0000000000..f7c330be24 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithRadiusPane.java @@ -0,0 +1,67 @@ +package com.fr.plugin.chart.designer.component.border; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 线型 + 颜色 + 圆角半径 + */ +public class VanChartBorderWithRadiusPane extends VanChartBorderPane { + private static final long serialVersionUID = -3937853702118283803L; + private UISpinner radius; + + @Override + protected void initComponents() { + radius = new UISpinner(0,1000,1,0); + this.add(new JSeparator(), BorderLayout.SOUTH); + super.initComponents(); + } + + @Override + protected Component[][] getUseComponent() { + return new Component[][]{ + new Component[]{null,null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")),currentLineCombo}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")),currentLineColorPane}, + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_Radius")),radius} + } ; + } + + public void populate(GeneralInfo attr) { + super.populate(attr); + if(attr == null) { + return; + } + radius.setValue(attr.getRoundRadius()); + } + + public void update(GeneralInfo attr) { + super.update(attr); + attr.setRoundRadius((int)radius.getValue()); + } + + public void update(AttrBorder attrBorder) { + super.update(attrBorder); + attrBorder.setRoundRadius((int)radius.getValue()); + } + + public void populate(AttrBorder attr) { + super.populate(attr); + if(attr == null) { + return; + } + radius.setValue(attr.getRoundRadius()); + } + + public AttrBorder update() { + AttrBorder attr = super.update(); + attr.setRoundRadius((int)radius.getValue()); + return attr; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..c96f64d491 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = -782523079199004032L; + + public CategoryNameFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Category_Name"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedPercentFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedPercentFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..2f510e4653 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedPercentFormatPaneWithCheckBox.java @@ -0,0 +1,25 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by mengao on 2017/6/5. + */ +public class ChangedPercentFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + public ChangedPercentFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Plugin-ChartF_Change_Percent"); + } + + protected boolean isPercent() { + return true; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedValueFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedValueFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..2c58324936 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedValueFormatPaneWithCheckBox.java @@ -0,0 +1,21 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by mengao on 2017/6/9. + */ +public class ChangedValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox{ + + public ChangedValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Plugin-ChartF_Change_Value"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/MapAreaNameFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/MapAreaNameFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..01fdaade9e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/MapAreaNameFormatPaneWithCheckBox.java @@ -0,0 +1,21 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/5/20. + * 地图的标签区域名只是改了之前的分类名的名字,读写什么的都一样 + */ +public class MapAreaNameFormatPaneWithCheckBox extends CategoryNameFormatPaneWithCheckBox { + public MapAreaNameFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("FR-Chart-Area_Name"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/PercentFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/PercentFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..1324456a35 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/PercentFormatPaneWithCheckBox.java @@ -0,0 +1,27 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class PercentFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = 566737138492111631L; + + public PercentFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Use_Percent"); + } + + protected boolean isPercent() { + return true; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/SeriesNameFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/SeriesNameFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..b2ad7bb6e0 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/SeriesNameFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class SeriesNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = 6456517419221601327L; + + public SeriesNameFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Series_Name"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/ValueFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ValueFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..f076cd9d33 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ValueFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class ValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = -8793617093976412625L; + + public ValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Use_Value"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPane.java new file mode 100644 index 0000000000..167ca8a292 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPane.java @@ -0,0 +1,40 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.style.FRFontPane; +import com.fr.design.gui.style.FormatPane; +import com.fr.design.layout.TableLayout; +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by mengao on 2017/8/14. + */ +public class VanChartFormatPane extends FormatPane { + protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { + return new Component[][]{ + new Component[]{null, centerPane}, + }; + } + + protected void setTypeComboBoxPane(UIComboBox typeComboBox) { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, f}; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getTypeComboBoxComponent(typeComboBox), rowSize, columnSize); + this.add(panel, BorderLayout.NORTH); + } + + protected Component[][] getTypeComboBoxComponent (UIComboBox typeComboBox) { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DataType"), SwingConstants.LEFT), typeComboBox}, + + }; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..c91bb4495c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java @@ -0,0 +1,137 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.base.Style; +import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.style.FormatPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.stable.Constants; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.text.Format; + +/** + * Created by Mitisky on 16/2/23. + */ +public abstract class VanChartFormatPaneWithCheckBox extends JPanel{ + private static final long serialVersionUID = -6563172546340480058L; + + private UICheckBox isSelectedBox; + private UIButton formatButton; + private FormatPane formatPane; + private Format format; + + private VanChartStylePane parent; + private JPanel showOnPane; + + private boolean isDirty; + + public VanChartFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + this.parent = parent; + this.showOnPane = showOnPane; + this.isDirty = true; + + this.setLayout(new BorderLayout()); + isSelectedBox = new UICheckBox(getCheckBoxText()); + formatButton = new UIButton(Inter.getLocText("Chart-Use_Format")); + this.add(isSelectedBox, BorderLayout.CENTER); + this.add(formatButton, BorderLayout.EAST); + + initFormatListener(); + isSelectedBox.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + isDirty = true; + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + }); + } + + protected abstract String getCheckBoxText(); + + protected boolean isPercent() { + return false; + } + + private void initFormatListener() { + if(formatButton != null) { + formatButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + if (!formatButton.isEnabled()) { + return; + } + + if(formatPane == null) { + formatPane = createFormatPane(); + } + Point comPoint = formatButton.getLocationOnScreen(); + Point arrowPoint = new Point(comPoint.x + formatButton.getWidth(), comPoint.y + formatButton.getHeight()); + UIBubbleFloatPane