Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

research/11.0
alex.sung 5 years ago
parent
commit
99c4460984
  1. 4
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 2
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  3. 52
      designer-base/src/main/java/com/fr/design/beans/BasicBeanPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/beans/FurtherBasicBeanPane.java
  5. 3
      designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java
  6. 2
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  7. 8
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  8. 66
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java
  9. 201
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  10. 6
      designer-base/src/main/java/com/fr/design/dialog/BasicDialog.java
  11. 17
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  12. 3
      designer-base/src/main/java/com/fr/design/dialog/DialogActionAdapter.java
  13. 7
      designer-base/src/main/java/com/fr/design/dialog/DialogActionListener.java
  14. 8
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  15. 48
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  16. 2
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  17. 16
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  18. 9
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  19. 1
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  20. 14
      designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java
  21. 100
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  22. 2
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBoxUI.java
  23. 1
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java
  24. 1
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java
  25. 12
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  26. 51
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  27. 27
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  28. 5
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  29. 6
      designer-base/src/main/java/com/fr/design/gui/ilable/MultilineLabel.java
  30. 4
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  31. 14
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  32. 31
      designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java
  33. 35
      designer-base/src/main/java/com/fr/design/gui/itable/AbstractPropertyTable.java
  34. 2
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  35. 3
      designer-base/src/main/java/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
  36. 1
      designer-base/src/main/java/com/fr/design/gui/style/NumberDragBar.java
  37. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxDocument.java
  38. 3806
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java
  39. 2563
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  40. 433
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  41. 100
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  42. 5
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/parser/TaskTagParser.java
  43. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/LineNumberList.java
  44. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextArea.java
  45. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java
  46. 10
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java
  47. 6
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  48. 1
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  49. 12
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  50. 51
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  51. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  52. 23
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  53. 22
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java
  54. 7
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java
  55. 70
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  56. 1
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  57. 1
      designer-base/src/main/java/com/fr/design/update/actions/FileDownloader.java
  58. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  59. 1
      designer-base/src/main/java/com/fr/design/utils/DrawRoutines.java
  60. 10
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  61. 1
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  62. 1
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  63. 116
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  64. 13
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  65. 97
      designer-chart/src/main/java/com/fr/design/chart/gui/ActiveGlyphFactory.java
  66. 98
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  67. 161
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ActiveGlyph.java
  68. 38
      designer-chart/src/main/java/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java
  69. 43
      designer-chart/src/main/java/com/fr/design/chart/gui/active/AxisActiveGlyph.java
  70. 19
      designer-chart/src/main/java/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java
  71. 39
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ChartActiveGlyph.java
  72. 44
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java
  73. 53
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java
  74. 30
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java
  75. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java
  76. 30
      designer-chart/src/main/java/com/fr/design/chart/gui/active/LegendActiveGlyph.java
  77. 34
      designer-chart/src/main/java/com/fr/design/chart/gui/active/PlotActiveGlyph.java
  78. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java
  79. 18
      designer-chart/src/main/java/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java
  80. 35
      designer-chart/src/main/java/com/fr/design/chart/gui/active/TextActiveGlyph.java
  81. 43
      designer-chart/src/main/java/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java
  82. 19
      designer-chart/src/main/java/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java
  83. 37
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  84. 27
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java
  85. 33
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java
  86. 31
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java
  87. 26
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java
  88. 33
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataSheetAction.java
  89. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java
  90. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java
  91. 32
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java
  92. 6
      designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java
  93. 23
      designer-chart/src/main/java/com/fr/design/chartx/StructureChartDataPane.java
  94. 86
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java
  95. 91
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureDataSetFieldsPane.java
  96. 2
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/WordCloudCellDataFieldsPane.java
  97. 9
      designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java
  98. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java
  99. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  100. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -263,6 +263,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
