Browse Source

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

research/11.0
pengda 5 years ago
parent
commit
af9efdaf0d
  1. 7
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java
  2. 14
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  3. 36
      designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java
  4. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  5. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java
  6. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  7. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  8. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java

7
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java

@ -199,6 +199,7 @@ public class UISBChooser extends JDialog {
twoColorField.setUpperColor(outColor); twoColorField.setUpperColor(outColor);
} }
@SuppressWarnings("squid:S2164")
public static Color getAdjustedColor(Color inColor, int sat, int bri) { public static Color getAdjustedColor(Color inColor, int sat, int bri) {
Color briColor = inColor; Color briColor = inColor;
@ -220,9 +221,9 @@ public class UISBChooser extends JDialog {
int dg = briColor.getGreen() - satColor.getGreen(); int dg = briColor.getGreen() - satColor.getGreen();
int db = briColor.getBlue() - satColor.getBlue(); int db = briColor.getBlue() - satColor.getBlue();
r = briColor.getRed() - (int) Math.round(dr * sat / VALUE * 1.0); r = briColor.getRed() - (int) Math.round(dr * sat / (VALUE * 1.0));
g = briColor.getGreen() - (int) Math.round(dg * sat / VALUE * 1.0); g = briColor.getGreen() - (int) Math.round(dg * sat / (VALUE * 1.0));
b = briColor.getBlue() - (int) Math.round(db * sat / VALUE * 1.0); b = briColor.getBlue() - (int) Math.round(db * sat / (VALUE * 1.0));
} else { } else {
float d = ColorRoutines.getGreyValue(briColor); float d = ColorRoutines.getGreyValue(briColor);
float dr = briColor.getRed() - d; float dr = briColor.getRed() - d;

14
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -102,7 +102,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}}; {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"), hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")}); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")});
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
@ -112,7 +112,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}}; {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}};
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM};
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment); vAlignmentPane = new UIButtonGroup<>(vAlignmentIconArray, vAlignment);
vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")}); vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")});
initOtherComponent(); initOtherComponent();
initAllNames(); initAllNames();
@ -174,7 +174,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
} }
private void initTextRotationCombox() { private void initTextRotationCombox() {
ArrayList<String> selectOption = new ArrayList<String>(); ArrayList<String> selectOption = new ArrayList<>();
selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle")); selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle"));
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class);
selectOption.addAll(Arrays.asList(processor.getComboxOption())); selectOption.addAll(Arrays.asList(processor.getComboxOption()));
@ -343,8 +343,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight());
// alex:indent // alex:indent
this.leftIndentSpinner.setValue(new Integer(leftPadding)); this.leftIndentSpinner.setValue(leftPadding);
this.rightIndentSpinner.setValue(new Integer(rightPadding)); this.rightIndentSpinner.setValue(rightPadding);
this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); this.spaceBeforeSpinner.setValue(style.getSpacingBefore());
this.spaceAfterSpinner.setValue(style.getSpacingAfter()); this.spaceAfterSpinner.setValue(style.getSpacingAfter());
@ -360,7 +360,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
public Style update(Style style) { public Style update(Style style) {
// peter:需要判断传递进来的值是否为null. // peter:需要判断传递进来的值是否为null.
if (style == null) { if (style == null) {
return style; return null;
} }
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) { if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) {
@ -463,7 +463,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
} }
/** /**
* @param name * @param name 全局名
*/ */
public void setGlobalName(String name) { public void setGlobalName(String name) {
} }

36
designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java

