Browse Source

Merge branch 'feature/10.0' of https://cloud.finedevelop.com/scm/~hugh.c/design into feature/10.0

research/11.0
Hugh.C 5 years ago
parent
commit
f998d9ec47
  1. 8
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 58
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java
  3. 193
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  4. 48
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  5. 2
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  6. 16
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  7. 12
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  8. 5
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  9. 6
      designer-base/src/main/java/com/fr/design/gui/ilable/MultilineLabel.java
  10. 4
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  11. 31
      designer-base/src/main/java/com/fr/design/gui/itable/AbstractPropertyTable.java
  12. 404
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java
  13. 369
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  14. 5
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  15. 5
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/parser/TaskTagParser.java
  16. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/LineNumberList.java
  17. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextArea.java
  18. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java
  19. 10
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java
  20. 6
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  21. 1
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  22. 1
      designer-base/src/main/java/com/fr/design/utils/DrawRoutines.java
  23. 1
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  24. 1
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  25. 6
      designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java
  26. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java
  27. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  28. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java
  29. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java
  30. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java
  31. 2
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java
  32. 1
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

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

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

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

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

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.passport.FinePassportManager; import com.fr.base.passport.FinePassportManager;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor; 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.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Color; import java.awt.Color;
import java.awt.Desktop; import java.awt.Desktop;
import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* @author vito * @author vito
*/ */
public class LoginWebBridge { 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 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 NET_FAILED = "-4";
//用户名,密码为空 //用户名,密码为空
private static final String LOGIN_INFO_EMPTY = "-5"; 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 final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static LoginWebBridge helper; private static LoginWebBridge helper;
//消息条数 //消息条数
@ -131,22 +115,6 @@ public class LoginWebBridge {
return client.isServerAlive(); 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) { public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password)); 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) { 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.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
@ -142,6 +143,7 @@ public class PluginControlPane extends BasicPane {
} }
} }
@Nullable
public PluginView getSelectedPlugin() { public PluginView getSelectedPlugin() {
return (PluginView) pluginList.getSelectedValue(); 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 * @since 8.0
*/ */
public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> { public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> {
private static final int LISTNUM1 = 1;
private static final int LISTNUM100 = 100;
private UILabel errorMsgLabel; private UILabel errorMsgLabel;
private UITabbedPane tabbedPane; private UITabbedPane tabbedPane;
private PluginControlPane controlPane; private PluginControlPane controlPane;
@ -45,6 +43,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @return 创建的页面对象 * @return 创建的页面对象
*/ */
@Override
public JPanel createSuccessPane() { public JPanel createSuccessPane() {
return new PluginStatusCheckCompletePane() { return new PluginStatusCheckCompletePane() {
@ -130,8 +129,8 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @return 插件 * @return 插件
*/ */
@Override
public List<PluginView> loadData() throws Exception { public List<PluginView> loadData() throws Exception {
//Thread.sleep(3000);
return PluginsReaderFromStore.readPlugins(); return PluginsReaderFromStore.readPlugins();
} }
@ -140,6 +139,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @param plugins 插件 * @param plugins 插件
*/ */
@Override
public void loadOnSuccess(List<PluginView> plugins) { public void loadOnSuccess(List<PluginView> plugins) {
controlPane.loadPlugins(plugins); controlPane.loadPlugins(plugins);
tabbedPane.setTitleAt(2, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_All_Plugins") + "(" + plugins.size() + ")"); 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 异常消息 * @param e 异常消息
*/ */
@Override
public void loadOnFailed(Exception e) { public void loadOnFailed(Exception e) {
errorMsgLabel.setText(e.getCause().getMessage()); errorMsgLabel.setText(e.getCause().getMessage());
} }
@Override
protected void installFromDiskFile() { protected void installFromDiskFile() {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
@ -196,10 +198,11 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
} }
if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) { if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
PluginView plugin = controlPane.getSelectedPlugin(); PluginView plugin = controlPane.getSelectedPlugin();
String id = null; if (plugin == null) {
if (plugin != null) { FineLoggerFactory.getLogger().error("selected plugin is null");
id = plugin.getID(); return;
} }
String id = plugin.getID();
try { try {
PluginMarker pluginMarker = PluginMarker.create(id, plugin.getVersion()); PluginMarker pluginMarker = PluginMarker.create(id, plugin.getVersion());
@ -219,6 +222,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @return 标题字符串 * @return 标题字符串
*/ */
@Override
public String textForLoadingLabel() { public String textForLoadingLabel() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Load_Plugins_From_Server"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Load_Plugins_From_Server");
} }

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; boolean savedOpaque = false;
paintRender(g, c, mustResetOpaque, savedOpaque, leftToRight, width, insets, iconWidth, left, top, height); 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, private void paintRender(Graphics g, Component c, boolean mustResetOpaque, boolean savedOpaque, boolean leftToRight,
@ -152,14 +148,6 @@ public class UIComboBoxButton extends JButton {
} else { } else {
rendererPane.paintComponent(g, c, this, left + iconWidth, top, cWidth, height, shouldValidate); 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));
}
} }
} }

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 > MAX_WIDTH ? MAX_WIDTH : containerWidth;
containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth; containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth;
if (containerWidth < MIN_WIDTH) {
upPane.setVisible(false);
downPane.setVisible(false);
containerWidth = toolPaneHeight;
}
refreshContainer(); refreshContainer();
if (DesignerMode.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); 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 class MultilineLabel extends UITextArea {
public MultilineLabel() { public MultilineLabel() {
initComponents(); initCurrentComponents();
} }
public MultilineLabel(String s) { public MultilineLabel(String s) {
super(s); super(s);
initComponents(); initCurrentComponents();
} }
private void initComponents() { private void initCurrentComponents() {
adjustUI(); 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.ColorRoutines;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.ActionMap; import javax.swing.ActionMap;
@ -579,7 +580,8 @@ public class UIBasicMenuItemUI extends MenuItemUI {
*/ */
private boolean isInternalFrameSystemMenu() { private boolean isInternalFrameSystemMenu() {
String actionCommand = menuItem.getActionCommand(); 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"));
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////

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

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

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

File diff suppressed because it is too large Load Diff

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

@ -9,6 +9,24 @@
*/ */
package com.fr.design.gui.syntax.ui.rsyntaxtextarea; package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenUtils.TokenSubList;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
import com.fr.design.gui.syntax.ui.rtextarea.RTextArea;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import javax.swing.JLabel;
import javax.swing.JViewport;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.text.BadLocationException;
import javax.swing.text.Caret;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.Position;
import javax.swing.text.Segment;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import java.awt.Color; import java.awt.Color;
import java.awt.Container; import java.awt.Container;
import java.awt.Point; import java.awt.Point;
@ -16,23 +34,9 @@ import java.awt.Rectangle;
import java.awt.Shape; import java.awt.Shape;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Caret;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.Position;
import javax.swing.text.Segment;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenUtils.TokenSubList;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
import com.fr.design.gui.syntax.ui.rtextarea.RTextArea;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
/** /**
@ -122,7 +126,7 @@ public class RSyntaxUtilities implements SwingConstants {
/** /**
* Used internally. * Used internally.
*/ */
private static final char[] JS_KEYWORD_RETURN = { 'r', 'e', 't', 'u', 'r', 'n' }; private static final char[] JS_KEYWORD_RETURN = {'r', 'e', 't', 'u', 'r', 'n'};
/** /**
* Used internally. * Used internally.
@ -146,10 +150,10 @@ public class RSyntaxUtilities implements SwingConstants {
public static final String escapeForHtml(String s, public static final String escapeForHtml(String s,
String newlineReplacement, boolean inPreBlock) { String newlineReplacement, boolean inPreBlock) {
if (s==null) { if (s == null) {
return null; return null;
} }
if (newlineReplacement==null) { if (newlineReplacement == null) {
newlineReplacement = ""; newlineReplacement = "";
} }
final String tabString = " "; final String tabString = " ";
@ -157,14 +161,13 @@ public class RSyntaxUtilities implements SwingConstants {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i=0; i<s.length(); i++) { for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i); char ch = s.charAt(i);
switch (ch) { switch (ch) {
case ' ': case ' ':
if (inPreBlock || !lastWasSpace) { if (inPreBlock || !lastWasSpace) {
sb.append(' '); sb.append(' ');
} } else {
else {
sb.append("&nbsp;"); sb.append("&nbsp;");
} }
lastWasSpace = true; lastWasSpace = true;
@ -208,8 +211,8 @@ public class RSyntaxUtilities implements SwingConstants {
* @return The rendering hints, or <code>null</code> if they cannot be * @return The rendering hints, or <code>null</code> if they cannot be
* determined. * determined.
*/ */
public static Map<?,?> getDesktopAntiAliasHints() { public static Map<?, ?> getDesktopAntiAliasHints() {
return (Map<?,?>)Toolkit.getDefaultToolkit(). return (Map<?, ?>) Toolkit.getDefaultToolkit().
getDesktopProperty("awt.font.desktophints"); getDesktopProperty("awt.font.desktophints");
} }
@ -223,7 +226,7 @@ public class RSyntaxUtilities implements SwingConstants {
public static Color getFoldedLineBottomColor(RSyntaxTextArea textArea) { public static Color getFoldedLineBottomColor(RSyntaxTextArea textArea) {
Color color = Color.gray; Color color = Color.gray;
Gutter gutter = RSyntaxUtilities.getGutter(textArea); Gutter gutter = RSyntaxUtilities.getGutter(textArea);
if (gutter!=null) { if (gutter != null) {
color = gutter.getFoldIndicatorForeground(); color = gutter.getFoldIndicatorForeground();
} }
return color; return color;
@ -245,7 +248,7 @@ public class RSyntaxUtilities implements SwingConstants {
if (parent instanceof JViewport) { if (parent instanceof JViewport) {
parent = parent.getParent(); parent = parent.getParent();
if (parent instanceof RTextScrollPane) { if (parent instanceof RTextScrollPane) {
RTextScrollPane sp = (RTextScrollPane)parent; RTextScrollPane sp = (RTextScrollPane) parent;
gutter = sp.getGutter(); // Should always be non-null gutter = sp.getGutter(); // Should always be non-null
} }
} }
@ -267,7 +270,7 @@ public class RSyntaxUtilities implements SwingConstants {
// This property is defined by all standard LaFs, even Nimbus (!), // This property is defined by all standard LaFs, even Nimbus (!),
// but you never know what crazy LaFs there are... // but you never know what crazy LaFs there are...
Color fg = UIManager.getColor("Label.foreground"); Color fg = UIManager.getColor("Label.foreground");
if (fg==null) { if (fg == null) {
fg = new JLabel().getForeground(); fg = new JLabel().getForeground();
} }
@ -286,7 +289,7 @@ public class RSyntaxUtilities implements SwingConstants {
public static String getLeadingWhitespace(String text) { public static String getLeadingWhitespace(String text) {
int count = 0; int count = 0;
int len = text.length(); int len = text.length();
while (count<len && RSyntaxUtilities.isWhitespace(text.charAt(count))) { while (count < len && RSyntaxUtilities.isWhitespace(text.charAt(count))) {
count++; count++;
} }
return text.substring(0, count); return text.substring(0, count);
@ -310,7 +313,7 @@ public class RSyntaxUtilities implements SwingConstants {
Element elem = root.getElement(line); Element elem = root.getElement(line);
int startOffs = elem.getStartOffset(); int startOffs = elem.getStartOffset();
int endOffs = elem.getEndOffset() - 1; int endOffs = elem.getEndOffset() - 1;
String text = doc.getText(startOffs, endOffs-startOffs); String text = doc.getText(startOffs, endOffs - startOffs);
return getLeadingWhitespace(text); return getLeadingWhitespace(text);
} }
@ -319,7 +322,7 @@ public class RSyntaxUtilities implements SwingConstants {
Element map = d.getDefaultRootElement(); Element map = d.getDefaultRootElement();
int index = map.getElementIndex(offs); int index = map.getElementIndex(offs);
Element elem = map.getElement(index); Element elem = map.getElement(index);
if ((offs>=elem.getStartOffset()) && (offs<elem.getEndOffset())) { if ((offs >= elem.getStartOffset()) && (offs < elem.getEndOffset())) {
return elem; return elem;
} }
return null; return null;
@ -358,13 +361,14 @@ public class RSyntaxUtilities implements SwingConstants {
int x0) int x0)
throws BadLocationException { throws BadLocationException {
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument(); RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
// Ensure p0 and p1 are valid document positions. // Ensure p0 and p1 are valid document positions.
if (p0<0) if (p0 < 0) {
throw new BadLocationException("Invalid document position", p0); throw new BadLocationException("Invalid document position", p0);
else if (p1>doc.getLength()) } else if (p1 > doc.getLength()) {
throw new BadLocationException("Invalid document position", p1); throw new BadLocationException("Invalid document position", p1);
}
// Ensure p0 and p1 are in the same line, and get the start/end // Ensure p0 and p1 are in the same line, and get the start/end
// offsets for that line. // offsets for that line.
@ -373,9 +377,10 @@ public class RSyntaxUtilities implements SwingConstants {
// We do ">1" because p1 might be the first position on the next line // We do ">1" because p1 might be the first position on the next line
// or the last position on the previous one. // or the last position on the previous one.
// if (lineNum!=map.getElementIndex(p1)) // if (lineNum!=map.getElementIndex(p1))
if (Math.abs(lineNum-map.getElementIndex(p1))>1) if (Math.abs(lineNum - map.getElementIndex(p1)) > 1) {
throw new IllegalArgumentException("p0 and p1 are not on the " + throw new IllegalArgumentException("p0 and p1 are not on the " +
"same line (" + p0 + ", " + p1 + ")."); "same line (" + p0 + ", " + p1 + ").");
}
// Get the token list. // Get the token list.
Token t = doc.getTokenListForLine(lineNum); Token t = doc.getTokenListForLine(lineNum);
@ -410,7 +415,7 @@ public class RSyntaxUtilities implements SwingConstants {
public static Point getMatchingBracketPosition(RSyntaxTextArea textArea, public static Point getMatchingBracketPosition(RSyntaxTextArea textArea,
Point input) { Point input) {
if (input==null) { if (input == null) {
input = new Point(); input = new Point();
} }
input.setLocation(-1, -1); input.setLocation(-1, -1);
@ -419,25 +424,25 @@ public class RSyntaxUtilities implements SwingConstants {
// Actually position just BEFORE caret. // Actually position just BEFORE caret.
int caretPosition = textArea.getCaretPosition() - 1; int caretPosition = textArea.getCaretPosition() - 1;
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument(); RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
char bracket = 0; char bracket = 0;
// If the caret was at offset 0, we can't check "to its left." // If the caret was at offset 0, we can't check "to its left."
if (caretPosition>=0) { if (caretPosition >= 0) {
bracket = doc.charAt(caretPosition); bracket = doc.charAt(caretPosition);
} }
// Try to match a bracket "to the right" of the caret if one // Try to match a bracket "to the right" of the caret if one
// was not found on the left. // was not found on the left.
int index = BRACKETS.indexOf(bracket); int index = BRACKETS.indexOf(bracket);
if (index==-1 && caretPosition<doc.getLength()-1) { if (index == -1 && caretPosition < doc.getLength() - 1) {
bracket = doc.charAt(++caretPosition); bracket = doc.charAt(++caretPosition);
} }
// First, see if the char was a bracket (one of "{[()]}"). // First, see if the char was a bracket (one of "{[()]}").
if (index==-1) { if (index == -1) {
index = BRACKETS.indexOf(bracket); index = BRACKETS.indexOf(bracket);
if (index==-1) { if (index == -1) {
return input; return input;
} }
} }
@ -455,14 +460,13 @@ public class RSyntaxUtilities implements SwingConstants {
Token token = doc.getTokenListForLine(curLine); Token token = doc.getTokenListForLine(curLine);
token = RSyntaxUtilities.getTokenAtOffset(token, caretPosition); token = RSyntaxUtilities.getTokenAtOffset(token, caretPosition);
// All brackets are always returned as "separators." // All brackets are always returned as "separators."
if (token.getType()!=Token.SEPARATOR) { if (Objects.requireNonNull(token).getType() != Token.SEPARATOR) {
return input; return input;
} }
if (index<3) { // One of "{[(" if (index < 3) { // One of "{[("
goForward = true; goForward = true;
bracketMatch = BRACKETS.charAt(index + 3); bracketMatch = BRACKETS.charAt(index + 3);
} } else { // One of ")]}"
else { // One of ")]}"
goForward = false; goForward = false;
bracketMatch = BRACKETS.charAt(index - 3); bracketMatch = BRACKETS.charAt(index - 3);
} }
@ -479,33 +483,32 @@ public class RSyntaxUtilities implements SwingConstants {
while (true) { while (true) {
doc.getText(start,end-start, charSegment); doc.getText(start, end - start, charSegment);
int segOffset = charSegment.offset; int segOffset = charSegment.offset;
for (int i=segOffset; i<segOffset+charSegment.count; i++) { for (int i = segOffset; i < segOffset + charSegment.count; i++) {
char ch = charSegment.array[i]; char ch = charSegment.array[i];
if (ch==bracket) { if (ch == bracket) {
if (haveTokenList==false) { if (!haveTokenList) {
token = doc.getTokenListForLine(curLine); token = doc.getTokenListForLine(curLine);
haveTokenList = true; haveTokenList = true;
} }
int offset = start + (i-segOffset); int offset = start + (i - segOffset);
token = RSyntaxUtilities.getTokenAtOffset(token, offset); token = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (token.getType()==Token.SEPARATOR) if (Objects.requireNonNull(token).getType() == Token.SEPARATOR) {
numEmbedded++; numEmbedded++;
} }
} else if (ch == bracketMatch) {
else if (ch==bracketMatch) { if (!haveTokenList) {
if (haveTokenList==false) {
token = doc.getTokenListForLine(curLine); token = doc.getTokenListForLine(curLine);
haveTokenList = true; haveTokenList = true;
} }
int offset = start + (i-segOffset); int offset = start + (i - segOffset);
token = RSyntaxUtilities.getTokenAtOffset(token, offset); token = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (token.getType()==Token.SEPARATOR) { if (Objects.requireNonNull(token).getType() == Token.SEPARATOR) {
if (numEmbedded==0) { if (numEmbedded == 0) {
if (textArea.isCodeFoldingEnabled() && if (textArea.isCodeFoldingEnabled() &&
textArea.getFoldManager().isLineHidden(curLine)) { textArea.getFoldManager().isLineHidden(curLine)) {
return input; // Match hidden in a fold return input; // Match hidden in a fold
@ -521,8 +524,9 @@ public class RSyntaxUtilities implements SwingConstants {
// Bail out if we've gone through all lines and // Bail out if we've gone through all lines and
// haven't found the match. // haven't found the match.
if (++curLine==lastLine) if (++curLine == lastLine) {
return input; return input;
}
// Otherwise, go through the next line. // Otherwise, go through the next line.
haveTokenList = false; haveTokenList = false;
@ -548,34 +552,33 @@ public class RSyntaxUtilities implements SwingConstants {
while (true) { while (true) {
doc.getText(start,end-start, charSegment); doc.getText(start, end - start, charSegment);
int segOffset = charSegment.offset; int segOffset = charSegment.offset;
int iStart = segOffset + charSegment.count - 1; int iStart = segOffset + charSegment.count - 1;
for (int i=iStart; i>=segOffset; i--) { for (int i = iStart; i >= segOffset; i--) {
char ch = charSegment.array[i]; char ch = charSegment.array[i];
if (ch==bracket) { if (ch == bracket) {
if (haveTokenList==false) { if (!haveTokenList) {
token = doc.getTokenListForLine(curLine); token = doc.getTokenListForLine(curLine);
haveTokenList = true; haveTokenList = true;
} }
int offset = start + (i-segOffset); int offset = start + (i - segOffset);
t2 = RSyntaxUtilities.getTokenAtOffset(token, offset); t2 = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (t2.getType()==Token.SEPARATOR) if (Objects.requireNonNull(t2).getType() == Token.SEPARATOR) {
numEmbedded++; numEmbedded++;
} }
} else if (ch == bracketMatch) {
else if (ch==bracketMatch) { if (!haveTokenList) {
if (haveTokenList==false) {
token = doc.getTokenListForLine(curLine); token = doc.getTokenListForLine(curLine);
haveTokenList = true; haveTokenList = true;
} }
int offset = start + (i-segOffset); int offset = start + (i - segOffset);
t2 = RSyntaxUtilities.getTokenAtOffset(token, offset); t2 = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (t2.getType()==Token.SEPARATOR) { if (Objects.requireNonNull(t2).getType() == Token.SEPARATOR) {
if (numEmbedded==0) { if (numEmbedded == 0) {
input.setLocation(caretPosition, offset); input.setLocation(caretPosition, offset);
return input; return input;
} }
@ -587,7 +590,7 @@ public class RSyntaxUtilities implements SwingConstants {
// Bail out if we've gone through all lines and // Bail out if we've gone through all lines and
// haven't found the match. // haven't found the match.
if (--curLine==-1) { if (--curLine == -1) {
return input; return input;
} }
@ -625,10 +628,10 @@ public class RSyntaxUtilities implements SwingConstants {
*/ */
public static final Token getNextImportantToken(Token t, public static final Token getNextImportantToken(Token t,
RSyntaxTextArea textArea, int line) { RSyntaxTextArea textArea, int line) {
while (t!=null && t.isPaintable() && t.isCommentOrWhitespace()) { while (t != null && t.isPaintable() && t.isCommentOrWhitespace()) {
t = t.getNextToken(); t = t.getNextToken();
} }
if ((t==null || !t.isPaintable()) && line<textArea.getLineCount()-1) { if ((t == null || !t.isPaintable()) && line < textArea.getLineCount() - 1) {
t = textArea.getTokenListForLine(++line); t = textArea.getTokenListForLine(++line);
return getNextImportantToken(t, textArea, line); return getNextImportantToken(t, textArea, line);
} }
@ -642,7 +645,7 @@ public class RSyntaxUtilities implements SwingConstants {
* Some views may not be visible, * Some views may not be visible,
* they might not be in the same order found in the model, or they just * 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.<p> * might not allow access to some of the locations in the model.<p>
* * <p>
* NOTE: You should only call this method if the passed-in * NOTE: You should only call this method if the passed-in
* <code>javax.swing.text.View</code> is an instance of * <code>javax.swing.text.View</code> is an instance of
* {@link TokenOrientedView} and <code>javax.swing.text.TabExpander</code>; * {@link TokenOrientedView} and <code>javax.swing.text.TabExpander</code>;
@ -661,8 +664,8 @@ public class RSyntaxUtilities implements SwingConstants {
* </ul> * </ul>
* @return the location within the model that best represents the next * @return the location within the model that best represents the next
* location visual position * location visual position
* @exception BadLocationException * @throws BadLocationException
* @exception IllegalArgumentException if <code>direction</code> * @throws IllegalArgumentException if <code>direction</code>
* doesn't have one of the legal values above * doesn't have one of the legal values above
*/ */
public static int getNextVisualPositionFrom(int pos, Position.Bias b, public static int getNextVisualPositionFrom(int pos, Position.Bias b,
@ -670,7 +673,7 @@ public class RSyntaxUtilities implements SwingConstants {
Position.Bias[] biasRet, View view) Position.Bias[] biasRet, View view)
throws BadLocationException { throws BadLocationException {
RSyntaxTextArea target = (RSyntaxTextArea)view.getContainer(); RSyntaxTextArea target = (RSyntaxTextArea) view.getContainer();
biasRet[0] = Position.Bias.Forward; biasRet[0] = Position.Bias.Forward;
// Do we want the "next position" above, below, to the left or right? // Do we want the "next position" above, below, to the left or right?
@ -688,37 +691,39 @@ public class RSyntaxUtilities implements SwingConstants {
// YECK! Ideally, the x location from the magic caret // YECK! Ideally, the x location from the magic caret
// position would be passed in. // position would be passed in.
Point mcp; Point mcp;
if (c != null) if (c != null) {
mcp = c.getMagicCaretPosition(); mcp = c.getMagicCaretPosition();
else } else {
mcp = null; mcp = null;
}
int x; int x;
if (mcp == null) { if (mcp == null) {
Rectangle loc = target.modelToView(pos); Rectangle loc = Objects.requireNonNull(target).modelToView(pos);
x = (loc == null) ? 0 : loc.x; x = (loc == null) ? 0 : loc.x;
} } else {
else {
x = mcp.x; x = mcp.x;
} }
if (direction == NORTH) if (direction == NORTH) {
pos = getPositionAbove(target,pos,x,(TabExpander)view); pos = getPositionAbove(target, pos, x, (TabExpander) view);
else } else {
pos = getPositionBelow(target,pos,x,(TabExpander)view); pos = getPositionBelow(target, pos, x, (TabExpander) view);
}
break; break;
case WEST: case WEST:
if(pos == -1) { if (pos == -1) {
pos = Math.max(0, view.getEndOffset() - 1); pos = Math.max(0, view.getEndOffset() - 1);
} } else {
else {
pos = Math.max(0, pos - 1); pos = Math.max(0, pos - 1);
if (target.isCodeFoldingEnabled()) { if (target.isCodeFoldingEnabled()) {
int last = target.getLineOfOffset(pos+1); int last = target.getLineOfOffset(pos + 1);
int current = target.getLineOfOffset(pos); int current = target.getLineOfOffset(pos);
if (last!=current) { // If moving up a line... if (last != current) { // If moving up a line...
FoldManager fm = target.getFoldManager(); FoldManager fm = target.getFoldManager();
if (fm.isLineHidden(current)) { if (fm.isLineHidden(current)) {
while (--current>0 && fm.isLineHidden(current)); while (--current > 0 && fm.isLineHidden(current)) {
;
}
pos = target.getLineEndOffset(current) - 1; pos = target.getLineEndOffset(current) - 1;
} }
} }
@ -727,21 +732,22 @@ public class RSyntaxUtilities implements SwingConstants {
break; break;
case EAST: case EAST:
if(pos == -1) { if (pos == -1) {
pos = view.getStartOffset(); pos = view.getStartOffset();
} } else {
else {
pos = Math.min(pos + 1, view.getDocument().getLength()); pos = Math.min(pos + 1, view.getDocument().getLength());
if (target.isCodeFoldingEnabled()) { if (target.isCodeFoldingEnabled()) {
int last = target.getLineOfOffset(pos-1); int last = target.getLineOfOffset(pos - 1);
int current = target.getLineOfOffset(pos); int current = target.getLineOfOffset(pos);
if (last!=current) { // If moving down a line... if (last != current) { // If moving down a line...
FoldManager fm = target.getFoldManager(); FoldManager fm = target.getFoldManager();
if (fm.isLineHidden(current)) { if (fm.isLineHidden(current)) {
int lineCount = target.getLineCount(); int lineCount = target.getLineCount();
while (++current<lineCount && fm.isLineHidden(current)); while (++current < lineCount && fm.isLineHidden(current)) {
pos = current==lineCount ? ;
target.getLineEndOffset(last)-1 : // Was the last visible line }
pos = current == lineCount ?
target.getLineEndOffset(last) - 1 : // Was the last visible line
target.getLineStartOffset(current); target.getLineStartOffset(current);
} }
} }
@ -770,23 +776,22 @@ public class RSyntaxUtilities implements SwingConstants {
* @param x the X coordinate >= 0 * @param x the X coordinate >= 0
* @return the position >= 0 if the request can be computed, otherwise * @return the position >= 0 if the request can be computed, otherwise
* a value of -1 will be returned. * a value of -1 will be returned.
* @exception BadLocationException if the offset is out of range * @throws BadLocationException if the offset is out of range
*/ */
public static final int getPositionAbove(RSyntaxTextArea c, int offs, public static final int getPositionAbove(RSyntaxTextArea c, int offs,
float x, TabExpander e) throws BadLocationException { float x, TabExpander e) throws BadLocationException {
TokenOrientedView tov = (TokenOrientedView)e; TokenOrientedView tov = (TokenOrientedView) e;
Token token = tov.getTokenListForPhysicalLineAbove(offs); Token token = tov.getTokenListForPhysicalLineAbove(offs);
if (token==null) if (token == null) {
return -1; return -1;
}
// A line containing only Token.NULL is an empty line. // A line containing only Token.NULL is an empty line.
else if (token.getType()==Token.NULL) { else if (token.getType() == Token.NULL) {
int line = c.getLineOfOffset(offs); // Sure to be >0 ?? int line = c.getLineOfOffset(offs); // Sure to be >0 ??
return c.getLineStartOffset(line-1); return c.getLineStartOffset(line - 1);
} } else {
else {
return token.getListOffset(c, e, 0, x); return token.getListOffset(c, e, 0, x);
} }
@ -804,26 +809,25 @@ public class RSyntaxUtilities implements SwingConstants {
* @param x the X coordinate >= 0 * @param x the X coordinate >= 0
* @return the position >= 0 if the request can be computed, otherwise * @return the position >= 0 if the request can be computed, otherwise
* a value of -1 will be returned. * a value of -1 will be returned.
* @exception BadLocationException if the offset is out of range * @throws BadLocationException if the offset is out of range
*/ */
public static final int getPositionBelow(RSyntaxTextArea c, int offs, public static final int getPositionBelow(RSyntaxTextArea c, int offs,
float x, TabExpander e) throws BadLocationException { float x, TabExpander e) throws BadLocationException {
TokenOrientedView tov = (TokenOrientedView)e; TokenOrientedView tov = (TokenOrientedView) e;
Token token = tov.getTokenListForPhysicalLineBelow(offs); Token token = tov.getTokenListForPhysicalLineBelow(offs);
if (token==null) if (token == null) {
return -1; return -1;
}
// A line containing only Token.NULL is an empty line. // A line containing only Token.NULL is an empty line.
else if (token.getType()==Token.NULL) { else if (token.getType() == Token.NULL) {
int line = c.getLineOfOffset(offs); // Sure to be > c.getLineCount()-1 ?? int line = c.getLineOfOffset(offs); // Sure to be > c.getLineCount()-1 ??
// return c.getLineStartOffset(line+1); // return c.getLineStartOffset(line+1);
FoldManager fm = c.getFoldManager(); FoldManager fm = c.getFoldManager();
line = fm.getVisibleLineBelow(line); line = fm.getVisibleLineBelow(line);
return c.getLineStartOffset(line); return c.getLineStartOffset(line);
} } else {
else {
return token.getListOffset(c, e, 0, x); return token.getListOffset(c, e, 0, x);
} }
@ -841,18 +845,18 @@ return c.getLineStartOffset(line);
* @see #getNextImportantToken(Token, RSyntaxTextArea, int) * @see #getNextImportantToken(Token, RSyntaxTextArea, int)
*/ */
public static final Token getPreviousImportantToken( public static final Token getPreviousImportantToken(
RSyntaxTextArea textArea, int line){ RSyntaxTextArea textArea, int line) {
if (line<0) { if (line < 0) {
return null; return null;
} }
Token t = textArea.getTokenListForLine(line); Token t = textArea.getTokenListForLine(line);
if (t!=null) { if (t != null) {
t = t.getLastNonCommentNonWhitespaceToken(); t = t.getLastNonCommentNonWhitespaceToken();
if (t!=null) { if (t != null) {
return t; return t;
} }
} }
return getPreviousImportantToken(textArea, line-1); return getPreviousImportantToken(textArea, line - 1);
} }
@ -868,10 +872,11 @@ return c.getLineStartOffset(line);
* none of the tokens are at that offset. * none of the tokens are at that offset.
*/ */
public static final Token getTokenAtOffset(Token tokenList, int offset) { public static final Token getTokenAtOffset(Token tokenList, int offset) {
for (Token t=tokenList; t!=null && t.isPaintable(); t=t.getNextToken()){ for (Token t = tokenList; t != null && t.isPaintable(); t = t.getNextToken()) {
if (t.containsPosition(offset)) if (t.containsPosition(offset)) {
return t; return t;
} }
}
return null; return null;
} }
@ -895,18 +900,20 @@ return c.getLineStartOffset(line);
return offs; return offs;
} }
String s = doc.getText(offs, lineEnd-offs-1); String s = doc.getText(offs, lineEnd - offs - 1);
if (s!=null && s.length()>0) { // Should always be true if (s != null && s.length() > 0) { // Should always be true
int i = 0; int i = 0;
int count = s.length(); int count = s.length();
char ch = s.charAt(i); char ch = s.charAt(i);
if (Character.isWhitespace(ch)) { if (Character.isWhitespace(ch)) {
while (i<count && Character.isWhitespace(s.charAt(i++))); while (i < count && Character.isWhitespace(s.charAt(i++))) {
;
} }
else if (Character.isLetterOrDigit(ch)) { } else if (Character.isLetterOrDigit(ch)) {
while (i<count && Character.isLetterOrDigit(s.charAt(i++))); while (i < count && Character.isLetterOrDigit(s.charAt(i++))) {
;
} }
else { } else {
i = 2; i = 2;
} }
offs += i - 1; offs += i - 1;
@ -935,23 +942,22 @@ return c.getLineStartOffset(line);
} }
int lineStart = line.getStartOffset(); int lineStart = line.getStartOffset();
if (offs==lineStart) { // Start of the line. if (offs == lineStart) { // Start of the line.
return offs; return offs;
} }
int endOffs = Math.min(offs+1, doc.getLength()); int endOffs = Math.min(offs + 1, doc.getLength());
String s = doc.getText(lineStart, endOffs-lineStart); String s = doc.getText(lineStart, endOffs - lineStart);
if(s != null && s.length() > 0) { if (s != null && s.length() > 0) {
int i = s.length() - 1; int i = s.length() - 1;
char ch = s.charAt(i); char ch = s.charAt(i);
if (Character.isWhitespace(ch)) { if (Character.isWhitespace(ch)) {
while (i>0 && Character.isWhitespace(s.charAt(i-1))) { while (i > 0 && Character.isWhitespace(s.charAt(i - 1))) {
i--; i--;
} }
offs = lineStart + i; offs = lineStart + i;
} } else if (Character.isLetterOrDigit(ch)) {
else if (Character.isLetterOrDigit(ch)) { while (i > 0 && Character.isLetterOrDigit(s.charAt(i - 1))) {
while (i>0 && Character.isLetterOrDigit(s.charAt(i-1))) {
i--; i--;
} }
offs = lineStart + i; offs = lineStart + i;
@ -968,7 +974,7 @@ return c.getLineStartOffset(line);
* Determines the width of the given token list taking tabs * Determines the width of the given token list taking tabs
* into consideration. This is implemented in a 1.1 style coordinate * into consideration. This is implemented in a 1.1 style coordinate
* system where ints are used and 72dpi is assumed.<p> * system where ints are used and 72dpi is assumed.<p>
* * <p>
* This method also assumes that the passed-in token list begins at * This method also assumes that the passed-in token list begins at
* x-pixel <code>0</code> in the view (for tab purposes). * x-pixel <code>0</code> in the view (for tab purposes).
* *
@ -1000,7 +1006,7 @@ return c.getLineStartOffset(line);
RSyntaxTextArea textArea, RSyntaxTextArea textArea,
TabExpander e, float x0) { TabExpander e, float x0) {
float width = x0; float width = x0;
for (Token t=tokenList; t!=null&&t.isPaintable(); t=t.getNextToken()) { for (Token t = tokenList; t != null && t.isPaintable(); t = t.getNextToken()) {
width += t.getWidth(textArea, e, width); width += t.getWidth(textArea, e, width);
} }
return width - x0; return width - x0;
@ -1029,12 +1035,12 @@ return c.getLineStartOffset(line);
RSyntaxTextArea textArea, TabExpander e, RSyntaxTextArea textArea, TabExpander e,
float x0, int upTo) { float x0, int upTo) {
float width = 0; float width = 0;
for (Token t=tokenList; t!=null&&t.isPaintable(); t=t.getNextToken()) { for (Token t = tokenList; t != null && t.isPaintable(); t = t.getNextToken()) {
if (t.containsPosition(upTo)) { if (t.containsPosition(upTo)) {
return width + t.getWidthUpTo(upTo-t.getOffset(), textArea, e, return width + t.getWidthUpTo(upTo - t.getOffset(), textArea, e,
x0+width); x0 + width);
} }
width += t.getWidth(textArea, e, x0+width); width += t.getWidth(textArea, e, x0 + width);
} }
return width; return width;
} }
@ -1052,7 +1058,7 @@ return c.getLineStartOffset(line);
// We need the first condition as it might be that ch>255, and thus // We need the first condition as it might be that ch>255, and thus
// not in our table. '}' is the highest-valued char in the bracket // not in our table. '}' is the highest-valued char in the bracket
// set. // set.
return ch<='}' && (dataTable[ch]&BRACKET_MASK)>0; return ch <= '}' && (dataTable[ch] & BRACKET_MASK) > 0;
} }
@ -1066,7 +1072,7 @@ return c.getLineStartOffset(line);
// We do it this way as we'd need to do two conditions anyway (first // We do it this way as we'd need to do two conditions anyway (first
// to check that ch<255 so it can index into our table, then whether // to check that ch<255 so it can index into our table, then whether
// that table position has the digit mask). // that table position has the digit mask).
return ch>='0' && ch<='9'; return ch >= '0' && ch <= '9';
} }
@ -1082,7 +1088,7 @@ return c.getLineStartOffset(line);
// We need the first condition as it could be that ch>255 (and thus // We need the first condition as it could be that ch>255 (and thus
// not a valid index into our table). 'f' is the highest-valued // not a valid index into our table). 'f' is the highest-valued
// char that is a valid hex character. // char that is a valid hex character.
return (ch<='f') && (dataTable[ch]&HEX_CHARACTER_MASK)>0; return (ch <= 'f') && (dataTable[ch] & HEX_CHARACTER_MASK) > 0;
} }
@ -1097,7 +1103,7 @@ return c.getLineStartOffset(line);
// We need the first condition as it could be that ch>255 (and thus // We need the first condition as it could be that ch>255 (and thus
// not a valid index into our table). '~' is the highest-valued // not a valid index into our table). '~' is the highest-valued
// char that is a valid Java operator. // char that is a valid Java operator.
return (ch<='~') && (dataTable[ch]&JAVA_OPERATOR_MASK)>0; return (ch <= '~') && (dataTable[ch] & JAVA_OPERATOR_MASK) > 0;
} }
@ -1110,7 +1116,7 @@ return c.getLineStartOffset(line);
public static final boolean isLetter(char ch) { public static final boolean isLetter(char ch) {
// We need the first condition as it could be that ch>255 (and thus // We need the first condition as it could be that ch>255 (and thus
// not a valid index into our table). // not a valid index into our table).
return (ch<='z') && (dataTable[ch]&LETTER_MASK)>0; return (ch <= 'z') && (dataTable[ch] & LETTER_MASK) > 0;
} }
@ -1123,7 +1129,7 @@ return c.getLineStartOffset(line);
public static final boolean isLetterOrDigit(char ch) { public static final boolean isLetterOrDigit(char ch) {
// We need the first condition as it could be that ch>255 (and thus // We need the first condition as it could be that ch>255 (and thus
// not a valid index into our table). // not a valid index into our table).
return (ch<='z') && (dataTable[ch]&LETTER_OR_DIGIT_MASK)>0; return (ch <= 'z') && (dataTable[ch] & LETTER_OR_DIGIT_MASK) > 0;
} }
@ -1137,7 +1143,7 @@ return c.getLineStartOffset(line);
* @see #getHyperlinkForeground() * @see #getHyperlinkForeground()
*/ */
public static final boolean isLightForeground(Color fg) { public static final boolean isLightForeground(Color fg) {
return fg.getRed()>0xa0 && fg.getGreen()>0xa0 && fg.getBlue()>0xa0; return fg.getRed() > 0xa0 && fg.getGreen() > 0xa0 && fg.getBlue() > 0xa0;
} }
@ -1153,7 +1159,7 @@ return c.getLineStartOffset(line);
// We do it this way as we'd need to do two conditions anyway (first // We do it this way as we'd need to do two conditions anyway (first
// to check that ch<255 so it can index into our table, then whether // to check that ch<255 so it can index into our table, then whether
// that table position has the whitespace mask). // that table position has the whitespace mask).
return ch==' ' || ch=='\t'; return ch == ' ' || ch == '\t';
} }
@ -1168,21 +1174,21 @@ return c.getLineStartOffset(line);
public static boolean regexCanFollowInJavaScript(Token t) { public static boolean regexCanFollowInJavaScript(Token t) {
char ch; char ch;
// We basically try to mimic Eclipse's JS editor's behavior here. // We basically try to mimic Eclipse's JS editor's behavior here.
return t==null || return t == null ||
//t.isOperator() || //t.isOperator() ||
(t.length()==1 && ( (t.length() == 1 && (
(ch=t.charAt(0))=='=' || (ch = t.charAt(0)) == '=' ||
ch=='(' || ch == '(' ||
ch==',' || ch == ',' ||
ch=='?' || ch == '?' ||
ch==':' || ch == ':' ||
ch=='[' || ch == '[' ||
ch=='!' || ch == '!' ||
ch=='&' ch == '&'
)) || )) ||
/* Operators "==", "===", "!=", "!==" */ /* Operators "==", "===", "!=", "!==" */
(t.getType()==Token.OPERATOR && (t.getType() == Token.OPERATOR &&
t.charAt(t.length()-1)=='=') || t.charAt(t.length() - 1) == '=') ||
t.is(Token.RESERVED_WORD_2, JS_KEYWORD_RETURN); t.is(Token.RESERVED_WORD_2, JS_KEYWORD_RETURN);
} }
@ -1203,8 +1209,9 @@ return c.getLineStartOffset(line);
// We do it this way as we'd need to do two conditions anyway (first // We do it this way as we'd need to do two conditions anyway (first
// to check that ch<255 so it can index into our table, then whether // to check that ch<255 so it can index into our table, then whether
// that table position has the upper-case mask). // that table position has the upper-case mask).
if (ch>='A' && ch<='Z') if (ch >= 'A' && ch <= 'Z') {
return (char)(ch | 0x20); return (char) (ch | 0x20);
}
return ch; return ch;
} }
@ -1231,17 +1238,18 @@ return c.getLineStartOffset(line);
private static final int getOSImpl() { private static final int getOSImpl() {
int os = OS_OTHER; int os = OS_OTHER;
String osName = System.getProperty("os.name"); String osName = System.getProperty("os.name");
if (osName!=null) { // Should always be true. if (osName != null) { // Should always be true.
osName = osName.toLowerCase(); osName = osName.toLowerCase();
if (osName.indexOf("windows") > -1) if (osName.contains("windows")) {
os = OS_WINDOWS; os = OS_WINDOWS;
else if (osName.indexOf("mac os x") > -1) } else if (osName.contains("mac os x")) {
os = OS_MAC_OSX; os = OS_MAC_OSX;
else if (osName.indexOf("linux") > -1) } else if (osName.contains("linux")) {
os = OS_LINUX; os = OS_LINUX;
else } else {
os = OS_OTHER; os = OS_OTHER;
} }
}
return os; return os;
} }
@ -1260,11 +1268,11 @@ return c.getLineStartOffset(line);
int flags = 0; int flags = 0;
if (!matchCase) { if (!matchCase) {
flags = Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE; flags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i=0; i<wildcard.length(); i++) { for (int i = 0; i < wildcard.length(); i++) {
char ch = wildcard.charAt(i); char ch = wildcard.charAt(i);
switch (ch) { switch (ch) {
case '*': case '*':
@ -1274,18 +1282,23 @@ return c.getLineStartOffset(line);
sb.append('.'); sb.append('.');
break; break;
case '^': case '^':
if (i>0 || escapeStartChar) { if (i > 0 || escapeStartChar) {
sb.append('\\'); sb.append('\\');
} }
sb.append('^'); sb.append('^');
break; break;
case '\\': case '\\':
case '.': case '|': case '.':
case '+': case '-': case '|':
case '+':
case '-':
case '$': case '$':
case '[': case ']': case '[':
case '{': case '}': case ']':
case '(': case ')': case '{':
case '}':
case '(':
case ')':
sb.append('\\').append(ch); sb.append('\\').append(ch);
break; break;
default: default:

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

@ -1351,6 +1351,11 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
// Start at alloc.x since this chunk starts // Start at alloc.x since this chunk starts
// at the beginning of a physical line. // at the beginning of a physical line.
if (tlist == null) {
p0 = (p == p0) ? p1 : p;
alloc.y += alloc.height;
continue;
}
int n = tlist.getListOffset(textArea, int n = tlist.getListOffset(textArea,
WrappedSyntaxView.this, WrappedSyntaxView.this,
alloc.x, x); alloc.x, x);

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.RSyntaxDocument;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.Token; 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) { public ParseResult parse(RSyntaxDocument doc, String style) {
Element root = doc.getDefaultRootElement(); Element root = doc.getDefaultRootElement();
@ -101,6 +103,9 @@ public class TaskTagParser extends AbstractParser {
} }
if (start>-1) { if (start>-1) {
if (StringUtils.isEmpty(text)) {
continue;
}
text = text.substring(start); text = text.substring(start);
// TODO: Strip off end of MLC's if they're there. // TODO: Strip off end of MLC's if they're there.
int len = text.length(); 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); int width = metrics.stringWidth(number);
g.drawString(number, rhs-width,y); g.drawString(number, rhs-width,y);
y += cellHeight; y += cellHeight;
if (fm == null) {
line++;
continue;
}
Fold fold = fm.getFoldForLine(line-1); Fold fold = fm.getFoldForLine(line-1);
// Skip to next line to paint, taking extra care for lines with // Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {" // block ends and begins together, e.g. "} else {"
@ -371,6 +375,10 @@ public class LineNumberList extends AbstractGutterComponent
String number = Integer.toString(line + getLineNumberingStartIndex() - 1); String number = Integer.toString(line + getLineNumberingStartIndex() - 1);
g.drawString(number, RHS_BORDER_WIDTH, y); g.drawString(number, RHS_BORDER_WIDTH, y);
y += cellHeight; y += cellHeight;
if (fm == null) {
line++;
continue;
}
Fold fold = fm.getFoldForLine(line-1); Fold fold = fm.getFoldForLine(line-1);
// Skip to next line to paint, taking extra care for lines with // Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {" // 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(); parent = parent.getParent();
} }
KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE"); KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE");
if (inputMap == null) {
return;
}
inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction); 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) { } catch (BadLocationException bl) {
} }
}else if (textArea == null) {
throw new IllegalArgumentException("RTextArea can not be null!");
} }
if (beep) 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; package com.fr.design.gui.syntax.ui.rtextarea;
import com.fr.log.FineLoggerFactory;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image; import java.awt.Image;
import java.awt.image.VolatileImage; import java.awt.image.VolatileImage;
@ -95,9 +97,9 @@ public class VolatileImageBackgroundPainterStrategy
try { try {
tracker.waitForID(1); tracker.waitForID(1);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); FineLoggerFactory.getLogger().error(e.getMessage(),e);
bgImage = null; bgImage = null;
return; Thread.currentThread().interrupt();
} finally { } finally {
tracker.removeImage(i, 1); tracker.removeImage(i, 1);
} }
@ -106,9 +108,9 @@ public class VolatileImageBackgroundPainterStrategy
try { try {
tracker.waitForID(0); tracker.waitForID(0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); FineLoggerFactory.getLogger().error(e.getMessage(),e);
bgImage = null; bgImage = null;
return; Thread.currentThread().interrupt();
} finally { } finally {
tracker.removeImage(bgImage, 0); 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) { public void paintIcon(Component c, Graphics g, int x, int y) {
if (mainImage != null) { if (mainImage != null) {
g.drawImage(mainImage, x, y, c); g.drawImage(mainImage, x, y, c);
@ -48,6 +49,7 @@ public class LockIcon extends ImageIcon {
* *
* @param image the image * @param image the image
*/ */
@Override
protected void loadImage(Image image) { protected void loadImage(Image image) {
synchronized (tracker) { synchronized (tracker) {
tracker.addImage(image, 0); tracker.addImage(image, 0);
@ -55,6 +57,7 @@ public class LockIcon extends ImageIcon {
tracker.waitForID(0, 0); tracker.waitForID(0, 0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} }
loadStatus = tracker.statusID(0, false); 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> * @return the <code>Image</code> object for this <code>ImageIcon</code>
*/ */
@Override
public Image getImage() { public Image getImage() {
return mainImage; return mainImage;
} }
@ -85,6 +89,7 @@ public class LockIcon extends ImageIcon {
* *
* @return the width in pixels of this icon * @return the width in pixels of this icon
*/ */
@Override
public int getIconWidth() { public int getIconWidth() {
return width; return width;
} }
@ -94,6 +99,7 @@ public class LockIcon extends ImageIcon {
* *
* @return the height in pixels of this icon * @return the height in pixels of this icon
*/ */
@Override
public int getIconHeight() { public int getIconHeight() {
return height; 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); tracker.waitForID(0, 0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} }
tracker.statusID(0, false); tracker.statusID(0, false);

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

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

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()); FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
Thread.currentThread().interrupt();
} }
dialogDownPane.remove(cancelButton); dialogDownPane.remove(cancelButton);
dialogDownPane.revalidate(); dialogDownPane.revalidate();

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

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

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.translate(moveLeft, moveTop);
g2d.setStroke(new BasicStroke(1)); 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()) { for (String key : resultAreaShape.keySet()) {
GeneralPath selectShape = getSelectedNodePath(key); GeneralPath selectShape = getSelectedNodePath(key);

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)); 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); contentsPane = new NormalChartDataPane(listener, ChartDataPane.this);
} else if (collection.getSelectedChart().getPlot() instanceof MapPlot) { } else if (collection.getSelectedChart().getPlot() instanceof MapPlot) {
contentsPane = new MapDataPane(listener); contentsPane = new MapDataPane(listener);

2
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).setStacked(true);
((Area3DPlot)plot).getyAxis().setPercentage(true); ((Area3DPlot)plot).getyAxis().setPercentage(true);
} }
if(plot != null) {
createAreaCondition(plot); createAreaCondition(plot);
}
return plot; return plot;
} }

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

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

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

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

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

@ -66,11 +66,13 @@ public class MeterPlotPane extends AbstractDeprecatedChartTypePane {
} }
Plot cloned = null; Plot cloned = null;
if(newPlot != null) {
try { try {
cloned = (Plot)newPlot.clone(); cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart"); FineLoggerFactory.getLogger().error("Error In ColumnChart");
} }
}
return cloned; return cloned;
} }

2
designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java

@ -68,11 +68,13 @@ public class VanChartAreaPlotPane extends AbstractVanChartTypePane {
} }
} }
Plot cloned = null; Plot cloned = null;
if(newPlot != null) {
try { try {
cloned = (Plot) newPlot.clone(); cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In AreaChart"); FineLoggerFactory.getLogger().error("Error In AreaChart");
} }
}
return cloned; return cloned;
} }

1
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -168,6 +168,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
break; break;
case "allowFullCheckBox": case "allowFullCheckBox":
((ElementCaseEditor) xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected()); ((ElementCaseEditor) xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected());
break;
case "functionalWhenUnactivatedCheckBox": case "functionalWhenUnactivatedCheckBox":
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected()); ((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
} }

Loading…
Cancel
Save