Thread.sleep(5000);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("Map Save Error");
Thread.currentThread().interrupt();
}
}
}
@ -658,9 +659,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public void saveXMLFile() {
File xmlFile = this.getDesignerEnvFile();
if (xmlFile == null) {
return;
}
if (!xmlFile.getParentFile().exists()) {//建立目录.
StableUtils.mkdirs(xmlFile.getParentFile());
}

2
designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java

@ -5,6 +5,7 @@
package com.fr.design;
import com.fr.base.BaseUtils;
import com.fr.common.annotations.Open;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.*;
import com.fr.design.gui.core.WidgetOption;
@ -34,6 +35,7 @@ import java.util.Set;
* @since : 8.0
* 用于设计器扩展的管理类
*/
@Open
public class ExtraDesignClassManager extends AbstractExtraClassManager implements ExtraDesignClassManagerProvider {
private static ExtraDesignClassManager classManager = new ExtraDesignClassManager();

52
designer-base/src/main/java/com/fr/design/beans/BasicBeanPane.java

@ -1,41 +1,35 @@
package com.fr.design.beans;
import com.fr.common.annotations.Open;
import com.fr.design.dialog.BasicPane;
/**
* Update Pane
*/
@Open
public abstract class BasicBeanPane<T> extends BasicPane {
/**
* 展示数据
* @param ob 待展示的对象
*/
public abstract void populateBean(T ob);
/**
* 保存数据
* @return 待保存的对象
*/
public abstract T updateBean();
/**
* Populate.
*/
public abstract void populateBean(T ob);
/**
* 保存数据
* @param ob 待保存的对象
*/
public void updateBean(T ob) {
/**
* Update.
*/
public abstract T updateBean();
}
public void updateBean(T ob) {
}
/**
* 更新权限工具栏面板
*/
public void populateAuthority() {
}
/**
* 仅用来处理图表设计器的地图面板
* @param mapType 地图类型
*/
public void dealWidthMap(String mapType){
}
/**
* 更新权限工具栏面板
*/
public void populateAuthority() {
}
}

6
designer-base/src/main/java/com/fr/design/beans/FurtherBasicBeanPane.java

@ -1,11 +1,9 @@
package com.fr.design.beans;
import com.fr.common.annotations.Open;
import com.fr.stable.StringUtils;
/**
* @author zhou
* @since 2012-5-30下午12:12:42
*/
@Open
public abstract class FurtherBasicBeanPane<T> extends BasicBeanPane<T> {
/**
* 是否是指定类型

3
designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java

@ -1,10 +1,13 @@
package com.fr.design.condition;
import com.fr.common.annotations.Open;
/**
* @author richie
* @date 2015-03-26
* @since 8.0
*/
@Open
public abstract class ConditionAttrSingleConditionPane<T> extends SingleConditionPane<T> {
protected HighLightConditionAction hightLighAttrUpdateAction = null;
private ConditionAttributesPane conditionAttributesPane;

2
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -1,6 +1,7 @@
package com.fr.design.condition;
import com.fr.common.annotations.Open;
import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.itoolbar.UIToolbar;
@ -17,6 +18,7 @@ import java.awt.Dimension;
import java.util.HashMap;
import java.util.Iterator;
@Open
public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
private static final int MIN_HEIGHT = 60;
protected CellHighlightAddMenuDef menuDef;

8
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -46,6 +46,7 @@ import java.awt.event.KeyEvent;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Coder: zack
@ -70,6 +71,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
*
* @return 返回位置
*/
@Override
public Location preferredLocation() {
return Location.WEST_ABOVE;
}
@ -97,6 +99,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
/**
* 响应数据集改变
*/
@Override
public void fireDSChanged() {
fireDSChanged(new HashMap<String, String>());
}
@ -107,6 +110,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
*
* @param map 数据集变化Map
*/
@Override
public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map);
}
@ -151,6 +155,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public abstract TableDataTree getDataTree();
@Override
public abstract void refreshDockingView();
protected void checkButtonEnabled(UpdateAction editAction, UpdateAction previewTableDataAction, UpdateAction removeAction, TableDataSourceOP op, TableDataTree dataTree) {
@ -320,6 +325,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
this.setSmallIcon(this.getTDIcon());
}
@Override
public void actionPerformed(ActionEvent e) {
dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false);
}
@ -400,7 +406,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
data = selectedNO.getObject();
}
try {
if (((TableDataWrapper) data).getTableData() instanceof StoreProcedure) {
if (((TableDataWrapper) Objects.requireNonNull(data)).getTableData() instanceof StoreProcedure) {
((StoreProcedure) (((TableDataWrapper) data).getTableData())).resetDataModelList();
if (data instanceof StoreProcedureDataWrapper) {
StoreProcedureDataWrapper oldSdw = ((StoreProcedureDataWrapper) data);

66
designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java

@ -56,14 +56,18 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
return DesignTableDataManager.getEditingDataSet(tc.getBook());
}
List<Map<String, TableDataWrapper>> empty = new ArrayList<Map<String, TableDataWrapper>>();
empty.add(Collections.<String, TableDataWrapper>emptyMap());//数据集
empty.add(Collections.<String, TableDataWrapper>emptyMap());//服务器数据集
empty.add(Collections.<String, TableDataWrapper>emptyMap());//存储过程
//数据集
empty.add(Collections.<String, TableDataWrapper>emptyMap());
//服务器数据集
empty.add(Collections.<String, TableDataWrapper>emptyMap());
//存储过程
empty.add(Collections.<String, TableDataWrapper>emptyMap());
return empty;
}
/**
* ButtonEnabled intercept
*
* @return interceptbuttonEnabled
*/
@Override
@ -73,8 +77,10 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
/**
* 移除名字是name的TableData
*
* @param name tabledata name
*/
@Override
public void removeAction(String name) {
if (tc != null) {
TableDataSource tds = tc.getBook();
@ -85,7 +91,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
}
protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, TableDataWrapper> map) {
List<ExpandMutableTreeNode> dataList = new ArrayList<ExpandMutableTreeNode>();
List<ExpandMutableTreeNode> dataList = new ArrayList<>();
Iterator<Entry<String, TableDataWrapper>> entryIt = map.entrySet().iterator();
while (entryIt.hasNext()) {
Entry<String, TableDataWrapper> entry = entryIt.next();
@ -96,7 +102,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
dataList.add(newChildTreeNode);
newChildTreeNode.add(new ExpandMutableTreeNode());
}
return dataList.toArray(new ExpandMutableTreeNode[dataList.size()]);
return dataList.toArray(new ExpandMutableTreeNode[0]);
}
private ExpandMutableTreeNode initTemplateDataNode(Map<String, TableDataWrapper> templateDataMap) {
@ -124,22 +130,20 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
*/
@Override
public ExpandMutableTreeNode[] load() {
Map<String, TableDataWrapper> templateDataMap = null;
Map<String, TableDataWrapper> serverDataMap = null;
Map<String, TableDataWrapper> storeProcedureMap = null;
if (this != null) {
templateDataMap = this.init().get(0);
serverDataMap = this.init().get(1);
storeProcedureMap = this.init().get(2);
} else {
templateDataMap = Collections.emptyMap();
serverDataMap = Collections.emptyMap();
storeProcedureMap = Collections.emptyMap();
}
List<ExpandMutableTreeNode> list = new ArrayList<ExpandMutableTreeNode>(); //所有的数据集
List<ExpandMutableTreeNode> templist = new ArrayList<ExpandMutableTreeNode>(); //模板数据集
List<ExpandMutableTreeNode> serverlist = new ArrayList<ExpandMutableTreeNode>(); //服务器数据集
Map<String, TableDataWrapper> templateDataMap;
Map<String, TableDataWrapper> serverDataMap;
Map<String, TableDataWrapper> storeProcedureMap;
templateDataMap = this.init().get(0);
serverDataMap = this.init().get(1);
storeProcedureMap = this.init().get(2);
//所有的数据集
List<ExpandMutableTreeNode> list = new ArrayList<>();
//模板数据集
List<ExpandMutableTreeNode> templist = new ArrayList<>();
//服务器数据集
List<ExpandMutableTreeNode> serverlist = new ArrayList<>();
list.add(initTemplateDataNode(templateDataMap));
addNodeToList(templateDataMap, templist);
@ -160,11 +164,11 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
}
switch (dataMode) {
case TEMPLATE_TABLE_DATA:
return templist.toArray(new ExpandMutableTreeNode[templist.size()]);
return templist.toArray(new ExpandMutableTreeNode[0]);
case SERVER_TABLE_DATA:
return serverlist.toArray(new ExpandMutableTreeNode[serverlist.size()]);
return serverlist.toArray(new ExpandMutableTreeNode[0]);
default:
return list.toArray(new ExpandMutableTreeNode[list.size()]);
return list.toArray(new ExpandMutableTreeNode[0]);
}
}
@ -182,7 +186,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
}
protected void setStoreProcedureTree(TableData tableData, ExpandMutableTreeNode tmpNode) {
ArrayList<String> nodeName = new ArrayList<String>();
ArrayList<String> nodeName = new ArrayList<>();
StoreProcedure storeProcedure = (StoreProcedure) tableData;
String name = ((NameObject) tmpNode.getUserObject()).getName();
StoreProcedureParameter[] parameters = StoreProcedure.getSortPara(storeProcedure.getParameters());
@ -208,13 +212,13 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
}
if (!resultNames.isEmpty()) {
for (int i = 0; i < resultNames.size(); i++) {
if (!nodeName.contains(resultNames.get(i))) {
nodeName.add(resultNames.get(i));
for (String resultName : resultNames) {
if (!nodeName.contains(resultName)) {
nodeName.add(resultName);
hasChild = true;
String parameterName = name + "_" + resultNames.get(i);
String parameterName = name + "_" + resultName;
TableDataWrapper newTwd = new StoreProcedureDataWrapper(storeProcedure, name, parameterName, false);
ExpandMutableTreeNode newChildNode = new ExpandMutableTreeNode(new NameObject(resultNames.get(i), newTwd));
ExpandMutableTreeNode newChildNode = new ExpandMutableTreeNode(new NameObject(resultName, newTwd));
newChildNode.add(new ExpandMutableTreeNode());
tmpNode.add(newChildNode);
}
@ -230,7 +234,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
public void setDataMode(int i) {
this.dataMode = i;
dataMode = i;
}
public int getDataMode() {

201
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -76,6 +76,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private static final int TEXT = 0;
@ -126,12 +127,12 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private static final int GAP = 23;
public FileTableDataPane(){
this(SETPANELWIDTH,WIDTH,HEIGHT,GAP);
public FileTableDataPane() {
this(SETPANELWIDTH, WIDTH, HEIGHT, GAP);
}
public FileTableDataPane(int setPanelWidth,int width,int height,int gap) {
this.setLayout(new BorderLayout(gap,0));
public FileTableDataPane(int setPanelWidth, int width, int height, int gap) {
this.setLayout(new BorderLayout(gap, 0));
JPanel northPanel = new JPanel(new BorderLayout());
JPanel type = new JPanel();
type.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_File_Type") + ":"));
@ -163,16 +164,16 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
southPanel.add(setPanel, BorderLayout.CENTER);
setPanel.setPreferredSize(new Dimension(setPanelWidth, 460));
setPanel.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set")));
JPanel controlPane = textSetPanel(width,height);
JPanel controlPane = textSetPanel(width, height);
setPanel.add(controlPane, BorderLayout.NORTH);
fileTypeComboBox.addActionListener(getFileTypeListener(setPanel,width,height));
fileTypeComboBox.addActionListener(getFileTypeListener(setPanel, width, height));
this.add(northPanel, BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER);
this.add(southPanel, BorderLayout.EAST);
}
private void addToCenterPanel(JPanel centerPanel){
private void addToCenterPanel(JPanel centerPanel) {
localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Local_File") + ":", true);
urlFileRadioButton = new UIRadioButton("URL:", false);
ButtonGroup bg = new ButtonGroup();
@ -217,8 +218,9 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private ActionListener testConnectionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
String uri = ParameterHelper.analyze4Templatee( urlText.getText(), params);
String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params);
if (!checkURL(uri)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning"));
return;
@ -245,10 +247,11 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
};
private void previewPanel(JPanel jPanel){
private void previewPanel(JPanel jPanel) {
JPanel previewPanel = new JPanel(new BorderLayout());
UIButton preview = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"));
preview.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
preview();
}
@ -257,48 +260,47 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
jPanel.add(previewPanel, BorderLayout.SOUTH);
}
private JPanel xmlSetPanel(int width,int height) {
private JPanel xmlSetPanel(int width, int height) {
// xml设置pane
JPanel controlPane = new JPanel();
JPanel northPane = new JPanel(new BorderLayout(8,8));
JPanel northTopPane = new JPanel(new BorderLayout(8,8));
JPanel southPane = new JPanel(new BorderLayout(8,8));
JPanel southTopPane = new JPanel(new BorderLayout(8,8));
JPanel westPane = new JPanel(new BorderLayout());
controlPane.setLayout(new BorderLayout(8,8));
JPanel northPane = new JPanel(new BorderLayout(8, 8));
JPanel northTopPane = new JPanel(new BorderLayout(8, 8));
JPanel southPane = new JPanel(new BorderLayout(8, 8));
JPanel southTopPane = new JPanel(new BorderLayout(8, 8));
controlPane.setLayout(new BorderLayout(8, 8));
controlPane.setPreferredSize(new Dimension(width, height));
JPanel comboboxPanel = new JPanel(new BorderLayout(8,8));
JPanel comboboxPanel = new JPanel(new BorderLayout(8, 8));
encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":");
encodingComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
encodingComboBox.setSelectedIndex(4);
encodingComboBox.setPreferredSize(new Dimension(90, 20));
JPanel treeContainerPane = new JPanel();
treeContainerPane.setLayout(new BorderLayout(8,8));
treeContainerPane.setLayout(new BorderLayout(8, 8));
nodeTreePane = new XMLNodeTreePane();
treeContainerPane.add(nodeTreePane,BorderLayout.CENTER);
treeContainerPane.add(nodeTreePane, BorderLayout.CENTER);
comboboxPanel.add(encodeLabel, BorderLayout.WEST);
comboboxPanel.add(encodingComboBox, BorderLayout.CENTER);
northPane.add(comboboxPanel,BorderLayout.EAST);
northTopPane.add(northPane,BorderLayout.WEST);
southTopPane.add(southPane,BorderLayout.WEST);
southTopPane.add(treeContainerPane,BorderLayout.CENTER);
northPane.add(comboboxPanel, BorderLayout.EAST);
northTopPane.add(northPane, BorderLayout.WEST);
southTopPane.add(southPane, BorderLayout.WEST);
southTopPane.add(treeContainerPane, BorderLayout.CENTER);
controlPane.add(northTopPane, BorderLayout.NORTH);
controlPane.add(southTopPane,BorderLayout.CENTER);
controlPane.add(southTopPane, BorderLayout.CENTER);
previewPanel(controlPane);
return controlPane;
}
private JPanel excelSetPanel(int width,int height) {
private JPanel excelSetPanel(int width, int height) {
// excel设置pane
int checkBoxWidth = width - EIGHT;
JPanel controlPane = new JPanel();
JPanel northPane = new JPanel(new BorderLayout(8,8));
JPanel northPane = new JPanel(new BorderLayout(8, 8));
controlPane.setLayout(new BorderLayout());
controlPane.setPreferredSize(new Dimension(width,height));
controlPane.setPreferredSize(new Dimension(width, height));
needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), false);
needColumnNameCheckBox.setPreferredSize(new Dimension(checkBoxWidth, 20));
northPane.add(needColumnNameCheckBox, BorderLayout.EAST);
@ -321,6 +323,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
*
* @throws Exception
*/
@Override
public void checkValid() throws Exception {
if (urlFileRadioButton.isSelected()) {
String url = urlText.getText().trim();
@ -331,33 +334,33 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private boolean checkURL(String uri){
private boolean checkURL(String uri) {
try {
new URL(uri);
return true;
} catch (MalformedURLException e) {
return false;
}
// return (uri.matches("https*://.+|\\$\\{.+\\}.*"));
// return (uri.matches("https*://.+|\\$\\{.+\\}.*"));
}
private JPanel textSetPanel(int width,int height) {
private JPanel textSetPanel(int width, int height) {
// text设置pane
JPanel controlPane = new JPanel();
controlPane.setLayout(new BorderLayout());
controlPane.setPreferredSize(new Dimension(width,height));
JPanel northPane = new JPanel(new BorderLayout(8,8));
controlPane.setPreferredSize(new Dimension(width, height));
JPanel northPane = new JPanel(new BorderLayout(8, 8));
addToNorthPane(northPane);
controlPane.add(northPane,BorderLayout.WEST);
controlPane.add(northPane, BorderLayout.WEST);
previewPanel(controlPane);
return controlPane;
}
private void addToNorthPane(JPanel northPane){
private void addToNorthPane(JPanel northPane) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double columnSize[] = {f, p, p};
double rowSize[] = {B, B, B, B, B, B, B};
double[] columnSize = {f, p, p};
double[] rowSize = {B, B, B, B, B, B, B};
needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), true);
dismenberLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dismenber") + ":");
tableDismemberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Table_Dismember"), false);
@ -390,18 +393,19 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":");
charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
Component[][] comps = {
{encodeLabel,charsetComboBox,null},
{needColumnNameCheckBox,null,null},
{dismenberLabel,tableDismemberRadioButton,null},
{null,spaceDismenberRadioButton,null},
{null,commaDismenberRadioButton,null},
{null,otherDismenberRadioButton,otherDismenberTextField},
{ignoreOneMoreDelimiterCheckBox,null,null}
{encodeLabel, charsetComboBox, null},
{needColumnNameCheckBox, null, null},
{dismenberLabel, tableDismemberRadioButton, null},
{null, spaceDismenberRadioButton, null},
{null, commaDismenberRadioButton, null},
{null, otherDismenberRadioButton, otherDismenberTextField},
{ignoreOneMoreDelimiterCheckBox, null, null}
};
northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize),BorderLayout.EAST);
northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.EAST);
}
private ActionListener radioActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (localFileRadioButton.isSelected()) {
localRadioSelectAction();
@ -456,8 +460,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private String[] getFileSuffix() {
List<String> suffixList = new ArrayList<String>();
String suffix = fileTypeComboBox.getSelectedItem().toString().toLowerCase();
if (suffix.equalsIgnoreCase("excel")) {
String suffix = Objects.requireNonNull(fileTypeComboBox.getSelectedItem()).toString().toLowerCase();
if ("excel".equalsIgnoreCase(suffix)) {
suffixList.add("xls");
suffixList.add("xlsx");
} else {
@ -467,8 +471,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private String getFileSuffixToString() {
String suffixToString = fileTypeComboBox.getSelectedItem().toString().toLowerCase();
if (suffixToString.equalsIgnoreCase("excel")) {
String suffixToString = Objects.requireNonNull(fileTypeComboBox.getSelectedItem()).toString().toLowerCase();
if ("excel".equalsIgnoreCase(suffixToString)) {
suffixToString = "xls";
}
return suffixToString;
@ -476,16 +480,17 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private ActionListener getFileTypeListener(final JPanel setPanel, final int width, final int height) {
ActionListener fileTypeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setPanel.removeAll();
localText.setText("");
urlText.setText("");
if (fileTypeComboBox.getSelectedIndex() == XML) {
setPanel.add(xmlSetPanel(width,height), BorderLayout.NORTH);
setPanel.add(xmlSetPanel(width, height), BorderLayout.NORTH);
} else if (fileTypeComboBox.getSelectedIndex() == EXCEL) {
setPanel.add(excelSetPanel(width,height), BorderLayout.NORTH);
setPanel.add(excelSetPanel(width, height), BorderLayout.NORTH);
} else {
setPanel.add(textSetPanel(width,height), BorderLayout.NORTH);
setPanel.add(textSetPanel(width, height), BorderLayout.NORTH);
}
String tipContent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffixToString() + "<br>"
+ "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp<br>" + "&nbsp</body> </html> ";
@ -503,6 +508,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
String[] paramTexts = new String[1];
paramTexts[0] = getFilePathFromUrlOrLocal();
@ -545,25 +551,25 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
setTextField(xtd);
editorPane.populate(xtd.getParams());
encodingComboBox.setSelectedItem(xtd.getCharSet());
if (!ComparatorUtils.equals(xtd,new XMLTableData())) {
if (!ComparatorUtils.equals(xtd, new XMLTableData())) {
xmlNodeTree.initData();
String[] path = xtd.getXPath();
String[] paths;
if (path != null && path.length > 0) {
DefaultTreeModel treeModel = (DefaultTreeModel)xmlNodeTree.getModel();
DefaultTreeModel treeModel = (DefaultTreeModel) xmlNodeTree.getModel();
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
if (treeModel != null) {
if(!ComparatorUtils.equals(treeModel.getRoot().toString(),"")){
paths = new String[path.length - 1];
for(int i = 1;i< path.length;i++){
paths[i -1] = path[i];
}
}else{
if (!ComparatorUtils.equals(treeModel.getRoot().toString(), "")) {
paths = new String[path.length - 1];
for (int i = 1; i < path.length; i++) {
paths[i - 1] = path[i];
}
} else {
paths = path;
root.setUserObject(ROOTTAG);
}
if (treeModel.getRoot() instanceof ExpandMutableTreeNode) {
selectNode((ExpandMutableTreeNode)treeModel.getRoot(), 0, paths);
selectNode((ExpandMutableTreeNode) treeModel.getRoot(), 0, paths);
if (selectedNode != null) {
TreePath treepath = new TreePath(treeModel.getPathToRoot(selectedNode));
xmlNodeTree.setSelectionPath(treepath);
@ -571,8 +577,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
}
//防止某种操作导致添加的tag作为root出现。
if(ComparatorUtils.equals(root.toString(),ROOTTAG)){
root.setUserObject(StringUtils.EMPTY);
if (ComparatorUtils.equals(root.toString(), ROOTTAG)) {
root.setUserObject(StringUtils.EMPTY);
}
}
}
@ -638,7 +644,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
ttd.setDelimiter(this.showDelimiter());
ttd.setIgnoreOneMoreDelimiter(ignoreOneMoreDelimiterCheckBox.isSelected());
ttd.setNeedColumnName(needColumnNameCheckBox.isSelected());
ttd.setCharset((String)charsetComboBox.getSelectedItem());
ttd.setCharset((String) charsetComboBox.getSelectedItem());
fileTableData = ttd;
return ttd;
}
@ -667,12 +673,12 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
xmlColumnsList.clear();
ExpandMutableTreeNode treeNode;
boolean flag = true;
for(int i = 0;i < selectedNode.getChildCount();i++){
for (int i = 0; i < selectedNode.getChildCount(); i++) {
treeNode = (ExpandMutableTreeNode) selectedNode.getChildAt(i);
if(treeNode.isLeaf()){
if (treeNode.isLeaf()) {
xmlColumnsList.add(treeNode.toString());
}else{
if(flag){
} else {
if (flag) {
flag = false;
finalSelectedNode = treeNode;
leafNode(treeNode);
@ -692,34 +698,34 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
//wikky:构建树时为了美观把添加的根节点值赋为空显示,现在还得该回去使得预览时能够顺利取到数据。
private String[] getPaths(){
private String[] getPaths() {
TreePath treePath = GUICoreUtils.getTreePath(finalSelectedNode);
String path = StringUtils.EMPTY;
if (treePath != null) {
Object[] paths = treePath.getPath();
for (int i = 0; i < paths.length; i++) {
path+="/" + paths[i];
path += "/" + paths[i];
}
}
if (path.startsWith("/")) {
path = path.substring(1);
}
String[] paths = path.split("/");
if(ComparatorUtils.equals(paths[0],StringUtils.EMPTY)){
if (ComparatorUtils.equals(paths[0], StringUtils.EMPTY)) {
paths[0] = ROOTTAG;
}
return paths;
}
private void leafNode(ExpandMutableTreeNode treeNode){
private void leafNode(ExpandMutableTreeNode treeNode) {
boolean flag = true;
ExpandMutableTreeNode firstNode;
for(int i = 0;i < treeNode.getChildCount();i++){
for (int i = 0; i < treeNode.getChildCount(); i++) {
firstNode = (ExpandMutableTreeNode) treeNode.getChildAt(i);
if(firstNode.isLeaf()){
if (firstNode.isLeaf()) {
xmlColumnsList.add(firstNode.toString());
}else{
if(flag){
} else {
if (flag) {
flag = false;
finalSelectedNode = treeNode;
leafNode(firstNode);
@ -729,16 +735,16 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private void selectNode(ExpandMutableTreeNode node, int layer, String[] paths) {
if (selectedNode != null || node == null){
if (selectedNode != null || node == null) {
return;
}
if (layer < paths.length && paths[layer] != null && ComparatorUtils.equals(paths[layer],node.getUserObject())) {
if (layer == paths.length -1) {
if (layer < paths.length && paths[layer] != null && ComparatorUtils.equals(paths[layer], node.getUserObject())) {
if (layer == paths.length - 1) {
selectedNode = node;
return;
}
for (int i = 0; i < node.getChildCount(); i++) {
selectNode((ExpandMutableTreeNode)node.getChildAt(i), layer + 1, paths);
selectNode((ExpandMutableTreeNode) node.getChildAt(i), layer + 1, paths);
}
}
}
@ -800,8 +806,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
toolbarDef.addShortCut(refreshAction);
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolbarDef.updateToolBar(toolBar);
toolbarPanel.add(keyPointLaber,BorderLayout.WEST);
toolbarPanel.add(toolBar,BorderLayout.EAST);
toolbarPanel.add(keyPointLaber, BorderLayout.WEST);
toolbarPanel.add(toolBar, BorderLayout.EAST);
this.add(toolbarPanel, BorderLayout.NORTH);
}
@ -817,6 +823,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
xmlNodeTree.waitRefresh();
xmlNodeTree.refreshData();
@ -845,8 +852,9 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private MouseListener treeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (XMLNodeTree.this.getModel() != treeModel){
if (XMLNodeTree.this.getModel() != treeModel) {
return;
}
int selRow = XMLNodeTree.this.getRowForLocation(e.getX(), e.getY());
@ -858,12 +866,12 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
return;//没有选中某个树节点,就直接返回啦
}
Object selObject = selPath.getLastPathComponent();
if (selObject instanceof ExpandMutableTreeNode ) {
if (selObject instanceof ExpandMutableTreeNode) {
ExpandMutableTreeNode expandMutableTreeNode = (ExpandMutableTreeNode) selObject;
if (!expandMutableTreeNode.isLeaf()) {
selectedNode = expandMutableTreeNode;
} else {
selectedNode = (ExpandMutableTreeNode)expandMutableTreeNode.getParent();
selectedNode = (ExpandMutableTreeNode) expandMutableTreeNode.getParent();
}
}
}
@ -906,7 +914,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
DataSource dataSource = null;
if (localFileRadioButton.isSelected()) {
String localTextString = StringUtils.trimToNull(localText.getText());
if(StringUtils.isEmpty(localTextString)){
if (StringUtils.isEmpty(localTextString)) {
FineLoggerFactory.getLogger().info("The file path is empty.");
loadedTreeModel();
return;
@ -914,7 +922,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
dataSource = new FileDataSource(localTextString, params);
} else {
String urlTextString = StringUtils.trimToNull(urlText.getText());
if (StringUtils.isEmpty(urlTextString)){
if (StringUtils.isEmpty(urlTextString)) {
FineLoggerFactory.getLogger().info("The url path is empty.");
loadedTreeModel();
return;
@ -922,7 +930,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
dataSource = new URLDataSource(urlTextString, params);
}
try {
InputStream in,input;
InputStream in, input;
if ((in = dataSource.getSourceStream(params)) != null) {
String xmlString = Utils.inputStream2String(in, (String) encodingComboBox.getSelectedItem());
String stringXml = addTag(xmlString);
@ -941,16 +949,20 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
loadedTreeModel();
}
if(treeModel.getChildCount(treeModel.getRoot()) == 1){
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(),0));
}else{
if (treeModel == null) {
FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader.");
return;
}
if (treeModel.getChildCount(treeModel.getRoot()) == 1) {
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(), 0));
} else {
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
root.setUserObject(StringUtils.EMPTY);
}
this.setModel(treeModel);
}
private void loadedTreeModel(){
private void loadedTreeModel() {
ExpandMutableTreeNode rootTreeNode = new ExpandMutableTreeNode(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loaded_Tree_Model"));
rootTreeNode.setExpanded(false);
rootTreeNode.setAllowsChildren(false);
@ -958,14 +970,14 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
XMLNodeTree.this.setModel(loadedTreeModel);
}
private String addTag(String string){
private String addTag(String string) {
String stringWithTag;
int beginIndex = 0;
int firstIndex = string.indexOf(">");
int endIndex = string.length();
String firstPart = string.substring(beginIndex,firstIndex + 1);
String firstPart = string.substring(beginIndex, firstIndex + 1);
String secondPart = STARTTAG;
String thirdPart = string.substring(firstIndex + 1,endIndex);
String thirdPart = string.substring(firstIndex + 1, endIndex);
String lastPart = ENDTAG;
stringWithTag = firstPart + secondPart + thirdPart + lastPart;
return stringWithTag;
@ -986,6 +998,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
this.layer = layer;
}
@Override
public void readXML(XMLableReader reader) {
String nodeName;
if (this.layer < 0) {

6
designer-base/src/main/java/com/fr/design/dialog/BasicDialog.java

@ -1,10 +1,10 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
import java.awt.*;
/*
* @author _denny
*/
@Open
public abstract class BasicDialog extends UIDialog {
public static final Dimension SMALL = new Dimension(340, 180);
public static final Dimension MEDIUM = new Dimension(600, 400);

17
designer-base/src/main/java/com/fr/design/dialog/BasicPane.java

@ -1,24 +1,17 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Window;
/*
* _denny: 这里的BasicPane通常会有populate & update方法
* 记得populate 一定要在对应的dialog setVisible之前populate
*/
import java.awt.*;
@Open
public abstract class BasicPane extends JPanel {
/**

3
designer-base/src/main/java/com/fr/design/dialog/DialogActionAdapter.java

@ -1,5 +1,8 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
@Open
public abstract class DialogActionAdapter implements DialogActionListener {
@Override
public void doOk() {}

7
designer-base/src/main/java/com/fr/design/dialog/DialogActionListener.java

@ -1,8 +1,11 @@
package com.fr.design.dialog;
import com.fr.common.annotations.Open;
@Open
public interface DialogActionListener {
public void doOk();
void doOk();
public void doCancel();
void doCancel();
}

8
designer-base/src/main/java/com/fr/design/dialog/UIDialog.java

@ -25,13 +25,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
/**
* Created with IntelliJ IDEA.
* User: 小灰灰
* Date: 13-7-16
* Time: 下午2:17
* To change this template use File | Settings | File Templates.
*/
public abstract class UIDialog extends JDialog {
public static final String OK_BUTTON = "basic_ok";
public static final String CANCEL_BUTTON = "basic_cancel";

48
designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java

@ -1,6 +1,7 @@
package com.fr.design.extra;
import com.fr.base.passport.FinePassportManager;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor;
@ -8,47 +9,30 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javafx.concurrent.Task;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import java.awt.Color;
import java.awt.Desktop;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author vito
*/
public class LoginWebBridge {
//默认查询消息时间, 30s
private static final long CHECK_MESSAGE_TIME = 30 * 1000L;
//数据查询正常的标志 ok
private static final String SUCCESS_MESSAGE_STATUS = "ok";
//数据通讯失败
private static final String FAILED_MESSAGE_STATUS = "error";
//最低消息的条数
private static final int MIN_MESSAGE_COUNT = 0;
//登录成功
private static final String LOGININ = "0";
//用户名不存在
private static final String USERNAME_NOT_EXSIT = "-1";
//密码错误
private static final String PASSWORD_ERROR = "-2";
//未知错误
private static final String UNKNOWN_ERROR = "-3";
//网络连接失败
private static final String NET_FAILED = "-4";
//用户名,密码为空
private static final String LOGIN_INFO_EMPTY = "-5";
private static final int TIME_OUT = 10000;
private static final String LOGIN_SUCCESS = "ok";
private static final String LOGIN_FAILED = "failed";
private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static LoginWebBridge helper;
//消息条数
@ -131,22 +115,6 @@ public class LoginWebBridge {
return client.isServerAlive();
}
private String encode(String str) {
try {
return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8);
} catch (UnsupportedEncodingException e) {
return str;
}
}
private void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 注册页面
*/
@ -178,7 +146,9 @@ public class LoginWebBridge {
*/
public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password));
new Thread(task).start();
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("bbsDefaultLogin"));
es.submit(task);
es.shutdown();
}
/**
@ -250,10 +220,6 @@ public class LoginWebBridge {
}
}
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (url.indexOf("qqLogin.html") > 0) {
return;
}
}
}

2
designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java

@ -15,6 +15,7 @@ import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
@ -142,6 +143,7 @@ public class PluginControlPane extends BasicPane {
}
}
@Nullable
public PluginView getSelectedPlugin() {
return (PluginView) pluginList.getSelectedValue();
}

16
designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java

@ -28,8 +28,6 @@ import java.util.List;
* @since 8.0
*/
public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> {
private static final int LISTNUM1 = 1;
private static final int LISTNUM100 = 100;
private UILabel errorMsgLabel;
private UITabbedPane tabbedPane;
private PluginControlPane controlPane;
@ -45,6 +43,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
*
* @return 创建的页面对象
*/
@Override
public JPanel createSuccessPane() {
return new PluginStatusCheckCompletePane() {
@ -130,8 +129,8 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
*
* @return 插件
*/
@Override
public List<PluginView> loadData() throws Exception {
//Thread.sleep(3000);
return PluginsReaderFromStore.readPlugins();
}
@ -140,6 +139,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
*
* @param plugins 插件
*/
@Override
public void loadOnSuccess(List<PluginView> plugins) {
controlPane.loadPlugins(plugins);
tabbedPane.setTitleAt(2, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_All_Plugins") + "(" + plugins.size() + ")");
@ -150,10 +150,12 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
*
* @param e 异常消息
*/
@Override
public void loadOnFailed(Exception e) {
errorMsgLabel.setText(e.getCause().getMessage());
}
@Override
protected void installFromDiskFile() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
@ -196,10 +198,11 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
}
if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
PluginView plugin = controlPane.getSelectedPlugin();
String id = null;
if (plugin != null) {
id = plugin.getID();
if (plugin == null) {
FineLoggerFactory.getLogger().error("selected plugin is null");
return;
}
String id = plugin.getID();
try {
PluginMarker pluginMarker = PluginMarker.create(id, plugin.getVersion());
@ -219,6 +222,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
*
* @return 标题字符串
*/
@Override
public String textForLoadingLabel() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Load_Plugins_From_Server");
}

9
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -5,17 +5,15 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.CloudCenter;
import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
@ -280,7 +278,10 @@ public class WebViewDlgHelper {
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
}
} catch (InterruptedException | ExecutionException e) {
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

1
designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java

@ -194,6 +194,7 @@ public class JavaEditorPane extends BasicPane {
JOptionPane.showMessageDialog(null, message);
} catch (InterruptedException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
Thread.currentThread().interrupt();
} catch (ExecutionException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
}

14
designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java

@ -23,6 +23,7 @@ public abstract class VariableResolverAdapter implements VariableResolver {
*
* @return 内置参数
*/
@Override
public String[] resolveCurReportVariables() {
String[] variables = new String[]{
ScriptConstants.SUMMARY_TAG + "page_number",
@ -38,10 +39,10 @@ public abstract class VariableResolverAdapter implements VariableResolver {
CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID
};
Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG);
for (BuiltInParametersProvider provider : set) {
return (String[]) ArrayUtils.addAll(variables, new String[]{
ScriptConstants.DETAIL_TAG + provider.getParametersName()
});
for (BuiltInParametersProvider provider : set) {
ArrayUtils.addAll(variables, new String[]{
ScriptConstants.DETAIL_TAG + provider.getParametersName()
});
}
return variables;
}
@ -65,6 +66,8 @@ public abstract class VariableResolverAdapter implements VariableResolver {
*
* @return 所有参数
*/
@Override
@SuppressWarnings("squid:S2259")
public String[] resolveTableDataParameterVariables() {
Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA);
String[] parameterNames = new String[parameters.length];
@ -79,6 +82,8 @@ public abstract class VariableResolverAdapter implements VariableResolver {
*
* @return 所有参数
*/
@Override
@SuppressWarnings("squid:S2259")
public String[] resolveReportParameterVariables() {
Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA);
String[] parameterNames = new String[parameters.length];
@ -93,6 +98,7 @@ public abstract class VariableResolverAdapter implements VariableResolver {
*
* @return 所有参数
*/
@Override
public String[] resolveGlobalParameterVariables() {
// 加上全局的参数
Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters();

100
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -125,60 +125,58 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
private class UICheckBoxUI extends MetalCheckBoxUI {
@Override
public void paint(Graphics g, JComponent c) {
synchronized (this) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
Dimension size = c.getSize();
Font f = c.getFont();
g.setFont(f);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
Rectangle viewRect = new Rectangle(size);
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
Insets i = c.getInsets();
viewRect.x += i.left;
viewRect.y += i.top;
viewRect.width -= (i.right + viewRect.x);
viewRect.height -= (i.bottom + viewRect.y);
Icon altIcon = b.getIcon();
String text = SwingUtilities.layoutCompoundLabel(
c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(),
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect, b.getIconTextGap());
// fill background
if (c.isOpaque()) {
g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height);
}
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (model.isSelected()) {
GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height, false, Constants.NULL,
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0);
} else if (model.isRollover() && !model.isSelected()) {
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
} else {
g.setColor(UIConstants.LINE_COLOR);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
}
public synchronized void paint(Graphics g, JComponent c) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
Dimension size = c.getSize();
Font f = c.getFont();
g.setFont(f);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
Rectangle viewRect = new Rectangle(size);
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
Insets i = c.getInsets();
viewRect.x += i.left;
viewRect.y += i.top;
viewRect.width -= (i.right + viewRect.x);
viewRect.height -= (i.bottom + viewRect.y);
Icon altIcon = b.getIcon();
String text = SwingUtilities.layoutCompoundLabel(
c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(),
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect, b.getIconTextGap());
// fill background
if (c.isOpaque()) {
g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height);
}
if (model.isSelected()) {
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (model.isSelected()) {
GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height, false, Constants.NULL,
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0);
} else if (model.isRollover() && !model.isSelected()) {
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
} else {
g.setColor(UIConstants.LINE_COLOR);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
}
// Draw the Text
drawLine(text, g, b, c, textRect, fm);
if (model.isSelected()) {
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
// Draw the Text
drawLine(text, g, b, c, textRect, fm);
}
private void drawLine(String text, Graphics g, AbstractButton b, JComponent c, Rectangle textRect, FontMetrics fm) {

2
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBoxUI.java

@ -64,7 +64,7 @@ public class UICheckBoxUI extends MetalCheckBoxUI {
}
}
static BasicStroke focusStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[]{1.0f / 1.0f}, 1.0f);
static BasicStroke focusStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[]{1.0f}, 1.0f);
protected void paintFocus(Graphics g, Rectangle t, Dimension arg2) {
if (!ThemeUtils.BUTTON_FOCUS) {

1
designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java

@ -84,6 +84,7 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
LazyComboBox.this.loadList(get());
} catch (InterruptedException | ExecutionException exception) {
FineLoggerFactory.getLogger().debug(exception.getMessage());
Thread.currentThread().interrupt();
}
LazyComboBox.this.showPopup();
}

1
designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java

@ -40,6 +40,7 @@ public class LazyComboBoxTest {
Thread.sleep(3000);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
return m;
}

12
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java

@ -127,10 +127,6 @@ public class UIComboBoxButton extends JButton {
boolean savedOpaque = false;
paintRender(g, c, mustResetOpaque, savedOpaque, leftToRight, width, insets, iconWidth, left, top, height);
if (mustResetOpaque) {
JComponent jc = (JComponent) c;
jc.setOpaque(savedOpaque);
}
}
private void paintRender(Graphics g, Component c, boolean mustResetOpaque, boolean savedOpaque, boolean leftToRight,
@ -152,14 +148,6 @@ public class UIComboBoxButton extends JButton {
} else {
rendererPane.paintComponent(g, c, this, left + iconWidth, top, cWidth, height, shouldValidate);
}
if (paintFocus && ThemeUtils.COMBO_FOCUS) {
g.setColor(Color.black);
Graphics2D g2d = (Graphics2D) g;
Rectangle r = new Rectangle(left, top, 2, 2);
TexturePaint tp = new TexturePaint(focusImg, r);
g2d.setPaint(tp);
g2d.draw(new Rectangle(left, top, cWidth, height));
}
}
}

51
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -7,12 +7,25 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import com.fr.general.IOUtils;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>();
@ -66,10 +79,10 @@ public class UICheckListPopup extends UIPopupMenu {
}
addSelectListener();
jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10));
jScrollPane.setPreferredSize(new Dimension(130, checkBoxList.size() * CHECKBOX_HEIGHT + 10));
//超过1页的数量时显示滚动条
if (checkBoxList.size() > maxDisplayNumber) {
jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT));
jScrollPane.setPreferredSize(new Dimension(130, maxDisplayNumber * CHECKBOX_HEIGHT));
}
checkboxPane.repaint();
jScrollPane.repaint();
@ -77,11 +90,11 @@ public class UICheckListPopup extends UIPopupMenu {
private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT));
checkPane.setPreferredSize(new Dimension(120, CHECKBOX_HEIGHT));
final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE);
label.setPreferredSize(new Dimension(156, 20));
label.setPreferredSize(new Dimension(80, 20));
checkPane.setBackground(Color.WHITE);
checkPane.add(temp);
checkPane.add(label);
@ -95,8 +108,8 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = new JCheckBox();
checkBox.setPreferredSize(new Dimension(20, 20));
checkBox.setBackground(Color.WHITE);
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
checkBox.setIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
checkBox.setSelectedIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
return checkBox;
}
@ -109,10 +122,12 @@ public class UICheckListPopup extends UIPopupMenu {
*/
private void addMouseListener(final JCheckBox checkBox, final UILabel label) {
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
label.setBackground(Color.WHITE);
}
@Override
public void mouseEntered(MouseEvent e) {
label.setOpaque(true);
label.setBackground(mouseEnteredColor);
@ -133,6 +148,7 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = checkBoxList.get(i);
if (i == 0) {
checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
//全选checkbox事件
doSelectAll(checkBoxList.get(0).isSelected());
@ -140,6 +156,7 @@ public class UICheckListPopup extends UIPopupMenu {
});
} else {
checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
//do半选判断放在commit事件里
commit();
@ -157,8 +174,17 @@ public class UICheckListPopup extends UIPopupMenu {
private void doSelectAll(boolean isSelected) {
for (int i = 1; i < checkBoxList.size(); i++) {
//全选和反全选都不考虑全选按钮本身
if (!SELECT_ALL.equals(checkBoxList.get(i).getText()))
if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) {
checkBoxList.get(i).setSelected(isSelected);
}
}
}
public void setSelectedValue(Map<Object, Boolean> selectedValues) {
List<Object> allValue = Arrays.asList(values);
for (Object value : selectedValues.keySet()) {
int index = allValue.indexOf(value);
checkBoxList.get(index + 1).setSelected(selectedValues.get(value));
}
}
@ -214,8 +240,9 @@ public class UICheckListPopup extends UIPopupMenu {
}
public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener))
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
public void removeActionListener(ActionListener listener) {

27
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -11,14 +11,23 @@ import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 设计器下拉复选框组件
@ -125,7 +134,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private UITextField createEditor() {
UITextField editor = new UITextField();
editor.setEditable(false);
editor.setPreferredSize(new Dimension(180, 20));
editor.setPreferredSize(new Dimension(110, 20));
addPopupListener(editor);
return editor;
@ -138,6 +147,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
*/
private void addPopupListener(Component component) {
component.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
togglePopup();
}
@ -166,6 +176,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private class PopupAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) {
selectedValues = popup.getSelectedValues();
@ -292,13 +303,15 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
}
public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener))
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
public void removeActionListener(ActionListener listener) {
if (listeners.contains(listener))
if (listeners.contains(listener)) {
listeners.remove(listener);
}
}
protected void fireActionPerformed(ActionEvent e) {
@ -307,6 +320,10 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
}
}
public void setSelectedValues(Map<Object, Boolean> map) {
popup.setSelectedValue(map);
}
/**
* 简单的测试demo
* @param args

5
designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -438,11 +438,6 @@ public class UIResizableContainer extends JPanel {
containerWidth = containerWidth > MAX_WIDTH ? MAX_WIDTH : containerWidth;
containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth;
if (containerWidth < MIN_WIDTH) {
upPane.setVisible(false);
downPane.setVisible(false);
containerWidth = toolPaneHeight;
}
refreshContainer();
if (DesignerMode.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();

6
designer-base/src/main/java/com/fr/design/gui/ilable/MultilineLabel.java

@ -19,15 +19,15 @@ import com.fr.design.gui.itextarea.UITextArea;
*/
public class MultilineLabel extends UITextArea {
public MultilineLabel() {
initComponents();
initCurrentComponents();
}
public MultilineLabel(String s) {
super(s);
initComponents();
initCurrentComponents();
}
private void initComponents() {
private void initCurrentComponents() {
adjustUI();
}

4
designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -7,6 +7,7 @@ package com.fr.design.gui.imenu;
import com.fr.design.utils.ColorRoutines;
import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
@ -579,7 +580,8 @@ public class UIBasicMenuItemUI extends MenuItemUI {
*/
private boolean isInternalFrameSystemMenu() {
String actionCommand = menuItem.getActionCommand();
return (actionCommand == "Close") || (actionCommand == "Minimize") || (actionCommand == "Restore") || (actionCommand == "Maximize");
return (StringUtils.equals(actionCommand,"Close") || StringUtils.equals(actionCommand,"Minimize")
|| StringUtils.equals(actionCommand,"Restore") || StringUtils.equals(actionCommand,"Maximize"));
}
//////////////////////////////////////////////////////////

14
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java

@ -1,5 +1,7 @@
package com.fr.design.gui.iscrollbar;
import com.fr.design.constants.UIConstants;
import com.fr.stable.StringUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
@ -20,7 +22,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BoundedRangeModel;
import javax.swing.InputMap;
import javax.swing.JComponent;
@ -38,8 +39,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI;
import javax.swing.plaf.UIResource;
import com.fr.design.constants.UIConstants;
import sun.swing.DefaultLookup;
/**
@ -148,6 +147,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
*
* @param c
*/
@Override
public void installUI(JComponent c) {
scrollbar = (JScrollBar) c;
thumbRect = new Rectangle(0, 0, 0, 0);
@ -163,6 +163,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
*
* @param c
*/
@Override
public void uninstallUI(JComponent c) {
scrollbar = (JScrollBar) c;
uninstallListeners();
@ -357,6 +358,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
/**
* 只画Thumb
*/
@Override
public void paint(Graphics g, JComponent c) {
Rectangle thumbBounds = getThumbBounds();
if (thumbBounds.intersects(g.getClipBounds())) {
@ -380,6 +382,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* @see #getMaximumSize
* @see #getMinimumSize
*/
@Override
public Dimension getPreferredSize(JComponent c) {
return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth, 48) : new Dimension(48, scrollBarWidth);
}
@ -390,6 +393,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* @see #getMinimumSize
* @see #getPreferredSize
*/
@Override
public Dimension getMaximumSize(JComponent c) {
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
@ -937,6 +941,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
private transient int direction = +1;
@Override
public void mouseReleased(MouseEvent e) {
isPressing = false;
if (isDragging) {
@ -968,6 +973,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* one page. If there is no thumb then page up if the mouse is in the
* upper half of the track.
*/
@Override
public void mousePressed(MouseEvent e) {
boolean isMiddle = !isSupportsAbsolutePositioning() && SwingUtilities.isMiddleMouseButton(e);
if (SwingUtilities.isRightMouseButton(e) || isMiddle) {
@ -1313,7 +1319,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if ("model" == propertyName) {
if (StringUtils.equals("model", propertyName)) {
BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
BoundedRangeModel newModel = (BoundedRangeModel) e.getNewValue();
oldModel.removeChangeListener(modelListener);

31
designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java

@ -0,0 +1,31 @@
package com.fr.design.gui.ispinner;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
/**
* Created by IntelliJ IDEA.
* Author : Hugh.C
* Date: 19-08-28
* Time: 下午2:19
*/
public class UnsignedIntUISpinner extends UISpinner {
public UnsignedIntUISpinner(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta);
}
public UnsignedIntUISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue);
}
@Override
protected UINumberField initNumberField() {
return new UIIntNumberField() {
public boolean shouldResponseChangeListener() {
return false;
}
};
}
}

35
designer-base/src/main/java/com/fr/design/gui/itable/AbstractPropertyTable.java

@ -3,11 +3,15 @@
*/
package com.fr.design.gui.itable;
import java.awt.*;
import com.fr.general.ComparatorUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel;
@ -16,9 +20,6 @@ import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import com.fr.general.ComparatorUtils;
/**
* @author richer
* @since 6.5.3
@ -109,8 +110,8 @@ public abstract class AbstractPropertyTable extends JTable {
@Override
public TableCellEditor getCellEditor(int row, int column) {
if (groups != null) {
Point pIndex = getGroupIndex(row);
Point pIndex = getGroupIndex(row);
if (groups != null && pIndex != null) {
PropertyGroup group = groups.get(pIndex.x);
if (pIndex.y == 0) {
return super.getCellEditor(row, column);
@ -162,7 +163,7 @@ public abstract class AbstractPropertyTable extends JTable {
int row = AbstractPropertyTable.super.rowAtPoint(e.getPoint());
if (row != -1) {
Point pIndex = getGroupIndex(row);
if (pIndex.y == 0 && e.getClickCount() > 1) {
if (pIndex != null && pIndex.y == 0 && e.getClickCount() > 1) {
toggleCollapse(pIndex.x);
}
}
@ -180,7 +181,7 @@ public abstract class AbstractPropertyTable extends JTable {
int row = AbstractPropertyTable.super.rowAtPoint(e.getPoint());
if (row != -1) {
Point pIndex = getGroupIndex(row);
if (pIndex.y == 0 && e.getClickCount() == 1 && e.getX() < PROPERTY_ICON_WIDTH) {
if (pIndex != null && pIndex.y == 0 && e.getClickCount() == 1 && e.getX() < PROPERTY_ICON_WIDTH) {
toggleCollapse(pIndex.x);
}
}
@ -263,6 +264,9 @@ public abstract class AbstractPropertyTable extends JTable {
@Override
public void setValueAt(Object aValue, int row, int column) {
Point pIndex = getGroupIndex(row);
if (pIndex == null) {
return;
}
PropertyGroup group = groups.get(pIndex.x);
if (pIndex.y != 0) {
Object old_value = getValueAt(row, column);
@ -276,16 +280,11 @@ public abstract class AbstractPropertyTable extends JTable {
@Override
public boolean isCellEditable(int row, int column) {
Point pIndex = getGroupIndex(row);
PropertyGroup group = groups.get(pIndex.x);
if (pIndex.y == 0) {
if (column == 0) {
return false;
} else {
return false;
}
} else {
return column == 1 && group.getModel().isEditable(pIndex.y - 1);
if (pIndex == null) {
return false;
}
PropertyGroup group = groups.get(pIndex.x);
return pIndex.y != 0 && (column == 1 && group.getModel().isEditable(pIndex.y - 1));
}
}
}

2
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -244,7 +244,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
FineLoggerFactory.getLogger().error(ee.getMessage(), ee);
}
}
if (getRowCount() < 1 || selectedRow.length < 0) {
if (getRowCount() < 1) {
return;
}

3
designer-base/src/main/java/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java

@ -153,6 +153,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
try {
Thread.sleep(3);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
if (currentPanel != panel) {
@ -202,7 +203,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
}
@Override
public int getSelectedIndex() {
public synchronized int getSelectedIndex() {
return selectedIndex;
}

1
designer-base/src/main/java/com/fr/design/gui/style/NumberDragBar.java

@ -127,6 +127,7 @@ public class NumberDragBar extends JComponent {
revalidate();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.toString());
Thread.currentThread().interrupt();
}
}
});

4
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxDocument.java

@ -366,7 +366,9 @@ public class RSyntaxDocument extends RDocument implements Iterable<Token>,
*/
public boolean getShouldIndentNextLine(int line) {
Token t = getTokenListForLine(line);
t = t.getLastNonCommentNonWhitespaceToken();
if (t != null) {
t = t.getLastNonCommentNonWhitespaceToken();
}
return tokenMaker.getShouldIndentNextLineAfter(t);
}

3806
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java

File diff suppressed because it is too large Load Diff

2563
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java

File diff suppressed because it is too large Load Diff

433
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java

@ -9,24 +9,37 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.*;
import javax.swing.event.*;
import javax.swing.text.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
/**
* The <code>javax.swing.text.View</code> object used by {@link RSyntaxTextArea}
* when word wrap is disabled. It implements syntax highlighting for
* programming languages using the colors and font styles specified by the
* <code>RSyntaxTextArea</code>.<p>
*
* <p>
* You don't really have to do anything to use this class, as
* {@link RSyntaxTextAreaUI} automatically sets the text area's view to be
* an instance of this class if word wrap is disabled.<p>
*
* <p>
* The tokens that specify how to paint the syntax-highlighted text are gleaned
* from the text area's {@link RSyntaxDocument}.
*
@ -34,7 +47,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
* @version 0.3
*/
public class SyntaxView extends View implements TabExpander,
TokenOrientedView, RSTAView {
TokenOrientedView, RSTAView {
/**
* The default font used by the text area. If this changes we need to
@ -105,7 +118,7 @@ public class SyntaxView extends View implements TabExpander,
tabSize = getTabSize() * metrics.charWidth(' ');
Element lines = getElement();
int n = lines.getElementCount();
for (int i=0; i<n; i++) {
for (int i = 0; i < n; i++) {
Element line = lines.getElement(i);
float w = getLineWidth(i);
if (w > longLineWidth) {
@ -121,8 +134,8 @@ public class SyntaxView extends View implements TabExpander,
* in a location that this view is responsible for.
*
* @param changes the change information from the associated document
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @see View#changedUpdate
*/
@Override
@ -135,22 +148,21 @@ public class SyntaxView extends View implements TabExpander,
* Repaint the given line range.
*
* @param line0 The starting line number to repaint. This must
* be a valid line number in the model.
* be a valid line number in the model.
* @param line1 The ending line number to repaint. This must
* be a valid line number in the model.
* @param a The region allocated for the view to render into.
* @param host The component hosting the view (used to call repaint).
* be a valid line number in the model.
* @param a The region allocated for the view to render into.
* @param host The component hosting the view (used to call repaint).
*/
protected void damageLineRange(int line0, int line1, Shape a,
Component host) {
Component host) {
if (a != null) {
Rectangle area0 = lineToRect(a, line0);
Rectangle area1 = lineToRect(a, line1);
if ((area0 != null) && (area1 != null)) {
Rectangle dmg = area0.union(area1); // damage.
host.repaint(dmg.x, dmg.y, dmg.width, dmg.height);
}
else
} else
host.repaint();
}
}
@ -163,19 +175,19 @@ public class SyntaxView extends View implements TabExpander,
* off.
*
* @param painter The painter to render the tokens.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @return The x-coordinate representing the end of the painted text.
*/
private float drawLine(TokenPainter painter, Token token, Graphics2D g,
float x, float y) {
float x, float y) {
float nextX = x; // The x-value at the end of our text.
float nextX = x; // The x-value at the end of our text.
while (token!=null && token.isPaintable() && nextX<clipEnd) {
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
while (token != null && token.isPaintable() && nextX < clipEnd) {
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
token = token.getNextToken();
}
@ -198,29 +210,29 @@ public class SyntaxView extends View implements TabExpander,
* language. Tokens are checked for being in a selected region, and are
* rendered appropriately if they are.
*
* @param painter The painter to render the tokens.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @param painter The painter to render the tokens.
* @param token The list of tokens to draw.
* @param g The graphics context in which to draw.
* @param x The x-coordinate at which to draw.
* @param y The y-coordinate at which to draw.
* @param selStart The start of the selection.
* @param selEnd The end of the selection.
* @param selEnd The end of the selection.
* @return The x-coordinate representing the end of the painted text.
*/
private float drawLineWithSelection(TokenPainter painter, Token token,
Graphics2D g, float x, float y, int selStart, int selEnd) {
Graphics2D g, float x, float y, int selStart, int selEnd) {
float nextX = x; // The x-value at the end of our text.
float nextX = x; // The x-value at the end of our text.
while (token!=null && token.isPaintable() && nextX<clipEnd) {
while (token != null && token.isPaintable() && nextX < clipEnd) {
// Selection starts in this token
if (token.containsPosition(selStart)) {
if (selStart>token.getOffset()) {
if (selStart > token.getOffset()) {
tempToken.copyFrom(token);
tempToken.textCount = selStart - tempToken.getOffset();
nextX = painter.paint(tempToken,g,nextX,y,host, this, clipStart);
nextX = painter.paint(tempToken, g, nextX, y, host, this, clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(selStart);
// Clone required since token and tempToken must be
@ -229,21 +241,20 @@ public class SyntaxView extends View implements TabExpander,
}
int tokenLen = token.length();
int selCount = Math.min(tokenLen, selEnd-token.getOffset());
if (selCount==tokenLen) {
nextX = painter.paintSelected(token, g, nextX,y, host,
this, clipStart);
}
else {
int selCount = Math.min(tokenLen, selEnd - token.getOffset());
if (selCount == tokenLen) {
nextX = painter.paintSelected(token, g, nextX, y, host,
this, clipStart);
} else {
tempToken.copyFrom(token);
tempToken.textCount = selCount;
nextX = painter.paintSelected(tempToken, g, nextX,y, host,
nextX = painter.paintSelected(tempToken, g, nextX, y, host,
this, clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(token.getOffset() + selCount);
token = tempToken;
nextX = painter.paint(token, g, nextX,y, host, this,
clipStart);
nextX = painter.paint(token, g, nextX, y, host, this,
clipStart);
}
}
@ -252,24 +263,24 @@ public class SyntaxView extends View implements TabExpander,
else if (token.containsPosition(selEnd)) {
tempToken.copyFrom(token);
tempToken.textCount = selEnd - tempToken.getOffset();
nextX = painter.paintSelected(tempToken, g, nextX,y, host, this,
nextX = painter.paintSelected(tempToken, g, nextX, y, host, this,
clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(selEnd);
token = tempToken;
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
}
// This token is entirely selected
else if (token.getOffset()>=selStart &&
token.getEndOffset()<=selEnd) {
nextX = painter.paintSelected(token, g, nextX,y, host, this,
else if (token.getOffset() >= selStart &&
token.getEndOffset() <= selEnd) {
nextX = painter.paintSelected(token, g, nextX, y, host, this,
clipStart);
}
// This token is entirely unselected
else {
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
}
token = token.getNextToken();
@ -293,16 +304,16 @@ public class SyntaxView extends View implements TabExpander,
/**
* Calculates the width of the line represented by the given element.
*
* @param line The line for which to get the length.
* @param line The line for which to get the length.
* @param lineNumber The line number of the specified line in the document.
* @return The width of the line.
*/
private float getLineWidth(int lineNumber) {
Token tokenList = ((RSyntaxDocument)getDocument()).
getTokenListForLine(lineNumber);
Token tokenList = ((RSyntaxDocument) getDocument()).
getTokenListForLine(lineNumber);
return RSyntaxUtilities.getTokenListWidth(tokenList,
(RSyntaxTextArea)getContainer(),
this);
(RSyntaxTextArea) getContainer(),
this);
}
@ -312,23 +323,23 @@ public class SyntaxView extends View implements TabExpander,
* they might not be in the same order found in the model, or they just
* might not allow access to some of the locations in the model.
*
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param direction the direction from the current position that can
* be thought of as the arrow keys typically found on a keyboard.
* This may be SwingConstants.WEST, SwingConstants.EAST,
* SwingConstants.NORTH, or SwingConstants.SOUTH.
* be thought of as the arrow keys typically found on a keyboard.
* This may be SwingConstants.WEST, SwingConstants.EAST,
* SwingConstants.NORTH, or SwingConstants.SOUTH.
* @return the location within the model that best represents the next
* location visual position.
* @exception BadLocationException
* @exception IllegalArgumentException for an invalid direction
* location visual position.
* @throws BadLocationException
* @throws IllegalArgumentException for an invalid direction
*/
@Override
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
throws BadLocationException {
int direction, Position.Bias[] biasRet)
throws BadLocationException {
return RSyntaxUtilities.getNextVisualPositionFrom(pos, b, a,
direction, biasRet, this);
direction, biasRet, this);
}
@ -337,11 +348,11 @@ public class SyntaxView extends View implements TabExpander,
* axis.
*
* @param axis may be either View.X_AXIS or View.Y_AXIS
* @return the span the view would like to be rendered into >= 0.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @exception IllegalArgumentException for an invalid axis
* @return the span the view would like to be rendered into >= 0.
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @throws IllegalArgumentException for an invalid axis
*/
@Override
public float getPreferredSpan(int axis) {
@ -357,13 +368,13 @@ public class SyntaxView extends View implements TabExpander,
// We update lineHeight here as when this method is first
// called, lineHeight isn't initialized. If we don't do it
// here, we get no vertical scrollbar (as lineHeight==0).
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
lineHeight = host != null ? host.getLineHeight() : lineHeight;
// return getElement().getElementCount() * lineHeight;
int visibleLineCount = getElement().getElementCount();
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
int visibleLineCount = getElement().getElementCount();
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
@ -378,7 +389,7 @@ return visibleLineCount * lineHeight;
*/
private final int getRhsCorrection() {
int rhsCorrection = 10;
if (host!=null) {
if (host != null) {
rhsCorrection = host.getRightHandSideCorrection();
}
return rhsCorrection;
@ -391,8 +402,8 @@ return visibleLineCount * lineHeight;
* @return The tab size.
*/
private int getTabSize() {
Integer i = (Integer)getDocument().getProperty(
PlainDocument.tabSizeAttribute);
Integer i = (Integer) getDocument().getProperty(
PlainDocument.tabSizeAttribute);
int size = (i != null) ? i.intValue() : 5;
return size;
}
@ -407,26 +418,25 @@ return visibleLineCount * lineHeight;
*
* @param offset The offset in question.
* @return A token list for the physical (and in this view, logical) line
* before this one. If <code>offset</code> is in the first line in
* the document, <code>null</code> is returned.
* before this one. If <code>offset</code> is in the first line in
* the document, <code>null</code> is returned.
*/
public Token getTokenListForPhysicalLineAbove(int offset) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Element map = document.getDefaultRootElement();
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm==null) {
line--;
if (line>=0) {
return document.getTokenListForLine(line);
}
}
else {
line = fm.getVisibleLineAbove(line);
if (line>=0) {
return document.getTokenListForLine(line);
}
}
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm == null) {
line--;
if (line >= 0) {
return document.getTokenListForLine(line);
}
} else {
line = fm.getVisibleLineAbove(line);
if (line >= 0) {
return document.getTokenListForLine(line);
}
}
// int line = map.getElementIndex(offset) - 1;
// if (line>=0)
// return document.getTokenListForLine(line);
@ -443,26 +453,25 @@ else {
*
* @param offset The offset in question.
* @return A token list for the physical (and in this view, logical) line
* after this one. If <code>offset</code> is in the last physical
* line in the document, <code>null</code> is returned.
* after this one. If <code>offset</code> is in the last physical
* line in the document, <code>null</code> is returned.
*/
public Token getTokenListForPhysicalLineBelow(int offset) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Element map = document.getDefaultRootElement();
int lineCount = map.getElementCount();
int line = map.getElementIndex(offset);
if (!host.isCodeFoldingEnabled()) {
if (line<lineCount-1) {
return document.getTokenListForLine(line+1);
}
}
else {
FoldManager fm = host.getFoldManager();
line = fm.getVisibleLineBelow(line);
if (line>=0 && line<lineCount) {
return document.getTokenListForLine(line);
}
}
int line = map.getElementIndex(offset);
if (!host.isCodeFoldingEnabled()) {
if (line < lineCount - 1) {
return document.getTokenListForLine(line + 1);
}
} else {
FoldManager fm = host.getFoldManager();
line = fm.getVisibleLineBelow(line);
if (line >= 0 && line < lineCount) {
return document.getTokenListForLine(line);
}
}
// int line = map.getElementIndex(offset);
// int lineCount = map.getElementCount();
// if (line<lineCount-1)
@ -476,8 +485,8 @@ else {
* in a location that this view is responsible for.
*
* @param changes The change information from the associated document.
* @param a The current allocation of the view.
* @param f The factory to use to rebuild if the view has children.
* @param a The current allocation of the view.
* @param f The factory to use to rebuild if the view has children.
*/
@Override
public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f) {
@ -488,9 +497,9 @@ else {
/**
* Determine the rectangle that represents the given line.
*
* @param a The region allocated for the view to render into
* @param a The region allocated for the view to render into
* @param line The line number to find the region of. This must
* be a valid line number in the model.
* be a valid line number in the model.
*/
protected Rectangle lineToRect(Shape a, int line) {
Rectangle r = null;
@ -500,14 +509,14 @@ else {
// NOTE: lineHeight is not initially set here, leading to the
// current line not being highlighted when a document is first
// opened. So, we set it here just in case.
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
if (host.isCodeFoldingEnabled()) {
FoldManager fm = host.getFoldManager();
int hiddenCount = fm.getHiddenLineCountAbove(line);
line -= hiddenCount;
}
r = new Rectangle(alloc.x, alloc.y + line*lineHeight,
alloc.width, lineHeight);
lineHeight = host != null ? host.getLineHeight() : lineHeight;
if (host != null && host.isCodeFoldingEnabled()) {
FoldManager fm = host.getFoldManager();
int hiddenCount = fm.getHiddenLineCountAbove(line);
line -= hiddenCount;
}
r = new Rectangle(alloc.x, alloc.y + line * lineHeight,
alloc.width, lineHeight);
}
return r;
}
@ -518,19 +527,19 @@ if (host.isCodeFoldingEnabled()) {
* to the coordinate space of the view mapped to it.
*
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param a the allocated region to render into
* @return the bounding box of the given position
* @exception BadLocationException if the given position does not
* represent a valid location in the associated document
* @throws BadLocationException if the given position does not
* represent a valid location in the associated document
* @see View#modelToView
*/
@Override
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException {
throws BadLocationException {
// line coordinates
Element map = getElement();
RSyntaxDocument doc = (RSyntaxDocument)getDocument();
RSyntaxDocument doc = (RSyntaxDocument) getDocument();
int lineIndex = map.getElementIndex(pos);
Token tokenList = doc.getTokenListForLine(lineIndex);
Rectangle lineArea = lineToRect(a, lineIndex);
@ -542,8 +551,8 @@ if (host.isCodeFoldingEnabled()) {
// We use this method instead as it returns the actual bounding box,
// not just the x-coordinate.
lineArea = tokenList.listOffsetToView(
(RSyntaxTextArea)getContainer(), this, pos,
tabBase, lineArea);
(RSyntaxTextArea) getContainer(), this, pos,
tabBase, lineArea);
return lineArea;
@ -554,7 +563,7 @@ if (host.isCodeFoldingEnabled()) {
* Provides a mapping, for a given region, from the document model
* coordinate space to the view coordinate space. The specified region is
* created as a union of the first and last character positions.<p>
*
* <p>
* This is implemented to subtract the width of the second character, as
* this view's <code>modelToView</code> actually returns the width of the
* character instead of "1" or "0" like the View implementations in
@ -565,34 +574,34 @@ if (host.isCodeFoldingEnabled()) {
*
* @param p0 the position of the first character (>=0)
* @param b0 The bias of the first character position, toward the previous
* character or the next character represented by the offset, in
* case the position is a boundary of two views; <code>b0</code>
* will have one of these values:
* <ul>
* <li> <code>Position.Bias.Forward</code>
* <li> <code>Position.Bias.Backward</code>
* </ul>
* character or the next character represented by the offset, in
* case the position is a boundary of two views; <code>b0</code>
* will have one of these values:
* <ul>
* <li> <code>Position.Bias.Forward</code>
* <li> <code>Position.Bias.Backward</code>
* </ul>
* @param p1 the position of the last character (>=0)
* @param b1 the bias for the second character position, defined
* one of the legal values shown above
* @param a the area of the view, which encompasses the requested region
* one of the legal values shown above
* @param a the area of the view, which encompasses the requested region
* @return the bounding box which is a union of the region specified
* by the first and last character positions
* @exception BadLocationException if the given position does
* not represent a valid location in the associated document
* @exception IllegalArgumentException if <code>b0</code> or
* <code>b1</code> are not one of the
* legal <code>Position.Bias</code> values listed above
* by the first and last character positions
* @throws BadLocationException if the given position does
* not represent a valid location in the associated document
* @throws IllegalArgumentException if <code>b0</code> or
* <code>b1</code> are not one of the
* legal <code>Position.Bias</code> values listed above
* @see View#viewToModel
*/
@Override
public Shape modelToView(int p0, Position.Bias b0,
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
Shape s0 = modelToView(p0, a, b0);
Shape s1;
if (p1 ==getEndOffset()) {
if (p1 == getEndOffset()) {
try {
s1 = modelToView(p1, a, b1);
} catch (BadLocationException ble) {
@ -600,21 +609,20 @@ if (host.isCodeFoldingEnabled()) {
}
if (s1 == null) {
// Assume extends left to right.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a :
a.getBounds();
s1 = new Rectangle(alloc.x + alloc.width - 1, alloc.y,
1, alloc.height);
1, alloc.height);
}
}
else {
} else {
s1 = modelToView(p1, a, b1);
}
Rectangle r0 = s0 instanceof Rectangle ? (Rectangle)s0 : s0.getBounds();
Rectangle r1 = s1 instanceof Rectangle ? (Rectangle)s1 : s1.getBounds();
Rectangle r0 = s0 instanceof Rectangle ? (Rectangle) s0 : s0.getBounds();
Rectangle r1 = s1 instanceof Rectangle ? (Rectangle) s1 : s1.getBounds();
if (r0.y != r1.y) {
// If it spans lines, force it to be the width of the view.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a :
a.getBounds();
r0.x = alloc.x;
r0.width = alloc.width;
}
@ -627,7 +635,7 @@ if (host.isCodeFoldingEnabled()) {
// this, one character too many is highlighted thanks to our
// modelToView() implementation returning the actual width of the
// character requested!
if (p1>p0) r0.width -= r1.width;
if (p1 > p0) r0.width -= r1.width;
return r0;
@ -639,15 +647,15 @@ if (host.isCodeFoldingEnabled()) {
* This implementation does not support things like centering so it
* ignores the tabOffset argument.
*
* @param x the current position >= 0
* @param x the current position >= 0
* @param tabOffset the position within the text stream
* that the tab occurred at >= 0.
* that the tab occurred at >= 0.
* @return the tab stop, measured in points >= 0
*/
public float nextTabStop(float x, int tabOffset) {
if (tabSize == 0)
return x;
int ntabs = (((int)x) - tabBase) / tabSize;
int ntabs = (((int) x) - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize);
}
@ -662,12 +670,12 @@ if (host.isCodeFoldingEnabled()) {
@Override
public void paint(Graphics g, Shape a) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Rectangle alloc = a.getBounds();
tabBase = alloc.x;
host = (RSyntaxTextArea)getContainer();
host = (RSyntaxTextArea) getContainer();
Rectangle clip = g.getClipBounds();
// An attempt to speed things up for files with long lines. Note that
@ -695,52 +703,51 @@ if (host.isCodeFoldingEnabled()) {
boolean useSelectedTextColor = host.getUseSelectedTextColor();
RSyntaxTextAreaHighlighter h =
(RSyntaxTextAreaHighlighter)host.getHighlighter();
(RSyntaxTextAreaHighlighter) host.getHighlighter();
Graphics2D g2d = (Graphics2D)g;
Graphics2D g2d = (Graphics2D) g;
Token token;
//System.err.println("Painting lines: " + linesAbove + " to " + (endLine-1));
TokenPainter painter = host.getTokenPainter();
int line = linesAbove;
//int count = 0;
while (y<clip.y+clip.height+ascent && line<lineCount) {
while (y < clip.y + clip.height + ascent && line < lineCount) {
Fold fold = fm.getFoldForLine(line);
Element lineElement = map.getElement(line);
int startOffset = lineElement.getStartOffset();
//int endOffset = (line==lineCount ? lineElement.getEndOffset()-1 :
// lineElement.getEndOffset()-1);
int endOffset = lineElement.getEndOffset()-1; // Why always "-1"?
int endOffset = lineElement.getEndOffset() - 1; // Why always "-1"?
h.paintLayeredHighlights(g2d, startOffset, endOffset,
a, host, this);
a, host, this);
// Paint a line of text.
token = document.getTokenListForLine(line);
if (!useSelectedTextColor || selStart==selEnd ||
(startOffset>=selEnd || endOffset<selStart)) {
drawLine(painter, token, g2d, x,y);
}
else {
if (!useSelectedTextColor || selStart == selEnd ||
(startOffset >= selEnd || endOffset < selStart)) {
drawLine(painter, token, g2d, x, y);
} else {
//System.out.println("Drawing line with selection: " + line);
drawLineWithSelection(painter,token,g2d, x,y, selStart, selEnd);
drawLineWithSelection(painter, token, g2d, x, y, selStart, selEnd);
}
if (fold!=null && fold.isCollapsed()) {
if (fold != null && fold.isCollapsed()) {
// Visible indicator of collapsed lines
Color c = RSyntaxUtilities.getFoldedLineBottomColor(host);
if (c!=null) {
if (c != null) {
g.setColor(c);
g.drawLine(x,y+lineHeight-ascent-1,
alloc.width,y+lineHeight-ascent-1);
g.drawLine(x, y + lineHeight - ascent - 1,
alloc.width, y + lineHeight - ascent - 1);
}
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
do {
int hiddenLineCount = fold.getLineCount();
if (hiddenLineCount==0) {
if (hiddenLineCount == 0) {
// Fold parser identified a zero-line fold region.
// This is really a bug, but we'll be graceful here
// and avoid an infinite loop.
@ -748,7 +755,7 @@ if (host.isCodeFoldingEnabled()) {
}
line += hiddenLineCount;
fold = fm.getFoldForLine(line);
} while (fold!=null && fold.isCollapsed());
} while (fold != null && fold.isCollapsed());
}
@ -767,7 +774,7 @@ if (host.isCodeFoldingEnabled()) {
* If the passed-in line is longer than the current longest line, then
* the longest line is updated.
*
* @param line The line to test against the current longest.
* @param line The line to test against the current longest.
* @param lineNumber The line number of the passed-in line.
* @return <code>true</code> iff the current longest line was updated.
*/
@ -787,8 +794,8 @@ if (host.isCodeFoldingEnabled()) {
* in a location that this view is responsible for.
*
* @param changes the change information from the associated document
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
* @param a the current allocation of the view
* @param f the factory to use to rebuild if the view has children
*/
@Override
public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory f) {
@ -819,12 +826,12 @@ if (host.isCodeFoldingEnabled()) {
Element[] added = (ec != null) ? ec.getChildrenAdded() : null;
Element[] removed = (ec != null) ? ec.getChildrenRemoved() : null;
if (((added != null) && (added.length > 0)) ||
((removed != null) && (removed.length > 0))) {
((removed != null) && (removed.length > 0))) {
// lines were added or removed...
if (added != null) {
int addedAt = ec.getIndex(); // FIXME: Is this correct?????
for (int i = 0; i < added.length; i++)
possiblyUpdateLongLine(added[i], addedAt+i);
possiblyUpdateLongLine(added[i], addedAt + i);
}
if (removed != null) {
for (int i = 0; i < removed.length; i++) {
@ -841,14 +848,12 @@ if (host.isCodeFoldingEnabled()) {
// This occurs when syntax highlighting only changes on lines
// (i.e. beginning a multiline comment).
else if (changes.getType()==DocumentEvent.EventType.CHANGE) {
else if (changes.getType() == DocumentEvent.EventType.CHANGE) {
//System.err.println("Updating the damage due to a CHANGE event...");
int startLine = changes.getOffset();
int endLine = changes.getLength();
damageLineRange(startLine,endLine, a, host);
}
else {
damageLineRange(startLine, endLine, a, host);
} else {
Element map = getElement();
int line = map.getElementIndex(changes.getOffset());
damageLineRange(line, line, a, host);
@ -861,14 +866,12 @@ if (host.isCodeFoldingEnabled()) {
// because it has gotten longer.
longLineWidth = getLineWidth(line);
preferenceChanged(null, true, false);
}
else {
} else {
// If long line gets updated, update the status bars too.
if (possiblyUpdateLongLine(e, line))
preferenceChanged(null, true, false);
}
}
else if (changes.getType() == DocumentEvent.EventType.REMOVE) {
} else if (changes.getType() == DocumentEvent.EventType.REMOVE) {
if (map.getElement(line) == longLine) {
// removed from longest line... recalc
longLineWidth = -1; // Must do this!
@ -884,7 +887,7 @@ if (host.isCodeFoldingEnabled()) {
* Checks to see if the font metrics and longest line are up-to-date.
*/
private void updateMetrics() {
host = (RSyntaxTextArea)getContainer();
host = (RSyntaxTextArea) getContainer();
Font f = host.getFont();
if (font != f) {
// The font changed, we need to recalculate the longest line!
@ -900,9 +903,9 @@ if (host.isCodeFoldingEnabled()) {
*
* @param fx the X coordinate >= 0
* @param fy the Y coordinate >= 0
* @param a the allocated region to render into
* @param a the allocated region to render into
* @return the location within the model that best represents the
* given point in the view >= 0
* given point in the view >= 0
*/
@Override
public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) {
@ -910,7 +913,7 @@ if (host.isCodeFoldingEnabled()) {
bias[0] = Position.Bias.Forward;
Rectangle alloc = a.getBounds();
RSyntaxDocument doc = (RSyntaxDocument)getDocument();
RSyntaxDocument doc = (RSyntaxDocument) getDocument();
int x = (int) fx;
int y = (int) fy;
@ -936,9 +939,9 @@ if (host.isCodeFoldingEnabled()) {
Element map = doc.getDefaultRootElement();
int lineIndex = Math.abs((y - alloc.y) / lineHeight);//metrics.getHeight() );
FoldManager fm = host.getFoldManager();
FoldManager fm = host.getFoldManager();
//System.out.print("--- " + lineIndex);
lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
//System.out.println(" => " + lineIndex);
if (lineIndex >= map.getElementCount()) {
return host.getLastVisibleOffset();
@ -950,7 +953,7 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
if (x < alloc.x)
return line.getStartOffset();
// If the point is to the right of the line...
// If the point is to the right of the line...
else if (x > alloc.x + alloc.width)
return line.getEndOffset() - 1;
@ -960,9 +963,9 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
Token tokenList = doc.getTokenListForLine(lineIndex);
tabBase = alloc.x;
int offs = tokenList.getListOffset(
(RSyntaxTextArea)getContainer(),
this, tabBase, x);
return offs!=-1 ? offs : p0;
(RSyntaxTextArea) getContainer(),
this, tabBase, x);
return offs != -1 ? offs : p0;
}
} // End of else.
@ -981,11 +984,13 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
// NOTE: lineHeight is not initially set here, leading to the
// current line not being highlighted when a document is first
// opened. So, we set it here just in case.
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
FoldManager fm = host.getFoldManager();
if (!fm.isLineHidden(line)) {
line -= fm.getHiddenLineCountAbove(line);
return alloc.y + line*lineHeight;
lineHeight = host != null ? host.getLineHeight() : lineHeight;
if (host != null) {
FoldManager fm = host.getFoldManager();
if (!fm.isLineHidden(line)) {
line -= fm.getHiddenLineCountAbove(line);
return alloc.y + line * lineHeight;
}
}
}
@ -998,7 +1003,7 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
* {@inheritDoc}
*/
public int yForLineContaining(Rectangle alloc, int offs)
throws BadLocationException {
throws BadLocationException {
Element map = getElement();
int line = map.getElementIndex(offs);
return yForLine(alloc, line);

100
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java

@ -9,15 +9,33 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.*;
import javax.swing.text.*;
import javax.swing.text.Position.Bias;
import javax.swing.event.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenUtils.TokenSubList;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
import com.fr.stable.CommonUtils;
import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.BoxView;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.LayeredHighlighter;
import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.Position.Bias;
import javax.swing.text.Segment;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
/**
@ -27,7 +45,7 @@ import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
* @version 0.2
*/
public class WrappedSyntaxView extends BoxView implements TabExpander,
RSTAView {
RSTAView {
boolean widthChanging;
int tabBase;
@ -93,7 +111,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
int p = p0;
RSyntaxTextArea textArea = (RSyntaxTextArea)getContainer();
float currentWidth = getWidth();
if (currentWidth==Integer.MAX_VALUE)
if (CommonUtils.equals(currentWidth, Integer.MAX_VALUE))
currentWidth = getPreferredSpan(X_AXIS);
// Make sure width>0; this is a huge hack to fix a bug where
// loading text into an RTextArea before it is visible if word wrap
@ -128,7 +146,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
//System.err.println("------ ending calculateBreakPosition() --------");
// return p;
return p + 1;
return p + 1;
}
//private int getBreakLocation(Token t, FontMetrics fm, int x0, int x,
@ -271,8 +289,8 @@ return p + 1;
* @param selEnd The end of the selection.
*/
protected void drawViewWithSelection(TokenPainter painter, Graphics2D g,
Rectangle r, View view, int fontHeight, int y, int selStart,
int selEnd) {
Rectangle r, View view, int fontHeight, int y, int selStart,
int selEnd) {
float x = r.x;
@ -371,7 +389,7 @@ return p + 1;
int tokenOffset = token.getOffset();
Token orig = token;
token = new TokenImpl(drawSeg, tokenOffset-start, p-1-start,
tokenOffset, token.getType());
tokenOffset, token.getType());
// Selection starts in this token
if (token.containsPosition(selStart)) {
@ -605,7 +623,7 @@ return p + 1;
*/
protected int getTabSize() {
Integer i = (Integer) getDocument().
getProperty(PlainDocument.tabSizeAttribute);
getProperty(PlainDocument.tabSizeAttribute);
int size = (i != null) ? i.intValue() : 5;
return size;
}
@ -656,7 +674,7 @@ return p + 1;
public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f) {
updateChildren(changes, a);
Rectangle alloc = ((a != null) && isAllocationValid()) ?
getInsideAllocation(a) : null;
getInsideAllocation(a) : null;
int pos = changes.getOffset();
View v = getViewAtPosition(pos, alloc);
if (v != null)
@ -765,8 +783,8 @@ return p + 1;
*/
@Override
public Shape modelToView(int p0, Position.Bias b0,
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
int p1, Position.Bias b1,
Shape a) throws BadLocationException {
Shape s0 = modelToView(p0, a, b0);
Shape s1;
@ -779,9 +797,9 @@ return p + 1;
if (s1 == null) {
// Assume extends left to right.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
a.getBounds();
s1 = new Rectangle(alloc.x + alloc.width - 1, alloc.y,
1, alloc.height);
1, alloc.height);
}
}
else {
@ -789,11 +807,11 @@ return p + 1;
}
Rectangle r0 = s0.getBounds();
Rectangle r1 = (s1 instanceof Rectangle) ? (Rectangle) s1 :
s1.getBounds();
s1.getBounds();
if (r0.y != r1.y) {
// If it spans lines, force it to be the width of the view.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
a.getBounds();
r0.x = alloc.x;
r0.width = alloc.width;
}
@ -840,7 +858,7 @@ return p + 1;
public void paint(Graphics g, Shape a) {
Rectangle alloc = (a instanceof Rectangle) ?
(Rectangle)a : a.getBounds();
(Rectangle)a : a.getBounds();
tabBase = alloc.x;
Graphics2D g2d = (Graphics2D)g;
@ -919,11 +937,11 @@ return p + 1;
updateChildren(changes, a);
Rectangle alloc = ((a != null) && isAllocationValid()) ?
getInsideAllocation(a) : null;
getInsideAllocation(a) : null;
int pos = changes.getOffset();
View v = getViewAtPosition(pos, alloc);
if (v != null)
v.removeUpdate(changes, alloc, f);
v.removeUpdate(changes, alloc, f);
}
@ -1044,8 +1062,8 @@ return p + 1;
// Code folding may have hidden the last line. If so, return the last
// visible offset instead of the last offset.
if (host.isCodeFoldingEnabled() && v==getView(getViewCount()-1) &&
offs==v.getEndOffset()-1) {
if (v != null && host.isCodeFoldingEnabled() && v == getView(getViewCount() - 1) &&
offs == v.getEndOffset() - 1) {
offs = host.getLastVisibleOffset();
}
@ -1068,7 +1086,7 @@ return p + 1;
* {@inheritDoc}
*/
public int yForLineContaining(Rectangle alloc, int offs)
throws BadLocationException {
throws BadLocationException {
if (isAllocationValid()) {
// TODO: make cached Y_AXIS offsets valid even with folding enabled
// to speed this back up!
@ -1136,10 +1154,10 @@ return p + 1;
//System.err.println("... ... ... break position p==" + p);
p0 = (p == p0) ? ++p : p; // this is the fix of #4410243
// we check on situation when
// width is too small and
// break position is calculated
// incorrectly.
// we check on situation when
// width is too small and
// break position is calculated
// incorrectly.
//System.err.println("... ... ... new p0==" + p0);
}
/*
@ -1170,7 +1188,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
switch (axis) {
case View.X_AXIS:
float width = getWidth();
if (width == Integer.MAX_VALUE) {
if (CommonUtils.equals(width, Integer.MAX_VALUE)) {
// We have been initially set to MAX_VALUE, but we don't
// want this as our preferred.
return 100f;
@ -1212,7 +1230,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
*/
@Override
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException {
throws BadLocationException {
//System.err.println("--- begin modelToView ---");
Rectangle alloc = a.getBounds();
@ -1222,7 +1240,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
int p0 = getStartOffset();
int p1 = getEndOffset();
int testP = (b == Position.Bias.Forward) ? pos :
Math.max(p0, pos - 1);
Math.max(p0, pos - 1);
// Get the token list for this line so we don't have to keep
// recomputing it if this logical line spans multiple physical
@ -1242,9 +1260,9 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
if ((pos >= p0) && (testP<p)) {//pos < p)) {
// it's in this line
alloc = RSyntaxUtilities.getLineWidthUpTo(
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
//System.err.println("--- end modelToView ---");
return alloc;
}
@ -1253,9 +1271,9 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
// Wants end.
if (pos > p0) {
alloc = RSyntaxUtilities.getLineWidthUpTo(
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
textArea, s, p0, pos,
WrappedSyntaxView.this,
alloc, alloc.x);
}
//System.err.println("--- end modelToView ---");
return alloc;
@ -1352,8 +1370,8 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
// Start at alloc.x since this chunk starts
// at the beginning of a physical line.
int n = tlist.getListOffset(textArea,
WrappedSyntaxView.this,
alloc.x, x);
WrappedSyntaxView.this,
alloc.x, x);
// NOTE: We needed to add the max() with
// p0 as getTokenListForLine returns -1
@ -1379,7 +1397,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
}
private void handleDocumentEvent(DocumentEvent e, Shape a,
ViewFactory f) {
ViewFactory f) {
int n = calculateLineCount();
if (this.nlines != n) {
this.nlines = n;

5
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/parser/TaskTagParser.java

@ -18,6 +18,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.ErrorStrip;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxDocument;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.Token;
import com.fr.stable.StringUtils;
/**
@ -60,6 +61,7 @@ public class TaskTagParser extends AbstractParser {
}
@SuppressWarnings("squid:S2259")
public ParseResult parse(RSyntaxDocument doc, String style) {
Element root = doc.getDefaultRootElement();
@ -101,6 +103,9 @@ public class TaskTagParser extends AbstractParser {
}
if (start>-1) {
if (StringUtils.isEmpty(text)) {
continue;
}
text = text.substring(start);
// TODO: Strip off end of MLC's if they're there.
int len = text.length();

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/LineNumberList.java

@ -349,6 +349,10 @@ public class LineNumberList extends AbstractGutterComponent
int width = metrics.stringWidth(number);
g.drawString(number, rhs-width,y);
y += cellHeight;
if (fm == null) {
line++;
continue;
}
Fold fold = fm.getFoldForLine(line-1);
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
@ -371,6 +375,10 @@ public class LineNumberList extends AbstractGutterComponent
String number = Integer.toString(line + getLineNumberingStartIndex() - 1);
g.drawString(number, RHS_BORDER_WIDTH, y);
y += cellHeight;
if (fm == null) {
line++;
continue;
}
Fold fold = fm.getFoldForLine(line-1);
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"

3
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextArea.java

@ -635,6 +635,9 @@ public class RTextArea extends RTextAreaBase implements Printable {
parent = parent.getParent();
}
KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE");
if (inputMap == null) {
return;
}
inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction);
}

2
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java

@ -902,6 +902,8 @@ public class RTextAreaEditorKit extends DefaultEditorKit {
}
} catch (BadLocationException bl) {
}
}else if (textArea == null) {
throw new IllegalArgumentException("RTextArea can not be null!");
}
if (beep)

10
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java

@ -9,6 +9,8 @@
*/
package com.fr.design.gui.syntax.ui.rtextarea;
import com.fr.log.FineLoggerFactory;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.VolatileImage;
@ -95,9 +97,9 @@ public class VolatileImageBackgroundPainterStrategy
try {
tracker.waitForID(1);
} catch (InterruptedException e) {
e.printStackTrace();
FineLoggerFactory.getLogger().error(e.getMessage(),e);
bgImage = null;
return;
Thread.currentThread().interrupt();
} finally {
tracker.removeImage(i, 1);
}
@ -106,9 +108,9 @@ public class VolatileImageBackgroundPainterStrategy
try {
tracker.waitForID(0);
} catch (InterruptedException e) {
e.printStackTrace();
FineLoggerFactory.getLogger().error(e.getMessage(),e);
bgImage = null;
return;
Thread.currentThread().interrupt();
} finally {
tracker.removeImage(bgImage, 0);
}

6
designer-base/src/main/java/com/fr/design/icon/LockIcon.java

@ -34,6 +34,7 @@ public class LockIcon extends ImageIcon {
}
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (mainImage != null) {
g.drawImage(mainImage, x, y, c);
@ -48,6 +49,7 @@ public class LockIcon extends ImageIcon {
*
* @param image the image
*/
@Override
protected void loadImage(Image image) {
synchronized (tracker) {
tracker.addImage(image, 0);
@ -55,6 +57,7 @@ public class LockIcon extends ImageIcon {
tracker.waitForID(0, 0);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
loadStatus = tracker.statusID(0, false);
@ -70,6 +73,7 @@ public class LockIcon extends ImageIcon {
*
* @return the <code>Image</code> object for this <code>ImageIcon</code>
*/
@Override
public Image getImage() {
return mainImage;
}
@ -85,6 +89,7 @@ public class LockIcon extends ImageIcon {
*
* @return the width in pixels of this icon
*/
@Override
public int getIconWidth() {
return width;
}
@ -94,6 +99,7 @@ public class LockIcon extends ImageIcon {
*
* @return the height in pixels of this icon
*/
@Override
public int getIconHeight() {
return height;
}

1
designer-base/src/main/java/com/fr/design/icon/WarningIcon.java

@ -59,6 +59,7 @@ public class WarningIcon extends ImageIcon {
tracker.waitForID(0, 0);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
tracker.statusID(0, false);

12
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -217,6 +217,18 @@ public class FRGUIPaneFactory {
return jp;
}
/**
* 创建一个靠左空边框面板间隔小firsthgap 为0
*
* @return JPanel对象
*/
public static JPanel createTinyHGapFlowInnerContainer_M_Pane_First0() {
JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FRLeftFlowLayout(0, 5, 0));
return jp;
}
/**
* 创建一个靠左空边框面板间隔中等
*

51
designer-base/src/main/java/com/fr/design/layout/TableLayout.java

@ -1,6 +1,9 @@
package com.fr.design.layout;
import com.fr.general.GeneralUtils;
import com.fr.stable.CommonUtils;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Container;
@ -12,8 +15,6 @@ import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.ListIterator;
import com.fr.general.GeneralUtils;
/**
* <p>TableLayout is a layout manager that is more powerful than GridBagLayout
@ -853,9 +854,9 @@ public class TableLayout implements LayoutManager2, Serializable {
// Make sure row size is valid
if ((size < 0.0) &&
(size != FILL) &&
(size != PREFERRED) &&
(size != MINIMUM)) {
(!CommonUtils.equals(size, FILL)) &&
(!CommonUtils.equals(size, PREFERRED)) &&
(!CommonUtils.equals(size, MINIMUM))) {
size = 0.0;
}
@ -1177,7 +1178,7 @@ public class TableLayout implements LayoutManager2, Serializable {
int numCr = crSpec[z].length;
for (int counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] >= 1.0) || (crSpec[z][counter] == 0.0)) {
if ((crSpec[z][counter] >= 1.0) || CommonUtils.equals(crSpec[z][counter], 0.0)) {
crSize[z][counter] = (int) (crSpec[z][counter] + 0.5);
availableSize -= crSize[z][counter];
}
@ -1218,7 +1219,7 @@ public class TableLayout implements LayoutManager2, Serializable {
* @param z indicates row or column
* @param availableSize amount of space available in the container
*/
@SuppressWarnings("squid:S3518")
protected void assignFillSize(int z, int availableSize) {
// Skip if there is no more space to allocate
if (availableSize <= 0)
@ -1229,7 +1230,7 @@ public class TableLayout implements LayoutManager2, Serializable {
int numCr = crSpec[z].length;
for (int counter = 0; counter < numCr; counter++)
if (crSpec[z][counter] == FILL)
if (CommonUtils.equals(crSpec[z][counter], FILL))
numFillSize++;
// If numFillSize is zero, the if statement below will always evaluate to
@ -1241,7 +1242,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// Assign "fill" cells equal amounts of the remaining space
for (int counter = 0; counter < numCr; counter++)
if (crSpec[z][counter] == FILL) {
if (CommonUtils.equals(crSpec[z][counter], FILL)) {
crSize[z][counter] = availableSize / numFillSize;
slackSize -= crSize[z][counter];
}
@ -1249,7 +1250,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// Assign one pixel of slack to each FILL cr, starting at the last one,
// until all slack has been consumed
for (int counter = numCr - 1; (counter >= 0) && (slackSize > 0); counter--) {
if (crSpec[z][counter] == FILL) {
if (CommonUtils.equals(crSpec[z][counter], FILL)) {
crSize[z][counter]++;
slackSize--;
}
@ -1290,7 +1291,7 @@ public class TableLayout implements LayoutManager2, Serializable {
* @return the amount of space available after absolute crs have been assigned
* sizes
*/
@SuppressWarnings("squid:S3518")
protected int assignPrefMinSize
(int z, int availableSize, double typeOfSize) {
// Get variables referring to columns or rows (crs)
@ -1299,7 +1300,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// Address every cr
for (int counter = 0; counter < numCr; counter++)
// Is the current cr a preferred/minimum (based on typeOfSize) size
if (crSpec[z][counter] == typeOfSize) {
if (CommonUtils.equals(crSpec[z][counter], typeOfSize)) {
// Assume a maximum width of zero
int maxSize = 0;
@ -1319,7 +1320,7 @@ public class TableLayout implements LayoutManager2, Serializable {
// the current component occupies
if ((entry.cr1[z] <= counter) && (entry.cr2[z] >= counter)) {
// Setup size and number of adjustable crs
Dimension p = (typeOfSize == PREFERRED) ?
Dimension p = CommonUtils.equals(typeOfSize, PREFERRED) ?
entry.component.getPreferredSize() :
entry.component.getMinimumSize();
@ -1328,23 +1329,23 @@ public class TableLayout implements LayoutManager2, Serializable {
int numAdjustable = 0;
// Calculate for preferred size
if (typeOfSize == PREFERRED)
if (CommonUtils.equals(typeOfSize, PREFERRED))
// Consider all crs this component occupies
for (int entryCr = entry.cr1[z];
entryCr <= entry.cr2[z]; entryCr++) {
// Subtract absolute, relative, and minumum cr
// sizes, which have already been calculated
if ((crSpec[z][entryCr] >= 0.0) ||
(crSpec[z][entryCr] == MINIMUM)) {
CommonUtils.equals(crSpec[z][entryCr], MINIMUM)) {
size -= crSize[z][entryCr];
}
// Count preferred/min width columns
else if (crSpec[z][entryCr] == PREFERRED)
else if (CommonUtils.equals(crSpec[z][entryCr], PREFERRED))
numAdjustable++;
// Skip any component that occupies a fill cr
// because the fill should fulfill the size
// requirements
else if (crSpec[z][entryCr] == FILL)
// Skip any component that occupies a fill cr
// because the fill should fulfill the size
// requirements
else if (CommonUtils.equals(crSpec[z][entryCr], FILL))
continue nextComponent;
}
// Calculate for minimum size
@ -1357,14 +1358,14 @@ public class TableLayout implements LayoutManager2, Serializable {
if (crSpec[z][entryCr] >= 0.0)
size -= crSize[z][entryCr];
// Count preferred/min width columns
else if ((crSpec[z][entryCr] == PREFERRED) ||
(crSpec[z][entryCr] == MINIMUM)) {
else if (CommonUtils.equals(crSpec[z][entryCr], PREFERRED) ||
CommonUtils.equals(crSpec[z][entryCr], MINIMUM)) {
numAdjustable++;
}
// Skip any component that occupies a fill cr
// because the fill should fulfill the size
// requirements
else if (crSpec[z][entryCr] == FILL)
else if (CommonUtils.equals(crSpec[z][entryCr], FILL))
continue nextComponent;
}
@ -1692,7 +1693,7 @@ public class TableLayout implements LayoutManager2, Serializable {
Dimension prefMinSize[] = new Dimension[numEntry];
for (int i = 0; i < numEntry; i++)
prefMinSize[i] = (typeOfSize == PREFERRED) ?
prefMinSize[i] = CommonUtils.equals(typeOfSize, PREFERRED) ?
entryList[i].component.getPreferredSize() :
entryList[i].component.getMinimumSize();
@ -1727,7 +1728,7 @@ public class TableLayout implements LayoutManager2, Serializable {
*
* @return a dimension indicating the container's preferred or minimum size
*/
@SuppressWarnings("squid:S3518")
protected int calculateLayoutSize
(Container container, int z, double typeOfSize, Entry entryList[],
Dimension prefMinSize[]) {

1
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -1091,6 +1091,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
thread.join();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("Map Thread Error");
Thread.currentThread().interrupt();
}
DesignerEnvManager.getEnvManager().setLastOpenFile(

23
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.background.ColorBackground;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -23,6 +24,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private MobileStyleCustomDefinePane customBeanPane;
private Class<? extends MobileStyle> mobileStyleClazz;
private NewColorSelectBox colorSelectBox;
private Color titleColor = new Color(47, 142, 241);
MobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass,
Class<? extends MobileStyle> mobileStyleClazz) {
@ -35,7 +37,9 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
@Override
public void populateBean(MobileStyle ob) {
this.customBeanPane.populateBean(ob);
colorSelectBox.setSelectObject(ob.getBackground());
if(ob.getBackground() != null) {
colorSelectBox.setSelectObject(((ColorBackground)ob.getBackground()).getColor());
}
}
@Override
@ -43,7 +47,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
MobileStyle mobileStyle = Reflect.on(mobileStyleClazz).create().get();
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();
mobileStyle.setBackground(colorSelectBox.getSelectObject());
mobileStyle.setBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject()));
return mobileStyle;
}
@ -67,8 +71,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
JPanel mobileStylePreviewPane = this.customBeanPane.createPreviewPane();
if(mobileStylePreviewPane != null) {
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12, new Color(0x2f8ef100)));
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Basic_Widget_Style_Preview"));
previewPane.setBorder(titledBorder);
previewPane.setPreferredSize(new Dimension(500, 83));
previewPane.add(mobileStylePreviewPane, BorderLayout.CENTER);
@ -82,8 +85,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
backgroundPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));
backgroundPane.setPreferredSize(new Dimension(500, 65));
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_Common_Attribute"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12, Color.BLUE));
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_Common_Attribute"));
backgroundPane.setBorder(titledBorder);
UILabel colorSelectLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Widget_Background"), UILabel.RIGHT);
@ -104,12 +106,17 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private void createCustomPane() {
JPanel configPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12, Color.BLUE));
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Set"));
configPane.setBorder(titledBorder);
configPane.add(this.customBeanPane, BorderLayout.CENTER);
this.add(configPane, BorderLayout.CENTER);
}
private TitledBorder createTitledBorder(String title) {
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(title, titleColor);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12));
return titledBorder;
}
}

22
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java

@ -11,6 +11,8 @@ import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -33,6 +35,7 @@ import java.util.ArrayList;
public class TabIconConfigPane extends JPanel {
private UIButton editIconButton;
private UIButton deleteIconButton;
private String curIconName;
private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
@ -43,7 +46,7 @@ public class TabIconConfigPane extends JPanel {
public void initComp(int count) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
JPanel panel = FRGUIPaneFactory.createTinyHGapFlowInnerContainer_M_Pane_First0();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
@ -63,12 +66,28 @@ public class TabIconConfigPane extends JPanel {
curIconName = cip.update();
setShowIconImage();
TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(true);
}
});
editDialog.setVisible(true);
}
});
editIconButton.setEnabled(false);
deleteIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Delete"));
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
deleteIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(deleteIconButton);
deleteIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
curIconName = "";
setShowIconImage();
TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(false);
}
});
deleteIconButton.setEnabled(false);
this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel();
@ -163,6 +182,7 @@ public class TabIconConfigPane extends JPanel {
public void actionPerformed(ActionEvent evt) {
selectIconButton = this;
editIconButton.setEnabled(true);
deleteIconButton.setEnabled(StringUtils.isNotEmpty(this.getIconName()));
TabIconConfigPane.this.repaint();// repaint
}

7
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java

@ -19,12 +19,11 @@ public class VcsLabel extends ActionLabel {
}
public void paintComponent(Graphics g) {
if (ui != null) {
Graphics scratchGraphics = (g == null) ? null : g.create();
if (ui != null && g != null) {
Graphics scratchGraphics = g.create();
try {
ui.update(scratchGraphics, this);
}
finally {
} finally {
scratchGraphics.dispose();
}
}

70
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -6,6 +6,8 @@ import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -14,14 +16,18 @@ import com.fr.design.style.color.NewColorSelectPane;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.SwingConstants;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -37,9 +43,15 @@ public class WatermarkPane extends BasicPane {
private TinyFormulaPane formulaPane;
// 字号
private UIComboBox fontSizeComboBox;
//横向间距
private UISpinner horizontalGapSpinner;
//横向间距
private UISpinner verticalGapSpinner;
// 文字颜色
private NewColorSelectPane colorPane;
private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20);
public WatermarkPane() {
initComponents();
}
@ -73,6 +85,7 @@ public class WatermarkPane extends BasicPane {
}
populateFourmula(watermark.getText());
populateFontSize(watermark.getFontSize());
populateWatermarkGap(watermark);
populateColor(watermark.getColor());
paintPreviewPane();
}
@ -81,6 +94,8 @@ public class WatermarkPane extends BasicPane {
WatermarkAttr watermark = new WatermarkAttr();
watermark.setText(formulaPane.getUITextField().getText());
watermark.setFontSize((int)fontSizeComboBox.getSelectedItem());
watermark.setHorizontalGap((int) horizontalGapSpinner.getValue());
watermark.setVerticalGap((int) verticalGapSpinner.getValue());
watermark.setColor(colorPane.getColor());
colorPane.updateUsedColor();
return watermark;
@ -98,20 +113,39 @@ public class WatermarkPane extends BasicPane {
formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox.setEditable(true);
horizontalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 200);
verticalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER);
//水印间距面板
JPanel watermarkGapPane = new JPanel(new BorderLayout(10, 0));
JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0);
jp.add(horizontalGapSpinner);
jp.add(verticalGapSpinner);
watermarkGapPane.add(jp, BorderLayout.CENTER);
JPanel watermarkGapTipsPane = new JPanel(new BorderLayout());
JPanel tipsJp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0);
tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), SwingConstants.CENTER));
tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), SwingConstants.CENTER));
watermarkGapTipsPane.add(tipsJp, BorderLayout.CENTER);
colorPane = new NewColorSelectPane();
JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH);
double p = TableLayout.PREFERRED;
double[] rowSize = {p,p,p};
double[] columnSize = { p, MAX_WIDTH};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, MAX_WIDTH};
JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{
JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")),watermarkGapPane },
{null,watermarkGapTipsPane },
{colorLabelPane, colorPane},
}, rowSize, columnSize, 10);
rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12));
@ -131,6 +165,36 @@ public class WatermarkPane extends BasicPane {
});
}
protected void populateWatermarkGap(WatermarkAttr watermark){
this.horizontalGapSpinner.setValue(watermark.getHorizontalGap());
this.horizontalGapSpinner.addUISpinnerFocusListenner(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
paintPreviewPane();
}
@Override
public void focusLost(FocusEvent e) {
paintPreviewPane();
}
});
this.verticalGapSpinner.setValue(watermark.getVerticalGap());
this.verticalGapSpinner.addUISpinnerFocusListenner(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
paintPreviewPane();
}
@Override
public void focusLost(FocusEvent e) {
paintPreviewPane();
}
});
}
protected void paintPreviewPane(){
watermarkPreviewPane.repaint(update());
}

1
designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java

@ -74,6 +74,7 @@ public class ColorPicker extends JDialog implements ActionListener
Thread.sleep(100); // 等待弹窗关闭
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
colorPickerPanel.captureScreen();
}

1
designer-base/src/main/java/com/fr/design/update/actions/FileDownloader.java

@ -65,6 +65,7 @@ public abstract class FileDownloader extends SwingWorker<Boolean, DownloadItem>
success = get();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

1
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -385,6 +385,7 @@ public class UpdateMainDialog extends UIDialog {
showDownLoadInfo();
} catch (InterruptedException e) {
stopLoading();
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
stopLoading();
} finally {

1
designer-base/src/main/java/com/fr/design/utils/DrawRoutines.java

@ -206,6 +206,7 @@ public class DrawRoutines {
grabber.grabPixels();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("PixelGrabber interrupted waiting for pixels");
Thread.currentThread().interrupt();
}
if ((grabber.getStatus() & ImageObserver.ABORT) != 0) {

10
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -433,7 +433,7 @@ public class CustomIconPane extends BasicPane {
JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20, 20));
showImageLabel.setPreferredSize(new Dimension(50, 50));
imagePane.add(showImageLabel);
imagePane.add(browseButton);
Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}};
@ -450,12 +450,12 @@ public class CustomIconPane extends BasicPane {
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath();
// 将图片转化到16 × 16大小
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH,
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH),
Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null);
g2d.drawImage(image, 0, 0, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), null);
bufferedImage.flush();
g2d.dispose();
iconImage = bufferedImage;

1
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -548,6 +548,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
Thread.currentThread().interrupt();
}
dialogDownPane.remove(cancelButton);
dialogDownPane.revalidate();

1
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -81,6 +81,7 @@ public class FineEmbedServerMonitor {
try {
Thread.sleep(STEP_HEARTBEAT);
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
DesignerContext.getDesignerFrame().hideProgressDialog();

116
designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java

@ -0,0 +1,116 @@
package com.fr.design.chart;
import com.fr.base.GraphHelper;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.image.BufferedImage;
/**
* 图表的缩略图Icon, 在选择图表类型界面 用到.
*/
public class ChartIcon implements Icon, XMLable {
private static final int WIDTH = 400;
private static final int HEIGHT = 225;
/**
* 缩略图中的图片路径
*/
private String imagePath;
private String chartName;
/**
* 构造Chart的缩略图Icon
*/
public ChartIcon(String imagePath, String chartName) {
this.imagePath = imagePath;
this.chartName = chartName;
}
/**
* 画出缩略图Icon
*
* @param g 图形的上下文
* @param c 所在的Component
* @param x 缩略图的起始坐标x
* @param y 缩略图的起始坐标y
*/
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint();
g.translate(x, y);
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, getIconWidth(), getIconHeight());
BufferedImage demoImage = IOUtils.readImageWithCache(imagePath);
GraphHelper.paintImage(g, getIconWidth(), getIconHeight(), demoImage, Constants.IMAGE_ADJUST, Constants.NULL, Constants.NULL, -1, -1);
g.translate(-x, -y);
g2d.setPaint(oldPaint);
}
/**
* 返回缩略图的宽度
*
* @return int 缩略图宽度
*/
public int getIconWidth() {
return WIDTH;
}
/**
* 返回缩略图的高度
*
* @return int 缩略图高度
*/
public int getIconHeight() {
return HEIGHT;
}
/**
* 返回缩略图中的图片路径
*
* @return 缩略图中的图片路径
*/
public String getImagePath() {
return imagePath;
}
public String getChartName() {
return chartName;
}
public void readXML(XMLableReader reader) {
}
public void writeXML(XMLPrintWriter writer) {
}
/**
* @return 克隆后的对象
* @throws CloneNotSupportedException 如果克隆失败则抛出此异常
*/
public Object clone() throws CloneNotSupportedException {
ChartIcon cloned = (ChartIcon) super.clone();
cloned.imagePath = this.imagePath;
cloned.chartName = this.chartName;
return cloned;
}
}

13
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -1,12 +1,10 @@
package com.fr.design.chart;
/**
* the Pane of the Chart
*
*/
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.ChartIcon;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.gui.ilable.UILabel;
@ -120,15 +118,16 @@ public class ChartTypePane extends ChartCommonWizardPane {
ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
ChartTypePane.this.iconListModel.clear();
for (int i = 0; i < sub_charts.length; i++) {
ChartTypePane.this.iconListModel.addElement(new ChartIcon(sub_charts[i]));
String ImagePath = sub_charts[i].demoImagePath();
String chartName = sub_charts[i].getChartName();
ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName));
}
iconViewList.setSelectedIndex(0);
}
};
public String getChartName(ChartIcon chartIcon) {
ChartProvider chart = chartIcon.getChart();
return ChartTypeManager.getInstanceWithCheck().getChartName(chart.getID());
return chartIcon.getChartName();
}
public void populate(ChartProvider chart) {
@ -146,10 +145,10 @@ public class ChartTypePane extends ChartCommonWizardPane {
if (chart4Update == null) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID();
ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
try{
try {
chart4Update = (ChartProvider) chart.clone();
cc.addChart(chart4Update);
}catch (CloneNotSupportedException ex){
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
}

97
designer-chart/src/main/java/com/fr/design/chart/gui/ActiveGlyphFactory.java

@ -1,97 +0,0 @@
package com.fr.design.chart.gui;
import java.util.HashMap;
import java.util.Map;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.CategoryAxisGlyph;
import com.fr.chart.chartglyph.ChartAlertValueGlyph;
import com.fr.chart.chartglyph.ChartGlyph;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.chart.chartglyph.DataSheetGlyph;
import com.fr.chart.chartglyph.DateAxisGlyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.RadarAxisGlyph;
import com.fr.chart.chartglyph.RangeAxisGlyph;
import com.fr.chart.chartglyph.TextGlyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.chart.chartglyph.TrendLineGlyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.AlertValueActiveGlyph;
import com.fr.design.chart.gui.active.CategoryAxisActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.chart.gui.active.DataLabelActiveGlyph;
import com.fr.design.chart.gui.active.DataSeriesActiveGlyph;
import com.fr.design.chart.gui.active.DataSheetActiveGlyph;
import com.fr.design.chart.gui.active.DateAxisActiveGlyph;
import com.fr.design.chart.gui.active.LegendActiveGlyph;
import com.fr.design.chart.gui.active.PlotActiveGlyph;
import com.fr.design.chart.gui.active.RadarAxisActiveGlyph;
import com.fr.design.chart.gui.active.RangeAxisActiveGlyph;
import com.fr.design.chart.gui.active.TextActiveGlyph;
import com.fr.design.chart.gui.active.TrendLineActiveGlyph;
import com.fr.design.chart.gui.active.ValueAxisActiveGlyph;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-23
* Time : 上午9:08
*/
public class ActiveGlyphFactory {
private static Map<String, Class> glyphMap = new HashMap<String, Class>();
static {
glyphMap.put(DataSeries.class.getName(), DataSeriesActiveGlyph.class);
glyphMap.put(RadarAxisGlyph.class.getName(), RadarAxisActiveGlyph.class);
glyphMap.put(RangeAxisGlyph.class.getName(), RangeAxisActiveGlyph.class);
glyphMap.put(TitleGlyph.class.getName(), TextActiveGlyph.class);
glyphMap.put(DateAxisGlyph.class.getName(), DateAxisActiveGlyph.class);
glyphMap.put(ValueAxisGlyph.class.getName(), ValueAxisActiveGlyph.class);
glyphMap.put(CategoryAxisGlyph.class.getName(), CategoryAxisActiveGlyph.class);
glyphMap.put(ChartGlyph.class.getName(), ChartActiveGlyph.class);
glyphMap.put(DataSheetGlyph.class.getName(), DataSheetActiveGlyph.class);
glyphMap.put(LegendGlyph.class.getName(), LegendActiveGlyph.class);
glyphMap.put(TextGlyph.class.getName(), DataLabelActiveGlyph.class);
glyphMap.put(TrendLineGlyph.class.getName(), TrendLineActiveGlyph.class);
glyphMap.put(ChartAlertValueGlyph.class.getName(), AlertValueActiveGlyph.class);
}
private ActiveGlyphFactory() {
}
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph) {
return createActiveGlyph(chartComponent, glyph, null);
}
public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph, Glyph parentGlyph) {
if (glyph == null) {
return null;
}
String clsName = glyph.getClass().getName();
Class cls = glyphMap.get(clsName);
Class parameterCls = glyph.getClass();
if (cls == null) {
if (clsName.endsWith("PlotGlyph")) {
cls = PlotActiveGlyph.class;
parameterCls = PlotGlyph.class;
} else if (clsName.endsWith("DataSeries4Area")) {
cls = DataSeriesActiveGlyph.class;
parameterCls = DataSeries.class;
} else {
cls = ChartActiveGlyph.class;
parameterCls = ChartGlyph.class;
}
}
try {
Class[] argsClass = new Class[]{ChartComponent.class, parameterCls, Glyph.class};
return (ActiveGlyph) cls.getConstructor(argsClass).newInstance(new Object[]{chartComponent, glyph, parentGlyph});
} catch (Exception e) {
return null;
}
}
}

98
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -2,36 +2,26 @@ package com.fr.design.chart.gui;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.ChartWebPara;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeListener;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.util.ArrayList;
import java.util.List;
@ -45,22 +35,12 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private static final long serialVersionUID = 744164838619052097L;
private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
private ChartCollection chartCollection4Design;
private Chart editingChart;
private BaseChartGlyph chartGlyph;
private ChartProvider editingChart;
private int chartWidth = -1;
private int chartHeight = -1;
private Point point;
private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph;
private boolean supportEdit = true;
private final int[] resizeCursors = new int[]{
Cursor.NW_RESIZE_CURSOR, Cursor.N_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR,
Cursor.E_RESIZE_CURSOR, Cursor.W_RESIZE_CURSOR,
Cursor.SE_RESIZE_CURSOR, Cursor.S_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR
};
public ChartComponent() {
super();
addMouseListener(this);
@ -112,15 +92,11 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
fireStopEditing();
this.editingChart = null;
this.chartGlyph = null;
this.activeGlyph = null;
this.point = null;
this.chartHeight = this.chartWidth = -1;
this.editingChart = this.chartCollection4Design.getSelectedChart();
this.editingChart = this.chartCollection4Design.getSelectedChartProvider();
refreshChartGlyph();
this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph);
repaint();
}
@ -166,9 +142,6 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
return editingChart;
}
public BaseChartGlyph getChartGlyph() {
return chartGlyph;
}
public void paintComponent(Graphics g) { //
super.paintComponent(g);
@ -192,12 +165,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//画图
drawChartGlyph(g2d);
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.paint4ActiveGlyph(g2d, chartGlyph);
}
drawChart(g2d);
g2d.translate(-ChartConstants.PREGAP4BOUNDS/2, -ChartConstants.PREGAP4BOUNDS/2);
if (lastHint == null) {
@ -212,24 +180,11 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
*/
private void refreshChartGlyph() {
Dimension d = getBounds().getSize();
this.editingChart = this.chartCollection4Design.getSelectedChart();// kunsnat: 切换选中时 同步切换Plot
if (editingChart != null) {
this.chartGlyph = editingChart.createGlyph(editingChart.defaultChartData());
this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph);
}
this.editingChart = this.chartCollection4Design.getSelectedChartProvider();// kunsnat: 切换选中时 同步切换Plot
this.chartWidth = d.width - ChartConstants.PREGAP4BOUNDS;
this.chartHeight = d.height - ChartConstants.PREGAP4BOUNDS;
}
private ActiveGlyph getActiveGlyph() {
if (point == null) {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph);
} else {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y);
}
return this.activeGlyph;
}
/**
* 鼠标点击
* @param event 鼠标事件
@ -243,16 +198,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param e 鼠标事件
*/
public void mousePressed(MouseEvent e) {
point = new Point(e.getX(),e.getY());
if (!ArrayUtils.contains(resizeCursors, this.getCursor().getType())) {
this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y);
}
if (this.activeGlyph == null) {
return;
}
repaint();
}
@ -291,45 +237,21 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
* @param e 鼠标事件
*/
public void mouseMoved(MouseEvent e) {
ActiveGlyph ag = this.getActiveGlyph();
if (ag != null) {
ag.onMouseMove(e);
}
}
public AxisGlyph getActiveAxisGlyph() {
return (AxisGlyph) activeGlyph.getGlyph();
}
public Axis getActiveAxis() {
AxisGlyph axisGlyph = getActiveAxisGlyph();
if (editingChart.getPlot() != null) {
return editingChart.getPlot().getAxis(axisGlyph.getAxisType());
}
return null;
}
private boolean needRefreshChartGlyph() {
return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
return editingChart == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height;
}
public void drawChartGlyph(Graphics2D g2d) {
if (chartGlyph != null) {
if (chartGlyph.isRoundBorder()) {
chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10));
} else {
chartGlyph.setBounds(new Rectangle2D.Double(0, 0, chartWidth, chartHeight));
}
private void drawChart(Graphics2D g2d) {
if (editingChart != null) {
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,resolution, this, null);
Image chartImage = editingChart.toImage(chartWidth, chartHeight, resolution, new ChartWebPara());
g2d.drawImage(chartImage, 0, 0, null);
}

161
designer-chart/src/main/java/com/fr/design/chart/gui/active/ActiveGlyph.java

@ -1,161 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.Glyph;
import com.fr.design.chart.gui.ActiveGlyphFactory;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:51
* 选中的Glyph
*/
public abstract class ActiveGlyph {
protected Glyph parentGlyph;
protected ChartComponent chartComponent;
public ActiveGlyph(ChartComponent chartComponent, Glyph parentGlyph) {
this.chartComponent = chartComponent;
this.parentGlyph = parentGlyph;
}
public abstract Glyph getGlyph();
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
this.getGlyph().draw(g2d, resolution);
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
/**
* 属性表中, 通过点击 展开到对应的界面.
*/
public abstract void goRightPane();
/**
* 画的偏移的
* @return 偏移的
*/
public Point2D offset4Paint() {
return new Point2D.Double(
this.parentGlyph.getShape().getBounds().getX(),
this.parentGlyph.getShape().getBounds().getY()
);
}
public void paint4ActiveGlyph(Graphics2D g2d, BaseChartGlyph chartGlyph) {
if(this.parentGlyph == null) {
return;
}
Paint oldPaint = g2d.getPaint();
Composite oldComposite = g2d.getComposite();
g2d.setPaint(Color.WHITE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g2d.fill(chartGlyph.getShape());
drawAllGlyph(g2d, ScreenResolution.getScreenResolution());
g2d.setPaint(oldPaint);
g2d.setComposite(oldComposite);
}
protected void drawSelectedBounds4Active(Graphics2D g2d) {
if (this.getGlyph() != null) {
Shape shape = this.getGlyph().getShape();
if (shape != null) {
g2d.draw(shape);
}
}
}
/**
*当前的ActiveGlyph是否包含坐标mouseX, mouseY
* @param mouseX 坐标X
* @param mouseY 坐标Y
* @return 包含则返回true
*/
public boolean contains(int mouseX, int mouseY) {
if (getGlyph() == null || getGlyph().getShape() == null){
return false;
}
Point2D offset = this.offset4Paint();
/*
* alex:因为Line2D.contains(x, y)必然返回false
* 所以用intersect一个区域,这个区域大小用4 * 4的,区域大一些,就灵敏一些
*/
return getGlyph().getShape().intersects(mouseX - offset.getX() - 2, mouseY - offset.getY() - 2, 4, 4);
}
/**
* 在当前选中的ActiveGlyph中,仅仅在其Children中找与mouseX, mouseY匹配的ActiveGlyph
* @param mouseX 坐标X
* @param mouseY 坐标Y
* @return 当前ativeGlyph
*/
public ActiveGlyph findActionGlyphFromChildren(int mouseX, int mouseY) {
Glyph currentGlyph = getGlyph();
// 报错应对.
if (currentGlyph == null) {
return null;
}
java.util.Iterator selectableChildren = currentGlyph.selectableChildren();
ActiveGlyph resAG = null;
while (selectableChildren.hasNext() && resAG == null) {
ActiveGlyph childActiveGlyph = ActiveGlyphFactory.createActiveGlyph(chartComponent, selectableChildren.next(), currentGlyph);
// 如果childActiveGlyph不为null,找一下其子辈有没有符合条件
if (childActiveGlyph != null) {
resAG = childActiveGlyph.findActionGlyphFromChildren(mouseX, mouseY);
}
// 如果childActiveGlyph的子辈没有符合条件的,就看一下这个childGlyph是否符合条件
if (resAG == null && childActiveGlyph != null && childActiveGlyph.contains(mouseX, mouseY)) {
resAG = childActiveGlyph;
}
}
// 如果当前ActiveGlyph的所有子辈都没有与mouseX, mouseY相匹配的,看一下它自己是否匹配
if (resAG == null) {
if (this.contains(mouseX, mouseY)) {
resAG = this;
}
}
return resAG;
}
/**
* 拖拽
* @param e 事件
*/
public void onMouseDragged(MouseEvent e) {
}
/**
* 移动事件
* @param e 事件
*/
public void onMouseMove(MouseEvent e) {
}
}

38
designer-chart/src/main/java/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java

@ -1,38 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ChartAlertValueGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction;
public class AlertValueActiveGlyph extends ActiveGlyph{
ChartAlertValueGlyph alertValueGlyph;
public AlertValueActiveGlyph(ChartComponent chartComponent,ChartAlertValueGlyph alertLine, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.alertValueGlyph = alertLine;
}
public Point2D offset4Paint() {
Rectangle2D valueAxisBoudns = this.alertValueGlyph.getValueAxisGlyph().getBounds();
return new Point2D.Double(
this.parentGlyph.getShape().getBounds().getX() + valueAxisBoudns.getX(),
this.parentGlyph.getShape().getBounds().getY() + valueAxisBoudns.getY()
);
}
@Override
public Glyph getGlyph() {
return this.alertValueGlyph;
}
@Override
public void goRightPane() {
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane();
}
}

43
designer-chart/src/main/java/com/fr/design/chart/gui/active/AxisActiveGlyph.java

@ -1,43 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAxisStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:00
*/
public abstract class AxisActiveGlyph extends ActiveGlyph {
protected AxisGlyph axis;
public AxisActiveGlyph(ChartComponent chartComponent, AxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.axis = axis;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
this.axis.drawWithOutAlert(g2d, resolution);
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
public void goRightPane() {
new SetAxisStyleAction(chartComponent).showAxisStylePane();
}
/**
* 返回 对应的属性Axis
*/
public Glyph getGlyph() {
return this.axis;
}
}

19
designer-chart/src/main/java/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java

@ -1,19 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.CategoryAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:01
*/
public class CategoryAxisActiveGlyph extends AxisActiveGlyph {
public CategoryAxisActiveGlyph(ChartComponent chartComponent, CategoryAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

39
designer-chart/src/main/java/com/fr/design/chart/gui/active/ChartActiveGlyph.java

@ -1,39 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.geom.Point2D;
import com.fr.base.chart.BaseChartGlyph;
import com.fr.base.chart.Glyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetChartStyleAciton;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:54
*/
public class ChartActiveGlyph extends ActiveGlyph {
private BaseChartGlyph glyphChart;
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart) {
this(chartComponent, chart, null);
}
public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.glyphChart = chart;
}
public Glyph getGlyph() {
return this.glyphChart;
}
public Point2D offset4Paint() {
return new java.awt.Point(0, 0);
}
public void goRightPane() {
new SetChartStyleAciton(chartComponent).showChartStylePane();
}
}

44
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java

@ -1,44 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.TextGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetDataLabelStyleAction;
public class DataLabelActiveGlyph extends ActiveGlyph{
private TextGlyph dataLabel;
public DataLabelActiveGlyph(ChartComponent chartComponent, TextGlyph dataLabel, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.dataLabel = dataLabel;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
ArrayList<TextGlyph> allDataPointLableGlyph = new ArrayList<TextGlyph>();
PlotGlyph plotGlyph = (PlotGlyph)(this.parentGlyph);
plotGlyph.getAllDataPointGlyph(allDataPointLableGlyph);
for(int index = 0; index < allDataPointLableGlyph.size(); index++){
allDataPointLableGlyph.get(index).draw(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
@Override
public Glyph getGlyph() {
return this.dataLabel;
}
@Override
public void goRightPane() {
new SetDataLabelStyleAction(chartComponent).showDataLabelStylePane();
}
}

53
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java

@ -1,53 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:59
*/
public class DataSeriesActiveGlyph extends ActiveGlyph {
private DataSeries series;
public DataSeriesActiveGlyph(ChartComponent chartComponent, DataSeries series, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.series = series;
}
public Glyph getGlyph() {
return this.series;
}
/**
* 界面条状
*/
public void goRightPane() {
if(chartComponent.getEditingChart() == null) {
return;
}
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE);
}
@Override
public void drawAllGlyph(Graphics2D g2d, int resolution) {
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
if(this.parentGlyph != null && this.parentGlyph instanceof PlotGlyph){
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph;
plotGlyph.drawShape4Series(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
}
}

30
designer-chart/src/main/java/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java

@ -1,30 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DataSheetGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetDataSheetAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:57
*/
public class DataSheetActiveGlyph extends ActiveGlyph {
private DataSheetGlyph dataSheetGlyph;
public DataSheetActiveGlyph(ChartComponent chartComponent, DataSheetGlyph dataSheetGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.dataSheetGlyph = dataSheetGlyph;
}
public Glyph getGlyph() {
return this.dataSheetGlyph;
}
public void goRightPane() {
new SetDataSheetAction(chartComponent).showDataSheetStylePane();
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.DateAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:03
*/
public class DateAxisActiveGlyph extends AxisActiveGlyph {
public DateAxisActiveGlyph(ChartComponent chartComponent, DateAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

30
designer-chart/src/main/java/com/fr/design/chart/gui/active/LegendActiveGlyph.java

@ -1,30 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetLegendStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:58
*/
public class LegendActiveGlyph extends ActiveGlyph {
private LegendGlyph legendGlyph;
public LegendActiveGlyph(ChartComponent chartComponent, LegendGlyph legendGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.legendGlyph = legendGlyph;
}
public Glyph getGlyph() {
return this.legendGlyph;
}
public void goRightPane() {
new SetLegendStyleAction(chartComponent).showLegendStylePane();
}
}

34
designer-chart/src/main/java/com/fr/design/chart/gui/active/PlotActiveGlyph.java

@ -1,34 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetPlotStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:55
*/
public class PlotActiveGlyph extends ActiveGlyph {
private PlotGlyph plotGlyph;
public PlotActiveGlyph(ChartComponent chartComponent, PlotGlyph plotGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.plotGlyph = plotGlyph;
}
public Glyph getGlyph() {
return this.plotGlyph;
}
public void goRightPane() {
new SetPlotStyleAction(chartComponent).showPlotPane();
}
public java.awt.Point offset4Paint() {
return new java.awt.Point(0, 0);
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.RadarAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:03
*/
public class RadarAxisActiveGlyph extends AxisActiveGlyph {
public RadarAxisActiveGlyph(ChartComponent chartComponent, RadarAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

18
designer-chart/src/main/java/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java

@ -1,18 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:02
*/
public class RangeAxisActiveGlyph extends AxisActiveGlyph {
public RangeAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

35
designer-chart/src/main/java/com/fr/design/chart/gui/active/TextActiveGlyph.java

@ -1,35 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetTitleStyleAction;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午3:57
*/
public class TextActiveGlyph extends ActiveGlyph {
private TitleGlyph titleGlyph;
public TextActiveGlyph(ChartComponent chartComponent, TitleGlyph titleGlyph, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.titleGlyph = titleGlyph;
}
public Glyph getGlyph() {
return this.titleGlyph;
}
public java.awt.Point offset4Paint() {
return new java.awt.Point(0, 0);
}
public void goRightPane() {
new SetTitleStyleAction(chartComponent).showTitlePane();
}
}

43
designer-chart/src/main/java/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java

@ -1,43 +0,0 @@
package com.fr.design.chart.gui.active;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.chart.chartglyph.TrendLineGlyph;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction;
public class TrendLineActiveGlyph extends ActiveGlyph{
private TrendLineGlyph trendLine;
public TrendLineActiveGlyph(ChartComponent chartComponent,TrendLineGlyph trendLine, Glyph parentGlyph) {
super(chartComponent, parentGlyph);
this.trendLine = trendLine;
}
@Override
public Glyph getGlyph() {
return this.trendLine;
}
public void drawAllGlyph(Graphics2D g2d, int resolution){
Point2D offset4Paint = offset4Paint();
g2d.translate(offset4Paint.getX(), offset4Paint.getY());
PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph;
List<TrendLineGlyph> list = new ArrayList<TrendLineGlyph>();
plotGlyph.getAllTrendLineGlyph(list);
for(int index = 0; index < list.size(); index++){
list.get(index).draw(g2d, resolution);
}
g2d.translate(-offset4Paint.getX(), -offset4Paint.getY());
};
@Override
public void goRightPane() {
new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane();
}
}

19
designer-chart/src/main/java/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java

@ -1,19 +0,0 @@
package com.fr.design.chart.gui.active;
import com.fr.base.chart.Glyph;
import com.fr.chart.chartglyph.ValueAxisGlyph;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:02
*/
public class ValueAxisActiveGlyph extends AxisActiveGlyph {
public ValueAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) {
super(chartComponent, axis, parentGlyph);
}
}

37
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java

@ -1,37 +0,0 @@
package com.fr.design.chart.gui.active.action;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.actions.UpdateAction;
import com.fr.design.chart.gui.ChartComponent;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:05
*/
public abstract class ChartComponentAction extends UpdateAction {
protected ChartComponent chartComponent;
public ChartComponentAction(ChartComponent chartComponent) {
this.chartComponent = chartComponent;
}
public void reset() {
chartComponent.reset();
}
public void repaint() {
chartComponent.repaint();
}
public ChartCollection getChartCollection() {
return chartComponent.getChartCollection();
}
public AxisGlyph getActiveAxisGlyph() {
return chartComponent.getActiveAxisGlyph();
}
}

27
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java

@ -1,27 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
public class SetAnalysisLineStyleAction extends ChartComponentAction{
public SetAnalysisLineStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Analysis_Line"));
}
@Override
public void actionPerformed(ActionEvent e) {
showAnalysisLineStylePane();
}
public void showAnalysisLineStylePane(){
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LINE_TITLE);
}
}

33
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java

@ -1,33 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
import com.fr.stable.StringUtils;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:10
*/
public class SetAxisStyleAction extends ChartComponentAction {
public SetAxisStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Axis_Format"));
}
public void actionPerformed(ActionEvent e) {
showAxisStylePane();
}
public void showAxisStylePane() {
String axisType = getActiveAxisGlyph() == null ? StringUtils.EMPTY : getActiveAxisGlyph().getAxisType();
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AXIS_TITLE, axisType);
}
}

31
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java

@ -1,31 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午5:00
*/
public class SetChartStyleAciton extends ChartComponentAction {
public SetChartStyleAciton(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pattern"));
}
public void actionPerformed(ActionEvent e) {
showChartStylePane();
}
public void showChartStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE);
}
}

26
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java

@ -1,26 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
public class SetDataLabelStyleAction extends ChartComponentAction{
public SetDataLabelStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Data_Label"));
}
@Override
public void actionPerformed(ActionEvent e) {
showDataLabelStylePane();
}
public void showDataLabelStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LABEL_TITLE);
}
}

33
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetDataSheetAction.java

@ -1,33 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:49
*/
public class SetDataSheetAction extends ChartComponentAction {
private static final long serialVersionUID = -4763886493273213850L;
public SetDataSheetAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Data_Sheet"));
}
public void actionPerformed(ActionEvent e) {
showDataSheetStylePane();
}
public void showDataSheetStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_DATA_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:56
*/
public class SetLegendStyleAction extends ChartComponentAction {
private static final long serialVersionUID = 3253190503195130478L;
public SetLegendStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Legend_Sytle"));
}
public void actionPerformed(ActionEvent e) {
showLegendStylePane();
}
public void showLegendStylePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LEGNED_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:58
*/
public class SetPlotStyleAction extends ChartComponentAction {
private static final long serialVersionUID = 2894127568015714372L;
public SetPlotStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Plot"));
}
public void actionPerformed(ActionEvent e) {
showPlotPane();
}
public void showPlotPane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE);
}
}

32
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java

@ -1,32 +0,0 @@
package com.fr.design.chart.gui.active.action;
import java.awt.event.ActionEvent;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.module.DesignModuleFactory;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-22
* Time : 下午4:52
*/
public class SetTitleStyleAction extends ChartComponentAction {
private static final long serialVersionUID = -4763886493273213850L;
public SetTitleStyleAction(ChartComponent chartComponent) {
super(chartComponent);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Set_Title_Style"));
}
public void actionPerformed(ActionEvent e) {
showTitlePane();
}
public void showTitlePane() {
DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_TITLE_TITLE);
}
}

6
designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java

@ -245,7 +245,11 @@ public class MapImageEditPane extends BasicBeanPane<String> {
g2d.translate(moveLeft, moveTop);
g2d.setStroke(new BasicStroke(1));
if (resultAreaShape != null && !resultAreaShape.isEmpty()) {
if (resultAreaShape == null) {
throw new IllegalArgumentException("resultAreaShape can not be null!");
}
if (!resultAreaShape.isEmpty()) {
for (String key : resultAreaShape.keySet()) {
GeneralPath selectShape = getSelectedNodePath(key);

23
designer-chart/src/main/java/com/fr/design/chartx/StructureChartDataPane.java

@ -0,0 +1,23 @@
package com.fr.design.chartx;
import com.fr.design.chartx.fields.diff.StructureCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.StructureDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-02
*/
public class StructureChartDataPane extends MultiCategoryChartDataPane {
public StructureChartDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new StructureDataSetFieldsPane(), new StructureCellDataFieldsPane());
}
}

86
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java

@ -0,0 +1,86 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.StructureColumnFieldCollection;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-02
*/
public class StructureCellDataFieldsPane extends AbstractCellDataFieldsPane<StructureColumnFieldCollection> {
private TinyFormulaPane nodeName;
private TinyFormulaPane nodeId;
private TinyFormulaPane parentId;
private UITextField seriesName;
private TinyFormulaPane nodeValue;
@Override
protected void initComponents() {
seriesName = new UITextField();
nodeName = new TinyFormulaPane();
nodeId = new TinyFormulaPane();
parentId = new TinyFormulaPane();
nodeValue = new TinyFormulaPane();
super.initComponents();
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Node_Name"),
"id",
Toolkit.i18nText("Fine-Design_Chart_Parent_ID"),
Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Value"),
};
}
@Override
protected TinyFormulaPane[] formulaPanes() {
return new TinyFormulaPane[]{
nodeName,
nodeId,
parentId,
nodeValue
};
}
@Override
protected Component[] fieldComponents() {
return new Component[]{
nodeName,
nodeId,
parentId,
nodeValue,
nodeValue,
};
}
@Override
public void populateBean(StructureColumnFieldCollection ob) {
seriesName.setText(ob.getSeriesName());
populateField(nodeName, ob.getNodeName());
populateField(nodeId, ob.getNodeId());
populateField(parentId, ob.getParentId());
populateField(nodeValue, ob.getNodeValue());
}
@Override
public StructureColumnFieldCollection updateBean() {
StructureColumnFieldCollection result = new StructureColumnFieldCollection();
result.setSeriesName(seriesName.getText());
updateField(nodeName, result.getNodeName());
updateField(nodeId, result.getNodeId());
updateField(parentId, result.getParentId());
updateField(nodeValue, result.getNodeValue());
return result;
}
}

91
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureDataSetFieldsPane.java

@ -0,0 +1,91 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.StructureColumnFieldCollection;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-02
*/
public class StructureDataSetFieldsPane extends AbstractDataSetFieldsPane<StructureColumnFieldCollection> {
private UIComboBox nodeName;
private UIComboBox nodeId;
private UIComboBox parentId;
private UITextField seriesName;
private UIComboBox nodeValue;
private CalculateComboBox calculateCombox;
@Override
protected void initComponents() {
nodeName = new UIComboBox();
nodeId = new UIComboBox();
parentId = new UIComboBox();
seriesName = new UITextField();
nodeValue = new UIComboBox();
calculateCombox = new CalculateComboBox();
super.initComponents();
}
@Override
protected String[] fieldLabels() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Node_Name"),
"id",
Toolkit.i18nText("Fine-Design_Chart_Parent_ID"),
Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Value"),
Toolkit.i18nText("Fine-Design_Chart_Summary_Method")
};
}
@Override
protected UIComboBox[] filedComboBoxes() {
return new UIComboBox[]{
nodeName,
nodeId,
parentId,
nodeValue
};
}
@Override
protected Component[] fieldComponents() {
return new Component[]{
nodeName,
nodeId,
parentId,
nodeValue,
nodeValue,
calculateCombox
};
}
@Override
public void populateBean(StructureColumnFieldCollection ob) {
seriesName.setText(ob.getSeriesName());
populateField(nodeName, ob.getNodeName());
populateField(nodeId, ob.getNodeId());
populateField(parentId, ob.getParentId());
populateFunctionField(nodeValue, calculateCombox, ob.getNodeValue());
}
@Override
public StructureColumnFieldCollection updateBean() {
StructureColumnFieldCollection result = new StructureColumnFieldCollection();
result.setSeriesName(seriesName.getText());
updateField(nodeName, result.getNodeName());
updateField(nodeId, result.getNodeId());
updateField(parentId, result.getParentId());
updateFunctionField(nodeValue, calculateCombox, result.getNodeValue());
return result;
}
}

2
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/WordCloudCellDataFieldsPane.java

@ -64,7 +64,7 @@ public class WordCloudCellDataFieldsPane extends AbstractCellDataFieldsPane<Word
WordCloudColumnFieldCollection result = new WordCloudColumnFieldCollection();
result.setTargetName(name.getText());
updateField(wordName, result.getWordName());
populateField(wordValue, result.getWordValue());
updateField(wordValue, result.getWordValue());
return result;
}
}

9
designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java

@ -96,15 +96,6 @@ public class MapEditPane extends BasicBeanPane<MapSvgAttr>{
}
/**
* 再图片面板设置类型和名字
* @param mapType 地图类型
*/
public void dealWidthMap(String mapType){
areaPane.setTypeNameAndMapName(mapType,currentMapName);
// pointPane.setTypeNameAndMapName(mapType,currentMapName);
}
@Override
public MapSvgAttr updateBean() {
MapSvgAttr currentAttr = editingPane.updateCurrentAttr();

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java

@ -56,7 +56,10 @@ public class ChartDataPane extends AbstractChartAttrPane {
}
this.setLayout(new BorderLayout(0, 0));
if (collection != null && collection.getChartCount() <= 0) {
if (collection == null) {
throw new IllegalArgumentException("ChartCollection can not be null!");
}
if (collection.getChartCount() <= 0) {
contentsPane = new NormalChartDataPane(listener, ChartDataPane.this);
} else if (collection.getSelectedChart().getPlot() instanceof MapPlot) {
contentsPane = new MapDataPane(listener);

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java

@ -114,7 +114,9 @@ public class AreaPlotPane extends AbstractDeprecatedChartTypePane {
((Area3DPlot)plot).setStacked(true);
((Area3DPlot)plot).getyAxis().setPercentage(true);
}
createAreaCondition(plot);
if(plot != null) {
createAreaCondition(plot);
}
return plot;
}

10
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java

@ -97,10 +97,12 @@ public class BarPlotPane extends AbstractBarPane{
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
if(newPlot != null) {
try {
cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}
}
return cloned;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save