@ -9,6 +9,8 @@
*/ */
package com.fr.design.gui.syntax.print; package com.fr.design.gui.syntax.print;
import com.fr.log.FineLoggerFactory;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Document; import javax.swing.text.Document;
import javax.swing.text.Element; import javax.swing.text.Element;
@ -62,8 +64,8 @@ public abstract class RPrintUtilities {
private static int getLineBreakPoint(String line, final int maxCharsPerLine) { private static int getLineBreakPoint(String line, final int maxCharsPerLine) {
int breakPoint = -1; int breakPoint = -1;
for (int i=0; i<breakChars.length; i++) { for (char breakChar : breakChars) {
int breakCharPos = line.lastIndexOf(breakChars[i], maxCharsPerLine-1); int breakCharPos = line.lastIndexOf(breakChar, maxCharsPerLine - 1);
if (breakCharPos > breakPoint) if (breakCharPos > breakPoint)
breakPoint = breakCharPos; breakPoint = breakCharPos;
} }
@ -147,11 +149,11 @@ public abstract class RPrintUtilities {
int tabIndex = curLineString.indexOf('\t'); int tabIndex = curLineString.indexOf('\t');
while (tabIndex > -1) { while (tabIndex > -1) {
int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces); int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces);
String replacementString = ""; StringBuilder replacementString = new StringBuilder();
for (int i=0; i<spacesNeeded; i++) for (int i=0; i<spacesNeeded; i++)
replacementString += ' '; replacementString.append(' ');
// Note that "\t" is actually a regex for this method. // Note that "\t" is actually a regex for this method.
curLineString = curLineString.replaceFirst("\t", replacementString); curLineString = curLineString.replaceFirst("\t", replacementString.toString());
tabIndex = curLineString.indexOf('\t'); tabIndex = curLineString.indexOf('\t');
} }
} }
@ -385,7 +387,7 @@ public abstract class RPrintUtilities {
doc.getText(currentLineStart+startingOffset, currentLineEnd-(currentLineStart+startingOffset), doc.getText(currentLineStart+startingOffset, currentLineEnd-(currentLineStart+startingOffset),
currentLineSeg); currentLineSeg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
System.err.println("BadLocationException in print (where there shouldn't be one!): " + ble); FineLoggerFactory.getLogger().error("BadLocationException in print (where there shouldn't be one!): " + ble.getMessage());
return Printable.NO_SUCH_PAGE; return Printable.NO_SUCH_PAGE;
} }
@ -417,12 +419,12 @@ public abstract class RPrintUtilities {
// currentPos will be the last position in the current text of a "line break character." // currentPos will be the last position in the current text of a "line break character."
currentPos = -1; currentPos = -1;
String currentLineString = currentLineSeg.toString(); String currentLineString = currentLineSeg.toString();
for (int i=0; i<breakChars.length; i++) { for (char breakChar : breakChars) {
// "+1" below so we include the character on the line. // "+1" below so we include the character on the line.
int pos = currentLineString.lastIndexOf(breakChars[i]) + 1; int pos = currentLineString.lastIndexOf(breakChar) + 1;
//if (pos>-1 && pos>currentPos) //if (pos>-1 && pos>currentPos)
// currentPos = pos; // currentPos = pos;
if (pos>0 && pos>currentPos & pos!=currentLineString.length()) if (pos > 0 && pos > currentPos & pos != currentLineString.length())
currentPos = pos; currentPos = pos;
} }
@ -440,7 +442,7 @@ public abstract class RPrintUtilities {
try { try {
doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg); doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
System.err.println(ble); FineLoggerFactory.getLogger().error(ble.getMessage());
return Printable.NO_SUCH_PAGE; return Printable.NO_SUCH_PAGE;
} }
currentLineLengthInPixels = Utilities. currentLineLengthInPixels = Utilities.
@ -453,12 +455,11 @@ public abstract class RPrintUtilities {
try { try {
doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg); doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
System.err.println("BadLocationException in print (a):"); FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart +
System.err.println("==> currentLineStart: " + currentLineStart + "; startingOffset: " + startingOffset + "; currentPos: " + currentPos +
"; startingOffset: " + startingOffset + "; currentPos: " + currentPos); "==> Range: " + (currentLineStart+startingOffset) + " - " +
System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " + (currentLineStart+startingOffset+currentPos));
(currentLineStart+startingOffset+currentPos)); FineLoggerFactory.getLogger().error(ble.getMessage());
ble.printStackTrace();
return Printable.NO_SUCH_PAGE; return Printable.NO_SUCH_PAGE;
} }
@ -521,7 +522,8 @@ public abstract class RPrintUtilities {
return x; return x;
int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' ');
int ntabs = (((int) x) - xOffset) / tabSizeInPixels; int ntabs = (((int) x) - xOffset) / tabSizeInPixels;
return xOffset + ((ntabs + 1) * tabSizeInPixels); float reFloat = xOffset + ((ntabs + 1) * tabSizeInPixels);
return reFloat;
} }
} }

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

@ -656,7 +656,7 @@ public class SyntaxView extends View implements TabExpander,
if (tabSize == 0) if (tabSize == 0)
return x; return x;
int ntabs = (((int) x) - tabBase) / tabSize; int ntabs = (((int) x) - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize); return (float) (tabBase + ((ntabs + 1) * tabSize));
} }

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

@ -9,6 +9,7 @@
package com.fr.design.gui.syntax.ui.rsyntaxtextarea; package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException;
/** /**
@ -73,6 +74,9 @@ class TokenIterator implements Iterator<Token> {
token = null; token = null;
} }
} }
else {
throw new NoSuchElementException();
}
return t; return t;
} }

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

@ -268,7 +268,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
if (host.getEOLMarkersVisible()) { if (host.getEOLMarkersVisible()) {
g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setColor(host.getForegroundForTokenType(Token.WHITESPACE));
g.setFont(host.getFontForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE));
g.drawString("\u00B6", x, y-fontHeight); g.drawString("\u00B6", x, (float) (y-fontHeight));
} }
} }
@ -458,7 +458,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
if (host.getEOLMarkersVisible()) { if (host.getEOLMarkersVisible()) {
g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setColor(host.getForegroundForTokenType(Token.WHITESPACE));
g.setFont(host.getFontForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE));
g.drawString("\u00B6", x, y-fontHeight); g.drawString("\u00B6", x, (float) (y-fontHeight));
} }
} }
@ -841,10 +841,11 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
* @return the tab stop, measured in points >= 0 * @return the tab stop, measured in points >= 0
*/ */
public float nextTabStop(float x, int tabOffset) { public float nextTabStop(float x, int tabOffset) {
if (tabSize == 0) if (tabSize == 0) {
return x; return x;
}
int ntabs = ((int) x - tabBase) / tabSize; int ntabs = ((int) x - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize); return (float) (tabBase + ((ntabs + 1) * tabSize));
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -95,7 +95,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{

8
designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java

@ -193,7 +193,9 @@ public class ZoomPane extends BasicBeanPane<ZoomAttribute> {
rightFormulaPane.populateBean(ob.getRight().getContent()); rightFormulaPane.populateBean(ob.getRight().getContent());
} }
selectionZoomGroup.setSelectedItem(ob.isSelectionZoom()); if (selectionZoomGroup != null) {
selectionZoomGroup.setSelectedItem(ob.isSelectionZoom());
}
checkInitialDisplayCardPane(); checkInitialDisplayCardPane();
checkCustomModePane(); checkCustomModePane();
@ -212,7 +214,9 @@ public class ZoomPane extends BasicBeanPane<ZoomAttribute> {
zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean()));
zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean()));
zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem()); if (selectionZoomGroup != null) {
zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem());
}
return zoomAttribute; return zoomAttribute;
} }

Loading…
Cancel
Save