Browse Source

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

# Conflicts:
#	designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
research/11.0
vito 5 years ago
parent
commit
c72bcbad55
  1. 2
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  2. 26
      designer-base/src/main/java/com/fr/design/beans/BasicBeanPane.java
  3. 6
      designer-base/src/main/java/com/fr/design/beans/FurtherBasicBeanPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/condition/ConditionAttrSingleConditionPane.java
  5. 2
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  6. 6
      designer-base/src/main/java/com/fr/design/dialog/BasicDialog.java
  7. 17
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  8. 3
      designer-base/src/main/java/com/fr/design/dialog/DialogActionAdapter.java
  9. 7
      designer-base/src/main/java/com/fr/design/dialog/DialogActionListener.java
  10. 8
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  11. 31
      designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java
  12. 31
      designer-base/src/main/java/com/fr/design/gui/itable/AbstractPropertyTable.java
  13. 2
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  14. 3
      designer-base/src/main/java/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
  15. 1
      designer-base/src/main/java/com/fr/design/gui/style/NumberDragBar.java
  16. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxDocument.java
  17. 404
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java
  18. 369
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  19. 229
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  20. 38
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  21. 5
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/parser/TaskTagParser.java
  22. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/LineNumberList.java
  23. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextArea.java
  24. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java
  25. 10
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/VolatileImageBackgroundPainterStrategy.java
  26. 6
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  27. 1
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  28. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  29. 23
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  30. 7
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsLabel.java
  31. 5
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  32. 1
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  33. 1
      designer-base/src/main/java/com/fr/design/update/actions/FileDownloader.java
  34. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  35. 1
      designer-base/src/main/java/com/fr/design/utils/DrawRoutines.java
  36. 1
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  37. 16
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  38. 6
      designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java
  39. 9
      designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java
  40. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java
  41. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  42. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java
  43. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java
  44. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java
  45. 2
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java
  46. 5
      designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java
  47. 5
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java
  48. 5
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java
  49. 2
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  50. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  51. 6
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  52. 5
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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;
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.Container;
import java.awt.Point;
@ -16,23 +34,9 @@ import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Toolkit;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;
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.
*/
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.
@ -146,10 +150,10 @@ public class RSyntaxUtilities implements SwingConstants {
public static final String escapeForHtml(String s,
String newlineReplacement, boolean inPreBlock) {
if (s==null) {
if (s == null) {
return null;
}
if (newlineReplacement==null) {
if (newlineReplacement == null) {
newlineReplacement = "";
}
final String tabString = " ";
@ -157,14 +161,13 @@ public class RSyntaxUtilities implements SwingConstants {
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);
switch (ch) {
case ' ':
if (inPreBlock || !lastWasSpace) {
sb.append(' ');
}
else {
} else {
sb.append("&nbsp;");
}
lastWasSpace = true;
@ -208,8 +211,8 @@ public class RSyntaxUtilities implements SwingConstants {
* @return The rendering hints, or <code>null</code> if they cannot be
* determined.
*/
public static Map<?,?> getDesktopAntiAliasHints() {
return (Map<?,?>)Toolkit.getDefaultToolkit().
public static Map<?, ?> getDesktopAntiAliasHints() {
return (Map<?, ?>) Toolkit.getDefaultToolkit().
getDesktopProperty("awt.font.desktophints");
}
@ -223,7 +226,7 @@ public class RSyntaxUtilities implements SwingConstants {
public static Color getFoldedLineBottomColor(RSyntaxTextArea textArea) {
Color color = Color.gray;
Gutter gutter = RSyntaxUtilities.getGutter(textArea);
if (gutter!=null) {
if (gutter != null) {
color = gutter.getFoldIndicatorForeground();
}
return color;
@ -245,7 +248,7 @@ public class RSyntaxUtilities implements SwingConstants {
if (parent instanceof JViewport) {
parent = parent.getParent();
if (parent instanceof RTextScrollPane) {
RTextScrollPane sp = (RTextScrollPane)parent;
RTextScrollPane sp = (RTextScrollPane) parent;
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 (!),
// but you never know what crazy LaFs there are...
Color fg = UIManager.getColor("Label.foreground");
if (fg==null) {
if (fg == null) {
fg = new JLabel().getForeground();
}
@ -286,7 +289,7 @@ public class RSyntaxUtilities implements SwingConstants {
public static String getLeadingWhitespace(String text) {
int count = 0;
int len = text.length();
while (count<len && RSyntaxUtilities.isWhitespace(text.charAt(count))) {
while (count < len && RSyntaxUtilities.isWhitespace(text.charAt(count))) {
count++;
}
return text.substring(0, count);
@ -310,7 +313,7 @@ public class RSyntaxUtilities implements SwingConstants {
Element elem = root.getElement(line);
int startOffs = elem.getStartOffset();
int endOffs = elem.getEndOffset() - 1;
String text = doc.getText(startOffs, endOffs-startOffs);
String text = doc.getText(startOffs, endOffs - startOffs);
return getLeadingWhitespace(text);
}
@ -319,7 +322,7 @@ public class RSyntaxUtilities implements SwingConstants {
Element map = d.getDefaultRootElement();
int index = map.getElementIndex(offs);
Element elem = map.getElement(index);
if ((offs>=elem.getStartOffset()) && (offs<elem.getEndOffset())) {
if ((offs >= elem.getStartOffset()) && (offs < elem.getEndOffset())) {
return elem;
}
return null;
@ -358,13 +361,14 @@ public class RSyntaxUtilities implements SwingConstants {
int x0)
throws BadLocationException {
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
// Ensure p0 and p1 are valid document positions.
if (p0<0)
if (p0 < 0) {
throw new BadLocationException("Invalid document position", p0);
else if (p1>doc.getLength())
} else if (p1 > doc.getLength()) {
throw new BadLocationException("Invalid document position", p1);
}
// Ensure p0 and p1 are in the same line, and get the start/end
// 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
// or the last position on the previous one.
// 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 " +
"same line (" + p0 + ", " + p1 + ").");
}
// Get the token list.
Token t = doc.getTokenListForLine(lineNum);
@ -410,7 +415,7 @@ public class RSyntaxUtilities implements SwingConstants {
public static Point getMatchingBracketPosition(RSyntaxTextArea textArea,
Point input) {
if (input==null) {
if (input == null) {
input = new Point();
}
input.setLocation(-1, -1);
@ -419,25 +424,25 @@ public class RSyntaxUtilities implements SwingConstants {
// Actually position just BEFORE caret.
int caretPosition = textArea.getCaretPosition() - 1;
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
char bracket = 0;
// If the caret was at offset 0, we can't check "to its left."
if (caretPosition>=0) {
if (caretPosition >= 0) {
bracket = doc.charAt(caretPosition);
}
// Try to match a bracket "to the right" of the caret if one
// was not found on the left.
int index = BRACKETS.indexOf(bracket);
if (index==-1 && caretPosition<doc.getLength()-1) {
if (index == -1 && caretPosition < doc.getLength() - 1) {
bracket = doc.charAt(++caretPosition);
}
// First, see if the char was a bracket (one of "{[()]}").
if (index==-1) {
if (index == -1) {
index = BRACKETS.indexOf(bracket);
if (index==-1) {
if (index == -1) {
return input;
}
}
@ -455,14 +460,13 @@ public class RSyntaxUtilities implements SwingConstants {
Token token = doc.getTokenListForLine(curLine);
token = RSyntaxUtilities.getTokenAtOffset(token, caretPosition);
// All brackets are always returned as "separators."
if (token.getType()!=Token.SEPARATOR) {
if (Objects.requireNonNull(token).getType() != Token.SEPARATOR) {
return input;
}
if (index<3) { // One of "{[("
if (index < 3) { // One of "{[("
goForward = true;
bracketMatch = BRACKETS.charAt(index + 3);
}
else { // One of ")]}"
} else { // One of ")]}"
goForward = false;
bracketMatch = BRACKETS.charAt(index - 3);
}
@ -479,33 +483,32 @@ public class RSyntaxUtilities implements SwingConstants {
while (true) {
doc.getText(start,end-start, charSegment);
doc.getText(start, end - start, charSegment);
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];
if (ch==bracket) {
if (haveTokenList==false) {
if (ch == bracket) {
if (!haveTokenList) {
token = doc.getTokenListForLine(curLine);
haveTokenList = true;
}
int offset = start + (i-segOffset);
int offset = start + (i - segOffset);
token = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (token.getType()==Token.SEPARATOR)
if (Objects.requireNonNull(token).getType() == Token.SEPARATOR) {
numEmbedded++;
}
else if (ch==bracketMatch) {
if (haveTokenList==false) {
} else if (ch == bracketMatch) {
if (!haveTokenList) {
token = doc.getTokenListForLine(curLine);
haveTokenList = true;
}
int offset = start + (i-segOffset);
int offset = start + (i - segOffset);
token = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (token.getType()==Token.SEPARATOR) {
if (numEmbedded==0) {
if (Objects.requireNonNull(token).getType() == Token.SEPARATOR) {
if (numEmbedded == 0) {
if (textArea.isCodeFoldingEnabled() &&
textArea.getFoldManager().isLineHidden(curLine)) {
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
// haven't found the match.
if (++curLine==lastLine)
if (++curLine == lastLine) {
return input;
}
// Otherwise, go through the next line.
haveTokenList = false;
@ -548,34 +552,33 @@ public class RSyntaxUtilities implements SwingConstants {
while (true) {
doc.getText(start,end-start, charSegment);
doc.getText(start, end - start, charSegment);
int segOffset = charSegment.offset;
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];
if (ch==bracket) {
if (haveTokenList==false) {
if (ch == bracket) {
if (!haveTokenList) {
token = doc.getTokenListForLine(curLine);
haveTokenList = true;
}
int offset = start + (i-segOffset);
int offset = start + (i - segOffset);
t2 = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (t2.getType()==Token.SEPARATOR)
if (Objects.requireNonNull(t2).getType() == Token.SEPARATOR) {
numEmbedded++;
}
else if (ch==bracketMatch) {
if (haveTokenList==false) {
} else if (ch == bracketMatch) {
if (!haveTokenList) {
token = doc.getTokenListForLine(curLine);
haveTokenList = true;
}
int offset = start + (i-segOffset);
int offset = start + (i - segOffset);
t2 = RSyntaxUtilities.getTokenAtOffset(token, offset);
if (t2.getType()==Token.SEPARATOR) {
if (numEmbedded==0) {
if (Objects.requireNonNull(t2).getType() == Token.SEPARATOR) {
if (numEmbedded == 0) {
input.setLocation(caretPosition, offset);
return input;
}
@ -587,7 +590,7 @@ public class RSyntaxUtilities implements SwingConstants {
// Bail out if we've gone through all lines and
// haven't found the match.
if (--curLine==-1) {
if (--curLine == -1) {
return input;
}
@ -625,10 +628,10 @@ public class RSyntaxUtilities implements SwingConstants {
*/
public static final Token getNextImportantToken(Token t,
RSyntaxTextArea textArea, int line) {
while (t!=null && t.isPaintable() && t.isCommentOrWhitespace()) {
while (t != null && t.isPaintable() && t.isCommentOrWhitespace()) {
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);
return getNextImportantToken(t, textArea, line);
}
@ -642,7 +645,7 @@ public class RSyntaxUtilities implements SwingConstants {
* Some views may not be visible,
* 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>
*
* <p>
* NOTE: You should only call this method if the passed-in
* <code>javax.swing.text.View</code> is an instance of
* {@link TokenOrientedView} and <code>javax.swing.text.TabExpander</code>;
@ -661,8 +664,8 @@ public class RSyntaxUtilities implements SwingConstants {
* </ul>
* @return the location within the model that best represents the next
* location visual position
* @exception BadLocationException
* @exception IllegalArgumentException if <code>direction</code>
* @throws BadLocationException
* @throws IllegalArgumentException if <code>direction</code>
* doesn't have one of the legal values above
*/
public static int getNextVisualPositionFrom(int pos, Position.Bias b,
@ -670,7 +673,7 @@ public class RSyntaxUtilities implements SwingConstants {
Position.Bias[] biasRet, View view)
throws BadLocationException {
RSyntaxTextArea target = (RSyntaxTextArea)view.getContainer();
RSyntaxTextArea target = (RSyntaxTextArea) view.getContainer();
biasRet[0] = Position.Bias.Forward;
// 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
// position would be passed in.
Point mcp;
if (c != null)
if (c != null) {
mcp = c.getMagicCaretPosition();
else
} else {
mcp = null;
}
int x;
if (mcp == null) {
Rectangle loc = target.modelToView(pos);
Rectangle loc = Objects.requireNonNull(target).modelToView(pos);
x = (loc == null) ? 0 : loc.x;
}
else {
} else {
x = mcp.x;
}
if (direction == NORTH)
pos = getPositionAbove(target,pos,x,(TabExpander)view);
else
pos = getPositionBelow(target,pos,x,(TabExpander)view);
if (direction == NORTH) {
pos = getPositionAbove(target, pos, x, (TabExpander) view);
} else {
pos = getPositionBelow(target, pos, x, (TabExpander) view);
}
break;
case WEST:
if(pos == -1) {
if (pos == -1) {
pos = Math.max(0, view.getEndOffset() - 1);
}
else {
} else {
pos = Math.max(0, pos - 1);
if (target.isCodeFoldingEnabled()) {
int last = target.getLineOfOffset(pos+1);
int last = target.getLineOfOffset(pos + 1);
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();
if (fm.isLineHidden(current)) {
while (--current>0 && fm.isLineHidden(current));
while (--current > 0 && fm.isLineHidden(current)) {
;
}
pos = target.getLineEndOffset(current) - 1;
}
}
@ -727,21 +732,22 @@ public class RSyntaxUtilities implements SwingConstants {
break;
case EAST:
if(pos == -1) {
if (pos == -1) {
pos = view.getStartOffset();
}
else {
} else {
pos = Math.min(pos + 1, view.getDocument().getLength());
if (target.isCodeFoldingEnabled()) {
int last = target.getLineOfOffset(pos-1);
int last = target.getLineOfOffset(pos - 1);
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();
if (fm.isLineHidden(current)) {
int lineCount = target.getLineCount();
while (++current<lineCount && fm.isLineHidden(current));
pos = current==lineCount ?
target.getLineEndOffset(last)-1 : // Was the last visible line
while (++current < lineCount && fm.isLineHidden(current)) {
;
}
pos = current == lineCount ?
target.getLineEndOffset(last) - 1 : // Was the last visible line
target.getLineStartOffset(current);
}
}
@ -770,23 +776,22 @@ public class RSyntaxUtilities implements SwingConstants {
* @param x the X coordinate >= 0
* @return the position >= 0 if the request can be computed, otherwise
* 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,
float x, TabExpander e) throws BadLocationException {
TokenOrientedView tov = (TokenOrientedView)e;
TokenOrientedView tov = (TokenOrientedView) e;
Token token = tov.getTokenListForPhysicalLineAbove(offs);
if (token==null)
if (token == null) {
return -1;
}
// 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 ??
return c.getLineStartOffset(line-1);
}
else {
return c.getLineStartOffset(line - 1);
} else {
return token.getListOffset(c, e, 0, x);
}
@ -804,26 +809,25 @@ public class RSyntaxUtilities implements SwingConstants {
* @param x the X coordinate >= 0
* @return the position >= 0 if the request can be computed, otherwise
* 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,
float x, TabExpander e) throws BadLocationException {
TokenOrientedView tov = (TokenOrientedView)e;
TokenOrientedView tov = (TokenOrientedView) e;
Token token = tov.getTokenListForPhysicalLineBelow(offs);
if (token==null)
if (token == null) {
return -1;
}
// 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 ??
// return c.getLineStartOffset(line+1);
FoldManager fm = c.getFoldManager();
line = fm.getVisibleLineBelow(line);
return c.getLineStartOffset(line);
}
else {
FoldManager fm = c.getFoldManager();
line = fm.getVisibleLineBelow(line);
return c.getLineStartOffset(line);
} else {
return token.getListOffset(c, e, 0, x);
}
@ -841,18 +845,18 @@ return c.getLineStartOffset(line);
* @see #getNextImportantToken(Token, RSyntaxTextArea, int)
*/
public static final Token getPreviousImportantToken(
RSyntaxTextArea textArea, int line){
if (line<0) {
RSyntaxTextArea textArea, int line) {
if (line < 0) {
return null;
}
Token t = textArea.getTokenListForLine(line);
if (t!=null) {
if (t != null) {
t = t.getLastNonCommentNonWhitespaceToken();
if (t!=null) {
if (t != null) {
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.
*/
public static final Token getTokenAtOffset(Token tokenList, int offset) {
for (Token t=tokenList; t!=null && t.isPaintable(); t=t.getNextToken()){
if (t.containsPosition(offset))
for (Token t = tokenList; t != null && t.isPaintable(); t = t.getNextToken()) {
if (t.containsPosition(offset)) {
return t;
}
}
return null;
}
@ -895,18 +900,20 @@ return c.getLineStartOffset(line);
return offs;
}
String s = doc.getText(offs, lineEnd-offs-1);
if (s!=null && s.length()>0) { // Should always be true
String s = doc.getText(offs, lineEnd - offs - 1);
if (s != null && s.length() > 0) { // Should always be true
int i = 0;
int count = s.length();
char ch = s.charAt(i);
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)) {
while (i<count && Character.isLetterOrDigit(s.charAt(i++)));
} else if (Character.isLetterOrDigit(ch)) {
while (i < count && Character.isLetterOrDigit(s.charAt(i++))) {
;
}
else {
} else {
i = 2;
}
offs += i - 1;
@ -935,23 +942,22 @@ return c.getLineStartOffset(line);
}
int lineStart = line.getStartOffset();
if (offs==lineStart) { // Start of the line.
if (offs == lineStart) { // Start of the line.
return offs;
}
int endOffs = Math.min(offs+1, doc.getLength());
String s = doc.getText(lineStart, endOffs-lineStart);
if(s != null && s.length() > 0) {
int endOffs = Math.min(offs + 1, doc.getLength());
String s = doc.getText(lineStart, endOffs - lineStart);
if (s != null && s.length() > 0) {
int i = s.length() - 1;
char ch = s.charAt(i);
if (Character.isWhitespace(ch)) {
while (i>0 && Character.isWhitespace(s.charAt(i-1))) {
while (i > 0 && Character.isWhitespace(s.charAt(i - 1))) {
i--;
}
offs = lineStart + i;
}
else if (Character.isLetterOrDigit(ch)) {
while (i>0 && Character.isLetterOrDigit(s.charAt(i-1))) {
} else if (Character.isLetterOrDigit(ch)) {
while (i > 0 && Character.isLetterOrDigit(s.charAt(i - 1))) {
i--;
}
offs = lineStart + i;
@ -968,7 +974,7 @@ return c.getLineStartOffset(line);
* Determines the width of the given token list taking tabs
* into consideration. This is implemented in a 1.1 style coordinate
* system where ints are used and 72dpi is assumed.<p>
*
* <p>
* This method also assumes that the passed-in token list begins at
* x-pixel <code>0</code> in the view (for tab purposes).
*
@ -1000,7 +1006,7 @@ return c.getLineStartOffset(line);
RSyntaxTextArea textArea,
TabExpander e, float 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);
}
return width - x0;
@ -1029,12 +1035,12 @@ return c.getLineStartOffset(line);
RSyntaxTextArea textArea, TabExpander e,
float x0, int upTo) {
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)) {
return width + t.getWidthUpTo(upTo-t.getOffset(), textArea, e,
x0+width);
return width + t.getWidthUpTo(upTo - t.getOffset(), textArea, e,
x0 + width);
}
width += t.getWidth(textArea, e, x0+width);
width += t.getWidth(textArea, e, x0 + 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
// not in our table. '}' is the highest-valued char in the bracket
// 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
// to check that ch<255 so it can index into our table, then whether
// 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
// not a valid index into our table). 'f' is the highest-valued
// 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
// not a valid index into our table). '~' is the highest-valued
// 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) {
// We need the first condition as it could be that ch>255 (and thus
// 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) {
// We need the first condition as it could be that ch>255 (and thus
// 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()
*/
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
// to check that ch<255 so it can index into our table, then whether
// 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) {
char ch;
// We basically try to mimic Eclipse's JS editor's behavior here.
return t==null ||
return t == null ||
//t.isOperator() ||
(t.length()==1 && (
(ch=t.charAt(0))=='=' ||
ch=='(' ||
ch==',' ||
ch=='?' ||
ch==':' ||
ch=='[' ||
ch=='!' ||
ch=='&'
(t.length() == 1 && (
(ch = t.charAt(0)) == '=' ||
ch == '(' ||
ch == ',' ||
ch == '?' ||
ch == ':' ||
ch == '[' ||
ch == '!' ||
ch == '&'
)) ||
/* Operators "==", "===", "!=", "!==" */
(t.getType()==Token.OPERATOR &&
t.charAt(t.length()-1)=='=') ||
(t.getType() == Token.OPERATOR &&
t.charAt(t.length() - 1) == '=') ||
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
// to check that ch<255 so it can index into our table, then whether
// that table position has the upper-case mask).
if (ch>='A' && ch<='Z')
return (char)(ch | 0x20);
if (ch >= 'A' && ch <= 'Z') {
return (char) (ch | 0x20);
}
return ch;
}
@ -1231,17 +1238,18 @@ return c.getLineStartOffset(line);
private static final int getOSImpl() {
int os = OS_OTHER;
String osName = System.getProperty("os.name");
if (osName!=null) { // Should always be true.
if (osName != null) { // Should always be true.
osName = osName.toLowerCase();
if (osName.indexOf("windows") > -1)
if (osName.contains("windows")) {
os = OS_WINDOWS;
else if (osName.indexOf("mac os x") > -1)
} else if (osName.contains("mac os x")) {
os = OS_MAC_OSX;
else if (osName.indexOf("linux") > -1)
} else if (osName.contains("linux")) {
os = OS_LINUX;
else
} else {
os = OS_OTHER;
}
}
return os;
}
@ -1260,11 +1268,11 @@ return c.getLineStartOffset(line);
int flags = 0;
if (!matchCase) {
flags = Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE;
flags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
}
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);
switch (ch) {
case '*':
@ -1274,18 +1282,23 @@ return c.getLineStartOffset(line);
sb.append('.');
break;
case '^':
if (i>0 || escapeStartChar) {
if (i > 0 || escapeStartChar) {
sb.append('\\');
}
sb.append('^');
break;
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);
break;
default:

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

@ -9,24 +9,37 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.*;
import javax.swing.event.*;
import javax.swing.text.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
/**
* The <code>javax.swing.text.View</code> object used by {@link RSyntaxTextArea}
* when word wrap is disabled. It implements syntax highlighting for
* programming languages using the colors and font styles specified by the
* <code>RSyntaxTextArea</code>.<p>
*
* <p>
* You don't really have to do anything to use this class, as
* {@link RSyntaxTextAreaUI} automatically sets the text area's view to be
* an instance of this class if word wrap is disabled.<p>
*
* <p>
* The tokens that specify how to paint the syntax-highlighted text are gleaned
* from the text area's {@link RSyntaxDocument}.
*
@ -105,7 +118,7 @@ public class SyntaxView extends View implements TabExpander,
tabSize = getTabSize() * metrics.charWidth(' ');
Element lines = getElement();
int n = lines.getElementCount();
for (int i=0; i<n; i++) {
for (int i = 0; i < n; i++) {
Element line = lines.getElement(i);
float w = getLineWidth(i);
if (w > longLineWidth) {
@ -149,8 +162,7 @@ public class SyntaxView extends View implements TabExpander,
if ((area0 != null) && (area1 != null)) {
Rectangle dmg = area0.union(area1); // damage.
host.repaint(dmg.x, dmg.y, dmg.width, dmg.height);
}
else
} else
host.repaint();
}
}
@ -174,8 +186,8 @@ public class SyntaxView extends View implements TabExpander,
float nextX = x; // The x-value at the end of our text.
while (token!=null && token.isPaintable() && nextX<clipEnd) {
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
while (token != null && token.isPaintable() && nextX < clipEnd) {
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
token = token.getNextToken();
}
@ -212,15 +224,15 @@ public class SyntaxView extends View implements TabExpander,
float nextX = x; // The x-value at the end of our text.
while (token!=null && token.isPaintable() && nextX<clipEnd) {
while (token != null && token.isPaintable() && nextX < clipEnd) {
// Selection starts in this token
if (token.containsPosition(selStart)) {
if (selStart>token.getOffset()) {
if (selStart > token.getOffset()) {
tempToken.copyFrom(token);
tempToken.textCount = selStart - tempToken.getOffset();
nextX = painter.paint(tempToken,g,nextX,y,host, this, clipStart);
nextX = painter.paint(tempToken, g, nextX, y, host, this, clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(selStart);
// Clone required since token and tempToken must be
@ -229,20 +241,19 @@ public class SyntaxView extends View implements TabExpander,
}
int tokenLen = token.length();
int selCount = Math.min(tokenLen, selEnd-token.getOffset());
if (selCount==tokenLen) {
nextX = painter.paintSelected(token, g, nextX,y, host,
int selCount = Math.min(tokenLen, selEnd - token.getOffset());
if (selCount == tokenLen) {
nextX = painter.paintSelected(token, g, nextX, y, host,
this, clipStart);
}
else {
} else {
tempToken.copyFrom(token);
tempToken.textCount = selCount;
nextX = painter.paintSelected(tempToken, g, nextX,y, host,
nextX = painter.paintSelected(tempToken, g, nextX, y, host,
this, clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(token.getOffset() + selCount);
token = tempToken;
nextX = painter.paint(token, g, nextX,y, host, this,
nextX = painter.paint(token, g, nextX, y, host, this,
clipStart);
}
@ -252,24 +263,24 @@ public class SyntaxView extends View implements TabExpander,
else if (token.containsPosition(selEnd)) {
tempToken.copyFrom(token);
tempToken.textCount = selEnd - tempToken.getOffset();
nextX = painter.paintSelected(tempToken, g, nextX,y, host, this,
nextX = painter.paintSelected(tempToken, g, nextX, y, host, this,
clipStart);
tempToken.textCount = token.length();
tempToken.makeStartAt(selEnd);
token = tempToken;
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
}
// This token is entirely selected
else if (token.getOffset()>=selStart &&
token.getEndOffset()<=selEnd) {
nextX = painter.paintSelected(token, g, nextX,y, host, this,
else if (token.getOffset() >= selStart &&
token.getEndOffset() <= selEnd) {
nextX = painter.paintSelected(token, g, nextX, y, host, this,
clipStart);
}
// This token is entirely unselected
else {
nextX = painter.paint(token, g, nextX,y, host, this, clipStart);
nextX = painter.paint(token, g, nextX, y, host, this, clipStart);
}
token = token.getNextToken();
@ -298,10 +309,10 @@ public class SyntaxView extends View implements TabExpander,
* @return The width of the line.
*/
private float getLineWidth(int lineNumber) {
Token tokenList = ((RSyntaxDocument)getDocument()).
Token tokenList = ((RSyntaxDocument) getDocument()).
getTokenListForLine(lineNumber);
return RSyntaxUtilities.getTokenListWidth(tokenList,
(RSyntaxTextArea)getContainer(),
(RSyntaxTextArea) getContainer(),
this);
}
@ -320,8 +331,8 @@ public class SyntaxView extends View implements TabExpander,
* SwingConstants.NORTH, or SwingConstants.SOUTH.
* @return the location within the model that best represents the next
* location visual position.
* @exception BadLocationException
* @exception IllegalArgumentException for an invalid direction
* @throws BadLocationException
* @throws IllegalArgumentException for an invalid direction
*/
@Override
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
@ -341,7 +352,7 @@ public class SyntaxView extends View implements TabExpander,
* Typically the view is told to render into the span
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
* @exception IllegalArgumentException for an invalid axis
* @throws IllegalArgumentException for an invalid axis
*/
@Override
public float getPreferredSpan(int axis) {
@ -357,13 +368,13 @@ public class SyntaxView extends View implements TabExpander,
// We update lineHeight here as when this method is first
// called, lineHeight isn't initialized. If we don't do it
// here, we get no vertical scrollbar (as lineHeight==0).
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
lineHeight = host != null ? host.getLineHeight() : lineHeight;
// return getElement().getElementCount() * lineHeight;
int visibleLineCount = getElement().getElementCount();
if (host.isCodeFoldingEnabled()) {
int visibleLineCount = getElement().getElementCount();
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
}
return visibleLineCount * lineHeight;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
@ -378,7 +389,7 @@ return visibleLineCount * lineHeight;
*/
private final int getRhsCorrection() {
int rhsCorrection = 10;
if (host!=null) {
if (host != null) {
rhsCorrection = host.getRightHandSideCorrection();
}
return rhsCorrection;
@ -391,7 +402,7 @@ return visibleLineCount * lineHeight;
* @return The tab size.
*/
private int getTabSize() {
Integer i = (Integer)getDocument().getProperty(
Integer i = (Integer) getDocument().getProperty(
PlainDocument.tabSizeAttribute);
int size = (i != null) ? i.intValue() : 5;
return size;
@ -411,22 +422,21 @@ return visibleLineCount * lineHeight;
* the document, <code>null</code> is returned.
*/
public Token getTokenListForPhysicalLineAbove(int offset) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Element map = document.getDefaultRootElement();
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm==null) {
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm == null) {
line--;
if (line>=0) {
if (line >= 0) {
return document.getTokenListForLine(line);
}
}
else {
} else {
line = fm.getVisibleLineAbove(line);
if (line>=0) {
if (line >= 0) {
return document.getTokenListForLine(line);
}
}
}
// int line = map.getElementIndex(offset) - 1;
// if (line>=0)
// return document.getTokenListForLine(line);
@ -447,22 +457,21 @@ else {
* line in the document, <code>null</code> is returned.
*/
public Token getTokenListForPhysicalLineBelow(int offset) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Element map = document.getDefaultRootElement();
int lineCount = map.getElementCount();
int line = map.getElementIndex(offset);
if (!host.isCodeFoldingEnabled()) {
if (line<lineCount-1) {
return document.getTokenListForLine(line+1);
int line = map.getElementIndex(offset);
if (!host.isCodeFoldingEnabled()) {
if (line < lineCount - 1) {
return document.getTokenListForLine(line + 1);
}
}
else {
} else {
FoldManager fm = host.getFoldManager();
line = fm.getVisibleLineBelow(line);
if (line>=0 && line<lineCount) {
if (line >= 0 && line < lineCount) {
return document.getTokenListForLine(line);
}
}
}
// int line = map.getElementIndex(offset);
// int lineCount = map.getElementCount();
// if (line<lineCount-1)
@ -500,13 +509,13 @@ else {
// NOTE: lineHeight is not initially set here, leading to the
// current line not being highlighted when a document is first
// opened. So, we set it here just in case.
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
if (host.isCodeFoldingEnabled()) {
lineHeight = host != null ? host.getLineHeight() : lineHeight;
if (host != null && host.isCodeFoldingEnabled()) {
FoldManager fm = host.getFoldManager();
int hiddenCount = fm.getHiddenLineCountAbove(line);
line -= hiddenCount;
}
r = new Rectangle(alloc.x, alloc.y + line*lineHeight,
}
r = new Rectangle(alloc.x, alloc.y + line * lineHeight,
alloc.width, lineHeight);
}
return r;
@ -520,7 +529,7 @@ if (host.isCodeFoldingEnabled()) {
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @return the bounding box of the given position
* @exception BadLocationException if the given position does not
* @throws BadLocationException if the given position does not
* represent a valid location in the associated document
* @see View#modelToView
*/
@ -530,7 +539,7 @@ if (host.isCodeFoldingEnabled()) {
// line coordinates
Element map = getElement();
RSyntaxDocument doc = (RSyntaxDocument)getDocument();
RSyntaxDocument doc = (RSyntaxDocument) getDocument();
int lineIndex = map.getElementIndex(pos);
Token tokenList = doc.getTokenListForLine(lineIndex);
Rectangle lineArea = lineToRect(a, lineIndex);
@ -542,7 +551,7 @@ if (host.isCodeFoldingEnabled()) {
// We use this method instead as it returns the actual bounding box,
// not just the x-coordinate.
lineArea = tokenList.listOffsetToView(
(RSyntaxTextArea)getContainer(), this, pos,
(RSyntaxTextArea) getContainer(), this, pos,
tabBase, lineArea);
return lineArea;
@ -554,7 +563,7 @@ if (host.isCodeFoldingEnabled()) {
* Provides a mapping, for a given region, from the document model
* coordinate space to the view coordinate space. The specified region is
* created as a union of the first and last character positions.<p>
*
* <p>
* This is implemented to subtract the width of the second character, as
* this view's <code>modelToView</code> actually returns the width of the
* character instead of "1" or "0" like the View implementations in
@ -578,9 +587,9 @@ if (host.isCodeFoldingEnabled()) {
* @param a the area of the view, which encompasses the requested region
* @return the bounding box which is a union of the region specified
* by the first and last character positions
* @exception BadLocationException if the given position does
* @throws BadLocationException if the given position does
* not represent a valid location in the associated document
* @exception IllegalArgumentException if <code>b0</code> or
* @throws IllegalArgumentException if <code>b0</code> or
* <code>b1</code> are not one of the
* legal <code>Position.Bias</code> values listed above
* @see View#viewToModel
@ -592,7 +601,7 @@ if (host.isCodeFoldingEnabled()) {
Shape s0 = modelToView(p0, a, b0);
Shape s1;
if (p1 ==getEndOffset()) {
if (p1 == getEndOffset()) {
try {
s1 = modelToView(p1, a, b1);
} catch (BadLocationException ble) {
@ -600,20 +609,19 @@ if (host.isCodeFoldingEnabled()) {
}
if (s1 == null) {
// Assume extends left to right.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a :
a.getBounds();
s1 = new Rectangle(alloc.x + alloc.width - 1, alloc.y,
1, alloc.height);
}
}
else {
} else {
s1 = modelToView(p1, a, b1);
}
Rectangle r0 = s0 instanceof Rectangle ? (Rectangle)s0 : s0.getBounds();
Rectangle r1 = s1 instanceof Rectangle ? (Rectangle)s1 : s1.getBounds();
Rectangle r0 = s0 instanceof Rectangle ? (Rectangle) s0 : s0.getBounds();
Rectangle r1 = s1 instanceof Rectangle ? (Rectangle) s1 : s1.getBounds();
if (r0.y != r1.y) {
// If it spans lines, force it to be the width of the view.
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a :
a.getBounds();
r0.x = alloc.x;
r0.width = alloc.width;
@ -627,7 +635,7 @@ if (host.isCodeFoldingEnabled()) {
// this, one character too many is highlighted thanks to our
// modelToView() implementation returning the actual width of the
// character requested!
if (p1>p0) r0.width -= r1.width;
if (p1 > p0) r0.width -= r1.width;
return r0;
@ -647,7 +655,7 @@ if (host.isCodeFoldingEnabled()) {
public float nextTabStop(float x, int tabOffset) {
if (tabSize == 0)
return x;
int ntabs = (((int)x) - tabBase) / tabSize;
int ntabs = (((int) x) - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize);
}
@ -662,12 +670,12 @@ if (host.isCodeFoldingEnabled()) {
@Override
public void paint(Graphics g, Shape a) {
RSyntaxDocument document = (RSyntaxDocument)getDocument();
RSyntaxDocument document = (RSyntaxDocument) getDocument();
Rectangle alloc = a.getBounds();
tabBase = alloc.x;
host = (RSyntaxTextArea)getContainer();
host = (RSyntaxTextArea) getContainer();
Rectangle clip = g.getClipBounds();
// An attempt to speed things up for files with long lines. Note that
@ -695,52 +703,51 @@ if (host.isCodeFoldingEnabled()) {
boolean useSelectedTextColor = host.getUseSelectedTextColor();
RSyntaxTextAreaHighlighter h =
(RSyntaxTextAreaHighlighter)host.getHighlighter();
(RSyntaxTextAreaHighlighter) host.getHighlighter();
Graphics2D g2d = (Graphics2D)g;
Graphics2D g2d = (Graphics2D) g;
Token token;
//System.err.println("Painting lines: " + linesAbove + " to " + (endLine-1));
TokenPainter painter = host.getTokenPainter();
int line = linesAbove;
//int count = 0;
while (y<clip.y+clip.height+ascent && line<lineCount) {
while (y < clip.y + clip.height + ascent && line < lineCount) {
Fold fold = fm.getFoldForLine(line);
Element lineElement = map.getElement(line);
int startOffset = lineElement.getStartOffset();
//int endOffset = (line==lineCount ? lineElement.getEndOffset()-1 :
// lineElement.getEndOffset()-1);
int endOffset = lineElement.getEndOffset()-1; // Why always "-1"?
int endOffset = lineElement.getEndOffset() - 1; // Why always "-1"?
h.paintLayeredHighlights(g2d, startOffset, endOffset,
a, host, this);
// Paint a line of text.
token = document.getTokenListForLine(line);
if (!useSelectedTextColor || selStart==selEnd ||
(startOffset>=selEnd || endOffset<selStart)) {
drawLine(painter, token, g2d, x,y);
}
else {
if (!useSelectedTextColor || selStart == selEnd ||
(startOffset >= selEnd || endOffset < selStart)) {
drawLine(painter, token, g2d, x, y);
} else {
//System.out.println("Drawing line with selection: " + line);
drawLineWithSelection(painter,token,g2d, x,y, selStart, selEnd);
drawLineWithSelection(painter, token, g2d, x, y, selStart, selEnd);
}
if (fold!=null && fold.isCollapsed()) {
if (fold != null && fold.isCollapsed()) {
// Visible indicator of collapsed lines
Color c = RSyntaxUtilities.getFoldedLineBottomColor(host);
if (c!=null) {
if (c != null) {
g.setColor(c);
g.drawLine(x,y+lineHeight-ascent-1,
alloc.width,y+lineHeight-ascent-1);
g.drawLine(x, y + lineHeight - ascent - 1,
alloc.width, y + lineHeight - ascent - 1);
}
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
do {
int hiddenLineCount = fold.getLineCount();
if (hiddenLineCount==0) {
if (hiddenLineCount == 0) {
// Fold parser identified a zero-line fold region.
// This is really a bug, but we'll be graceful here
// and avoid an infinite loop.
@ -748,7 +755,7 @@ if (host.isCodeFoldingEnabled()) {
}
line += hiddenLineCount;
fold = fm.getFoldForLine(line);
} while (fold!=null && fold.isCollapsed());
} while (fold != null && fold.isCollapsed());
}
@ -824,7 +831,7 @@ if (host.isCodeFoldingEnabled()) {
if (added != null) {
int addedAt = ec.getIndex(); // FIXME: Is this correct?????
for (int i = 0; i < added.length; i++)
possiblyUpdateLongLine(added[i], addedAt+i);
possiblyUpdateLongLine(added[i], addedAt + i);
}
if (removed != null) {
for (int i = 0; i < removed.length; i++) {
@ -841,14 +848,12 @@ if (host.isCodeFoldingEnabled()) {
// This occurs when syntax highlighting only changes on lines
// (i.e. beginning a multiline comment).
else if (changes.getType()==DocumentEvent.EventType.CHANGE) {
else if (changes.getType() == DocumentEvent.EventType.CHANGE) {
//System.err.println("Updating the damage due to a CHANGE event...");
int startLine = changes.getOffset();
int endLine = changes.getLength();
damageLineRange(startLine,endLine, a, host);
}
else {
damageLineRange(startLine, endLine, a, host);
} else {
Element map = getElement();
int line = map.getElementIndex(changes.getOffset());
damageLineRange(line, line, a, host);
@ -861,14 +866,12 @@ if (host.isCodeFoldingEnabled()) {
// because it has gotten longer.
longLineWidth = getLineWidth(line);
preferenceChanged(null, true, false);
}
else {
} else {
// If long line gets updated, update the status bars too.
if (possiblyUpdateLongLine(e, line))
preferenceChanged(null, true, false);
}
}
else if (changes.getType() == DocumentEvent.EventType.REMOVE) {
} else if (changes.getType() == DocumentEvent.EventType.REMOVE) {
if (map.getElement(line) == longLine) {
// removed from longest line... recalc
longLineWidth = -1; // Must do this!
@ -884,7 +887,7 @@ if (host.isCodeFoldingEnabled()) {
* Checks to see if the font metrics and longest line are up-to-date.
*/
private void updateMetrics() {
host = (RSyntaxTextArea)getContainer();
host = (RSyntaxTextArea) getContainer();
Font f = host.getFont();
if (font != f) {
// The font changed, we need to recalculate the longest line!
@ -910,7 +913,7 @@ if (host.isCodeFoldingEnabled()) {
bias[0] = Position.Bias.Forward;
Rectangle alloc = a.getBounds();
RSyntaxDocument doc = (RSyntaxDocument)getDocument();
RSyntaxDocument doc = (RSyntaxDocument) getDocument();
int x = (int) fx;
int y = (int) fy;
@ -936,9 +939,9 @@ if (host.isCodeFoldingEnabled()) {
Element map = doc.getDefaultRootElement();
int lineIndex = Math.abs((y - alloc.y) / lineHeight);//metrics.getHeight() );
FoldManager fm = host.getFoldManager();
FoldManager fm = host.getFoldManager();
//System.out.print("--- " + lineIndex);
lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
//System.out.println(" => " + lineIndex);
if (lineIndex >= map.getElementCount()) {
return host.getLastVisibleOffset();
@ -960,9 +963,9 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
Token tokenList = doc.getTokenListForLine(lineIndex);
tabBase = alloc.x;
int offs = tokenList.getListOffset(
(RSyntaxTextArea)getContainer(),
(RSyntaxTextArea) getContainer(),
this, tabBase, x);
return offs!=-1 ? offs : p0;
return offs != -1 ? offs : p0;
}
} // End of else.
@ -981,11 +984,13 @@ lineIndex += fm.getHiddenLineCountAbove(lineIndex, true);
// NOTE: lineHeight is not initially set here, leading to the
// current line not being highlighted when a document is first
// opened. So, we set it here just in case.
lineHeight = host!=null ? host.getLineHeight() : lineHeight;
lineHeight = host != null ? host.getLineHeight() : lineHeight;
if (host != null) {
FoldManager fm = host.getFoldManager();
if (!fm.isLineHidden(line)) {
line -= fm.getHiddenLineCountAbove(line);
return alloc.y + line*lineHeight;
return alloc.y + line * lineHeight;
}
}
}

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

@ -9,15 +9,33 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.*;
import javax.swing.text.*;
import javax.swing.text.Position.Bias;
import javax.swing.event.*;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.TokenUtils.TokenSubList;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager;
import com.fr.design.gui.syntax.ui.rtextarea.Gutter;
import com.fr.stable.CommonUtils;
import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.BoxView;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.LayeredHighlighter;
import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.Position.Bias;
import javax.swing.text.Segment;
import javax.swing.text.TabExpander;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
/**
@ -93,7 +111,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
int p = p0;
RSyntaxTextArea textArea = (RSyntaxTextArea)getContainer();
float currentWidth = getWidth();
if (currentWidth==Integer.MAX_VALUE)
if (CommonUtils.equals(currentWidth, Integer.MAX_VALUE))
currentWidth = getPreferredSpan(X_AXIS);
// Make sure width>0; this is a huge hack to fix a bug where
// loading text into an RTextArea before it is visible if word wrap
@ -128,7 +146,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
//System.err.println("------ ending calculateBreakPosition() --------");
// return p;
return p + 1;
return p + 1;
}
//private int getBreakLocation(Token t, FontMetrics fm, int x0, int x,
@ -1044,8 +1062,8 @@ return p + 1;
// Code folding may have hidden the last line. If so, return the last
// visible offset instead of the last offset.
if (host.isCodeFoldingEnabled() && v==getView(getViewCount()-1) &&
offs==v.getEndOffset()-1) {
if (v != null && host.isCodeFoldingEnabled() && v == getView(getViewCount() - 1) &&
offs == v.getEndOffset() - 1) {
offs = host.getLastVisibleOffset();
}
@ -1170,7 +1188,7 @@ System.err.println(">>> >>> calculated number of lines for this view (line " + l
switch (axis) {
case View.X_AXIS:
float width = getWidth();
if (width == Integer.MAX_VALUE) {
if (CommonUtils.equals(width, Integer.MAX_VALUE)) {
// We have been initially set to MAX_VALUE, but we don't
// want this as our preferred.
return 100f;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -7,6 +7,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -112,8 +113,8 @@ public class WatermarkPane extends BasicPane {
formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox.setEditable(true);
horizontalGapSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 200);
verticalGapSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 200);
verticalGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));

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

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

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

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

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

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

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

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

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

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

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

@ -79,15 +79,17 @@ public class FineEmbedServerMonitor {
scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
if (isComplete()) {
scheduler.shutdown();
DesignerContext.getDesignerFrame().hideProgressDialog();
return;
}
while (!isComplete()) {
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog()
.updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"));
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"));
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
try {
Thread.sleep(STEP_HEARTBEAT);
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
}

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

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

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

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

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

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

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).getyAxis().setPercentage(true);
}
if(plot != null) {
createAreaCondition(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;
if(newPlot != null) {
try {
cloned = (Plot)newPlot.clone();
cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}
}
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;
if(newPlot != null) {
try {
cloned = (Plot)newPlot.clone();
cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}
}
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;
if(newPlot != null) {
try {
cloned = (Plot)newPlot.clone();
cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}
}
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;
if(newPlot != null) {
try {
cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In AreaChart");
}
}
return cloned;
}

5
designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java

@ -65,10 +65,11 @@ public class VanChartBarPlotPane extends AbstractVanChartTypePane {
newPlot = (VanChartColumnPlot)barChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
if(newPlot != null) {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}

5
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java

@ -77,10 +77,11 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
newPlot = (VanChartBubblePlot)bubbleChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
if(newPlot != null) {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In BubbleChart");
}

5
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java

@ -66,10 +66,11 @@ public class VanChartColumnPlotPane extends AbstractVanChartTypePane {
newPlot = (VanChartColumnPlot)columnChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
if(newPlot != null) {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}

2
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java

@ -261,7 +261,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
}
Plot cloned = null;
try {
if(newPlot != null) {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ScatterChart");
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -92,9 +92,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane.add(pane);
}
if(pane != null) {
pane.add(indexList_Y.get(i));
}
}
if(popupMenu != null){
popupMenu.setVisible(false);

6
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -160,7 +160,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
boolean allowFullScreen = chartEditor.getMobileAttr().isAllowFullScreen();
this.allowFullCheckBox.setSelected(allowFullScreen);
boolean isFunctionalWhenUnactivated = chartEditor.getMobileAttr().isFunctionalWhenUnactivated();
this.functionalWhenUnactivatedCheckBox.setSelected(isFunctionalWhenUnactivated);
this.functionalWhenUnactivatedCheckBox.setSelected(!isFunctionalWhenUnactivated);
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
@ -195,10 +195,10 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
mobileAttr.setZoomInAttr(ChartMobileFitAttrState.PROPORTION);
mobileAttr.setZoomOutAttr((ChartMobileFitAttrState) ((Item) zoomOutComboBox.getSelectedItem()).getValue());
mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
}else {
mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
}
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
}

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

@ -143,7 +143,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent());
this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen());
this.functionalWhenUnactivatedCheckBox.setSelected(elementCaseEditor.isFunctionalWhenUnactivated());
this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated());
}
@Override
@ -168,8 +168,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
break;
case "allowFullCheckBox":
((ElementCaseEditor) xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected());
break;
case "functionalWhenUnactivatedCheckBox":
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
}
}

Loading…
Cancel
Save