diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index 9bbca6d2bc..b188cb5aa8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/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/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}; - hAlignmentPane = new UIButtonGroup(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"), 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)); @@ -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_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}; - vAlignmentPane = new UIButtonGroup(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")}); initOtherComponent(); initAllNames(); @@ -174,7 +174,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private void initTextRotationCombox() { - ArrayList selectOption = new ArrayList(); + ArrayList selectOption = new ArrayList<>(); selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle")); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); selectOption.addAll(Arrays.asList(processor.getComboxOption())); @@ -343,8 +343,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); // alex:indent - this.leftIndentSpinner.setValue(new Integer(leftPadding)); - this.rightIndentSpinner.setValue(new Integer(rightPadding)); + this.leftIndentSpinner.setValue(leftPadding); + this.rightIndentSpinner.setValue(rightPadding); this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); this.spaceAfterSpinner.setValue(style.getSpacingAfter()); @@ -360,7 +360,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO public Style update(Style style) { // peter:需要判断传递进来的值是否为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"))) { @@ -463,7 +463,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } /** - * @param name + * @param name 全局名 */ public void setGlobalName(String name) { } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java index 352676010c..ff27b178f4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java @@ -9,6 +9,8 @@ */ package com.fr.design.gui.syntax.print; +import com.fr.log.FineLoggerFactory; + import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; @@ -62,8 +64,8 @@ public abstract class RPrintUtilities { private static int getLineBreakPoint(String line, final int maxCharsPerLine) { int breakPoint = -1; - for (int i=0; i breakPoint) breakPoint = breakCharPos; } @@ -147,11 +149,11 @@ public abstract class RPrintUtilities { int tabIndex = curLineString.indexOf('\t'); while (tabIndex > -1) { int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces); - String replacementString = ""; + StringBuilder replacementString = new StringBuilder(); for (int i=0; i-1 && pos>currentPos) // currentPos = pos; - if (pos>0 && pos>currentPos & pos!=currentLineString.length()) + if (pos > 0 && pos > currentPos & pos != currentLineString.length()) currentPos = pos; } @@ -440,7 +442,7 @@ public abstract class RPrintUtilities { try { doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg); } catch (BadLocationException ble) { - System.err.println(ble); + FineLoggerFactory.getLogger().error(ble.getMessage()); return Printable.NO_SUCH_PAGE; } currentLineLengthInPixels = Utilities. @@ -453,12 +455,11 @@ public abstract class RPrintUtilities { try { doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg); } catch (BadLocationException ble) { - System.err.println("BadLocationException in print (a):"); - System.err.println("==> currentLineStart: " + currentLineStart + - "; startingOffset: " + startingOffset + "; currentPos: " + currentPos); - System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " + - (currentLineStart+startingOffset+currentPos)); - ble.printStackTrace(); + FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart + + "; startingOffset: " + startingOffset + "; currentPos: " + currentPos + + "==> Range: " + (currentLineStart+startingOffset) + " - " + + (currentLineStart+startingOffset+currentPos)); + FineLoggerFactory.getLogger().error(ble.getMessage()); return Printable.NO_SUCH_PAGE; } @@ -521,7 +522,8 @@ public abstract class RPrintUtilities { return x; int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int ntabs = (((int) x) - xOffset) / tabSizeInPixels; - return xOffset + ((ntabs + 1) * tabSizeInPixels); + float reFloat = xOffset + ((ntabs + 1) * tabSizeInPixels); + return reFloat; } }