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
persist/11.0
vito 5 years ago
parent
commit
c72bcbad55
  1. 2
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  2. 52
      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. 35
      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. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxDocument.java
  17. 3806
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java
  18. 2563
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  19. 433
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  20. 100
      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. 20
      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. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  42. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java
  43. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java
  44. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java
  45. 10
      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. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  50. 5
      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();

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

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

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

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

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

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

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

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

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;
}
};
}
}

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

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

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

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

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

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

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

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

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

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

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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();

20
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;
}
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog()
.updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"));
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().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);

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

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

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

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

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

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

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

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

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

@ -68,10 +68,12 @@ public class VanChartAreaPlotPane extends AbstractVanChartTypePane {
}
}
Plot cloned = null;
try {
cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In AreaChart");
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");
}

4
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 {
cloned = (Plot) newPlot.clone();
if(newPlot != null) {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ScatterChart");
}

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

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

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