From a40d88630772f4c7aa8d4c0fb147de0984995ca1 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 15 Nov 2021 17:49:50 +0800 Subject: [PATCH 01/94] =?UTF-8?q?KERNEL-9542=20=E4=BC=98=E5=8C=96=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=AF=B9=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/start/BaseDesigner.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 1c4c611264..eb4dc66b4f 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -27,6 +27,7 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.workspace.base.WorkspaceStatus; import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; @@ -84,6 +85,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (eventPipe != null) { eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); } + EventDispatcher.fire(WorkspaceStatus.Prepared); collectUserInformation(); } }); From e044c1fcfb654e6f8c191f80c15f759257be6e6d Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 16 Nov 2021 09:59:36 +0800 Subject: [PATCH 02/94] =?UTF-8?q?Revert=20"KERNEL-9542=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8F=92=E4=BB=B6=E5=AF=B9=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=BD=B1=E5=93=8D?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a40d88630772f4c7aa8d4c0fb147de0984995ca1. --- designer-base/src/main/java/com/fr/start/BaseDesigner.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index eb4dc66b4f..1c4c611264 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -27,7 +27,6 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; -import com.fr.workspace.base.WorkspaceStatus; import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; @@ -85,7 +84,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (eventPipe != null) { eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); } - EventDispatcher.fire(WorkspaceStatus.Prepared); collectUserInformation(); } }); From 9bb89eee1dbb02e8cdaae6c0e4484dc4c2bb6994 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 17 Nov 2021 17:31:20 +0800 Subject: [PATCH 03/94] =?UTF-8?q?KERNEL-9542=20=E4=BC=98=E5=8C=96=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=AF=B9=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/start/BaseDesigner.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 1c4c611264..6165ff7f7c 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -32,6 +32,7 @@ import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.OperatingSystem; +import com.fr.workspace.base.WorkspaceStatus; import java.awt.Window; import java.io.File; import java.lang.reflect.Method; @@ -84,6 +85,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (eventPipe != null) { eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); } + EventDispatcher.fire(WorkspaceStatus.Prepared); collectUserInformation(); } }); From 8ac5e7ac7e85f4de6b6cea653cb224128627f033 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Mon, 22 Nov 2021 18:31:29 +0800 Subject: [PATCH 04/94] =?UTF-8?q?REPORT-63102=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98=E5=8C=96=EF=BC=8C=E5=A4=9A?= =?UTF-8?q?=E8=A1=8C=E5=87=BD=E6=95=B0=E9=94=99=E8=AF=AF=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E5=BC=82=E5=B8=B8=201.=E5=AE=9A=E5=88=B6=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=B2=A1=E6=9C=89newLine=E7=9A=84FRFormulaLexer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FRFormulaLexer.java | 1689 +++++++++++++++++ .../com/fr/design/formula/FormulaChecker.java | 4 +- 2 files changed, 1691 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java b/designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java new file mode 100644 index 0000000000..23c15d98ac --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/FRFormulaLexer.java @@ -0,0 +1,1689 @@ +package com.fr.design.formula; + +import com.fr.parser.FRParserTokenTypes; +import com.fr.third.antlr.ByteBuffer; +import com.fr.third.antlr.CharBuffer; +import com.fr.third.antlr.CharStreamException; +import com.fr.third.antlr.CharStreamIOException; +import com.fr.third.antlr.InputBuffer; +import com.fr.third.antlr.LexerSharedInputState; +import com.fr.third.antlr.NoViableAltForCharException; +import com.fr.third.antlr.RecognitionException; +import com.fr.third.antlr.Token; +import com.fr.third.antlr.TokenStream; +import com.fr.third.antlr.TokenStreamException; +import com.fr.third.antlr.TokenStreamIOException; +import com.fr.third.antlr.TokenStreamRecognitionException; +import com.fr.third.antlr.collections.impl.BitSet; + +import java.io.InputStream; +import java.io.Reader; +import java.util.Hashtable; + +/** + * @author Hoky + * @date 2021/11/22 + */ + +public class FRFormulaLexer extends com.fr.third.antlr.CharScanner implements FRParserTokenTypes, TokenStream { + public FRFormulaLexer(InputStream in) { + this(new ByteBuffer(in)); + } + + public FRFormulaLexer(Reader in) { + this(new CharBuffer(in)); + } + + public FRFormulaLexer(InputBuffer ib) { + this(new LexerSharedInputState(ib)); + } + + public FRFormulaLexer(LexerSharedInputState state) { + super(state); + caseSensitiveLiterals = true; + setCaseSensitive(true); + literals = new Hashtable(); + } + + public Token nextToken() throws TokenStreamException { + Token theRetToken = null; + tryAgain: + for (; ; ) { + Token _token = null; + int _ttype = Token.INVALID_TYPE; + resetText(); + try { // for char stream error handling + try { // for lexical error handling + switch (LA(1)) { + case '?': { + mQUESTION(true); + theRetToken = _returnToken; + break; + } + case '(': { + mLPAREN(true); + theRetToken = _returnToken; + break; + } + case ')': { + mRPAREN(true); + theRetToken = _returnToken; + break; + } + case '[': { + mLBRACK(true); + theRetToken = _returnToken; + break; + } + case ']': { + mRBRACK(true); + theRetToken = _returnToken; + break; + } + case '{': { + mLCURLY(true); + theRetToken = _returnToken; + break; + } + case '}': { + mRCURLY(true); + theRetToken = _returnToken; + break; + } + case ',': { + mCOMMA(true); + theRetToken = _returnToken; + break; + } + case '/': { + mDIV(true); + theRetToken = _returnToken; + break; + } + case '+': { + mPLUS(true); + theRetToken = _returnToken; + break; + } + case '-': { + mMINUS(true); + theRetToken = _returnToken; + break; + } + case '*': { + mSTAR(true); + theRetToken = _returnToken; + break; + } + case '%': { + mMOD(true); + theRetToken = _returnToken; + break; + } + case '^': { + mPOWER(true); + theRetToken = _returnToken; + break; + } + case ';': { + mSEMI(true); + theRetToken = _returnToken; + break; + } + case '#': { + mSHARP(true); + theRetToken = _returnToken; + break; + } + case '@': { + mAT(true); + theRetToken = _returnToken; + break; + } + case '~': { + mWAVE(true); + theRetToken = _returnToken; + break; + } + case '`': { + mALLL2(true); + theRetToken = _returnToken; + break; + } + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + mINT_NUM(true); + theRetToken = _returnToken; + break; + } + case '"': { + mSTRING_LITERAL_DSQ(true); + theRetToken = _returnToken; + break; + } + case '\'': { + mSTRING_LITERAL_SSQ(true); + theRetToken = _returnToken; + break; + } + case '\t': + case '\n': + case '\u000c': + case '\r': + case ' ': { + mWS(true); + theRetToken = _returnToken; + break; + } + default: + if ((LA(1) == ':') && (LA(2) == ':')) { + mDCOLON(true); + theRetToken = _returnToken; + } else if ((LA(1) == '=') && (LA(2) == '=')) { + mEQUAL(true); + theRetToken = _returnToken; + } else if ((LA(1) == '!') && (LA(2) == '=')) { + mNOT_EQUAL(true); + theRetToken = _returnToken; + } else if ((LA(1) == '<') && (LA(2) == '>')) { + mNOT_EQUAL2(true); + theRetToken = _returnToken; + } else if ((LA(1) == '>') && (LA(2) == '=')) { + mGE(true); + theRetToken = _returnToken; + } else if ((LA(1) == '<') && (LA(2) == '=')) { + mLE(true); + theRetToken = _returnToken; + } else if ((LA(1) == '|') && (LA(2) == '|')) { + mLOR(true); + theRetToken = _returnToken; + } else if ((LA(1) == '&') && (LA(2) == '&')) { + mLAND(true); + theRetToken = _returnToken; + } else if ((LA(1) == '!') && (LA(2) == '0')) { + mALLL(true); + theRetToken = _returnToken; + } else if ((LA(1) == '&') && (_tokenSet_0.member(LA(2)))) { + mCR_ADRESS(true); + theRetToken = _returnToken; + } else if ((LA(1) == ':') && (true)) { + mCOLON(true); + theRetToken = _returnToken; + } else if ((LA(1) == '=') && (true)) { + mEQUAL2(true); + theRetToken = _returnToken; + } else if ((LA(1) == '!') && (true)) { + mLNOT(true); + theRetToken = _returnToken; + } else if ((LA(1) == '>') && (true)) { + mGT(true); + theRetToken = _returnToken; + } else if ((LA(1) == '<') && (true)) { + mLT(true); + theRetToken = _returnToken; + } else if ((LA(1) == '|') && (true)) { + mBOR(true); + theRetToken = _returnToken; + } else if ((LA(1) == '&') && (true)) { + mBAND(true); + theRetToken = _returnToken; + } else if ((_tokenSet_1.member(LA(1)))) { + mIDENT(true); + theRetToken = _returnToken; + } else { + if (LA(1) == EOF_CHAR) { + uponEOF(); + _returnToken = makeToken(Token.EOF_TYPE); + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if (_returnToken == null) continue tryAgain; // found SKIP token + _ttype = _returnToken.getType(); + _ttype = testLiteralsTable(_ttype); + _returnToken.setType(_ttype); + return _returnToken; + } catch (RecognitionException e) { + throw new TokenStreamRecognitionException(e); + } + } catch (CharStreamException cse) { + if (cse instanceof CharStreamIOException) { + throw new TokenStreamIOException(((CharStreamIOException) cse).io); + } else { + throw new TokenStreamException(cse.getMessage()); + } + } + } + } + + public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = QUESTION; + int _saveIndex; + + match('?'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LPAREN; + int _saveIndex; + + match('('); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = RPAREN; + int _saveIndex; + + match(')'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LBRACK; + int _saveIndex; + + match('['); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mRBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = RBRACK; + int _saveIndex; + + match(']'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LCURLY; + int _saveIndex; + + match('{'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = RCURLY; + int _saveIndex; + + match('}'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = COLON; + int _saveIndex; + + match(':'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mDCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = DCOLON; + int _saveIndex; + + match("::"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = COMMA; + int _saveIndex; + + match(','); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = EQUAL; + int _saveIndex; + + match("=="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mEQUAL2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = EQUAL2; + int _saveIndex; + + match('='); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LNOT; + int _saveIndex; + + match('!'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mNOT_EQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = NOT_EQUAL; + int _saveIndex; + + match("!="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mNOT_EQUAL2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = NOT_EQUAL2; + int _saveIndex; + + match("<>"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mDIV(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = DIV; + int _saveIndex; + + match('/'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = PLUS; + int _saveIndex; + + match('+'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = MINUS; + int _saveIndex; + + match('-'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = STAR; + int _saveIndex; + + match('*'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mMOD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = MOD; + int _saveIndex; + + match('%'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mPOWER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = POWER; + int _saveIndex; + + match('^'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = GE; + int _saveIndex; + + match(">="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = GT; + int _saveIndex; + + match('>'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LE; + int _saveIndex; + + match("<="); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LT; + int _saveIndex; + + match('<'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mBOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = BOR; + int _saveIndex; + + match('|'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mBAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = BAND; + int _saveIndex; + + match('&'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LOR; + int _saveIndex; + + match("||"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mLAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LAND; + int _saveIndex; + + match("&&"); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = SEMI; + int _saveIndex; + + match(';'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = SHARP; + int _saveIndex; + + match('#'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = AT; + int _saveIndex; + + match('@'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mWAVE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = WAVE; + int _saveIndex; + + match('~'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mALLL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = ALLL; + int _saveIndex; + + match('!'); + match('0'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mALLL2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = ALLL2; + int _saveIndex; + + match('`'); + match('0'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = IDENT; + int _saveIndex; + + mChar(false); + { + _loop109: + do { + if ((_tokenSet_1.member(LA(1)))) { + mChar(false); + } else if (((LA(1) >= '0' && LA(1) <= '9'))) { + { + mDIGIT(false); + } + } else { + break _loop109; + } + + } while (true); + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + /** + * 'a'..'z', '_', 'A'..'Z' and others without number + */ + protected final void mChar(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = Char; + int _saveIndex; + + switch (LA(1)) { + case '$': { + match('\u0024'); + break; + } + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': { + matchRange('\u0041', '\u005a'); + break; + } + case '_': { + match('\u005f'); + break; + } + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': { + matchRange('\u0061', '\u007a'); + break; + } + case '\u00c0': + case '\u00c1': + case '\u00c2': + case '\u00c3': + case '\u00c4': + case '\u00c5': + case '\u00c6': + case '\u00c7': + case '\u00c8': + case '\u00c9': + case '\u00ca': + case '\u00cb': + case '\u00cc': + case '\u00cd': + case '\u00ce': + case '\u00cf': + case '\u00d0': + case '\u00d1': + case '\u00d2': + case '\u00d3': + case '\u00d4': + case '\u00d5': + case '\u00d6': { + matchRange('\u00c0', '\u00d6'); + break; + } + case '\u00d8': + case '\u00d9': + case '\u00da': + case '\u00db': + case '\u00dc': + case '\u00dd': + case '\u00de': + case '\u00df': + case '\u00e0': + case '\u00e1': + case '\u00e2': + case '\u00e3': + case '\u00e4': + case '\u00e5': + case '\u00e6': + case '\u00e7': + case '\u00e8': + case '\u00e9': + case '\u00ea': + case '\u00eb': + case '\u00ec': + case '\u00ed': + case '\u00ee': + case '\u00ef': + case '\u00f0': + case '\u00f1': + case '\u00f2': + case '\u00f3': + case '\u00f4': + case '\u00f5': + case '\u00f6': { + matchRange('\u00d8', '\u00f6'); + break; + } + case '\u00f8': + case '\u00f9': + case '\u00fa': + case '\u00fb': + case '\u00fc': + case '\u00fd': + case '\u00fe': + case '\u00ff': { + matchRange('\u00f8', '\u00ff'); + break; + } + default: + if (((LA(1) >= '\u0100' && LA(1) <= '\u1fff'))) { + matchRange('\u0100', '\u1fff'); + } else if (((LA(1) >= '\u3040' && LA(1) <= '\u318f'))) { + matchRange('\u3040', '\u318f'); + } else if (((LA(1) >= '\u3300' && LA(1) <= '\u337f'))) { + matchRange('\u3300', '\u337f'); + } else if (((LA(1) >= '\u3400' && LA(1) <= '\u3d2d'))) { + matchRange('\u3400', '\u3d2d'); + } else if (((LA(1) >= '\u4e00' && LA(1) <= '\u9fff'))) { + matchRange('\u4e00', '\u9fff'); + } else if (((LA(1) >= '\uf900' && LA(1) <= '\ufaff'))) { + matchRange('\uf900', '\ufaff'); + } else if (((LA(1) >= '\uac00' && LA(1) <= '\ud7af'))) { + matchRange('\uac00', '\ud7af'); + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = DIGIT; + int _saveIndex; + + matchRange('0', '9'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mCR_ADRESS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = CR_ADRESS; + int _saveIndex; + + mBAND(false); + { + int _cnt112 = 0; + _loop112: + do { + if ((_tokenSet_0.member(LA(1)))) { + mLETTER(false); + } else { + if (_cnt112 >= 1) { + break _loop112; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt112++; + } while (true); + } + { + int _cnt114 = 0; + _loop114: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt114 >= 1) { + break _loop114; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt114++; + } while (true); + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mLETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = LETTER; + int _saveIndex; + + switch (LA(1)) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': { + matchRange('A', 'Z'); + break; + } + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': { + matchRange('a', 'z'); + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mINT_NUM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = INT_NUM; + int _saveIndex; + + switch (LA(1)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + { + int _cnt117 = 0; + _loop117: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt117 >= 1) { + break _loop117; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt117++; + } while (true); + } + { + if ((LA(1) == '.')) { + match('.'); + { + _loop120: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + break _loop120; + } + + } while (true); + } + _ttype = FLOT_NUM; + } else { + } + + } + { + if ((LA(1) == 'E' || LA(1) == 'e')) { + mExponent(false); + _ttype = FLOT_NUM; + } else { + } + + } + + //System.out.println("number like 1.2e+12"); + + break; + } + case '.': { + match('.'); + _ttype = DOT; + { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + { + int _cnt124 = 0; + _loop124: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt124 >= 1) { + break _loop124; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt124++; + } while (true); + } + { + if ((LA(1) == 'E' || LA(1) == 'e')) { + mExponent(false); + } else { + } + + } + _ttype = FLOT_NUM; + } else { + } + + } + + //System.out.println("number like .3e-2"); + + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mExponent(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = Exponent; + int _saveIndex; + + { + switch (LA(1)) { + case 'e': { + match('e'); + break; + } + case 'E': { + match('E'); + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + switch (LA(1)) { + case '+': { + match('+'); + break; + } + case '-': { + match('-'); + break; + } + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + int _cnt144 = 0; + _loop144: + do { + if (((LA(1) >= '0' && LA(1) <= '9'))) { + mDIGIT(false); + } else { + if (_cnt144 >= 1) { + break _loop144; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt144++; + } while (true); + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSTRING_LITERAL_DSQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = STRING_LITERAL_DSQ; + int _saveIndex; + + match('"'); + { + _loop128: + do { + if ((LA(1) == '\\')) { + mESC(false); + } else if ((_tokenSet_2.member(LA(1)))) { + matchNot('"'); + } else { + break _loop128; + } + + } while (true); + } + match('"'); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = ESC; + int _saveIndex; + + match('\\'); + { + switch (LA(1)) { + case 'n': { + match('n'); + break; + } + case 'r': { + match('r'); + break; + } + case 't': { + match('t'); + break; + } + case 'b': { + match('b'); + break; + } + case 'f': { + match('f'); + break; + } + case '"': { + match('"'); + break; + } + case '\'': { + match('\''); + break; + } + case '\\': { + match('\\'); + break; + } + case 'u': { + { + int _cnt136 = 0; + _loop136: + do { + if ((LA(1) == 'u')) { + match('u'); + } else { + if (_cnt136 >= 1) { + break _loop136; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + + _cnt136++; + } while (true); + } + mXDIGIT(false); + mXDIGIT(false); + mXDIGIT(false); + mXDIGIT(false); + break; + } + case '0': + case '1': + case '2': + case '3': { + matchRange('0', '3'); + { + if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) { + matchRange('0', '7'); + { + if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) { + matchRange('0', '7'); + } else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && (true)) { + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + } else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && (true)) { + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + case '4': + case '5': + case '6': + case '7': { + matchRange('4', '7'); + { + if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) { + matchRange('0', '7'); + } else if (((LA(1) >= '\u0003' && LA(1) <= '\ufffe')) && (true)) { + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mSTRING_LITERAL_SSQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = STRING_LITERAL_SSQ; + int _saveIndex; + + match('\''); + { + _loop131: + do { + if ((LA(1) == '\\')) { + mESC(false); + } else if ((_tokenSet_3.member(LA(1)))) { + matchNot('\''); + } else { + break _loop131; + } + + } while (true); + } + match('\''); + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = XDIGIT; + int _saveIndex; + + switch (LA(1)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + matchRange('0', '9'); + break; + } + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': { + matchRange('a', 'f'); + break; + } + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': { + matchRange('A', 'F'); + break; + } + default: { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; + Token _token = null; + int _begin = text.length(); + _ttype = WS; + int _saveIndex; + + { + int _cnt151 = 0; + _loop151: + do { + switch (LA(1)) { + case ' ': { + match(' '); + break; + } + case '\t': { + match('\t'); + break; + } + case '\u000c': { + match('\f'); + break; + } + case '\n': + case '\r': { + { + if ((LA(1) == '\r') && (LA(2) == '\n')) { + match("\r\n"); + } else if ((LA(1) == '\r') && (true)) { + match('\r'); + } else if ((LA(1) == '\n')) { + match('\n'); + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + + } + //new line 不生效情况居多,此line对于公式语法的检测没有什么作用,还不如直接用column定位,表示第xx个字符 + //newline(); + break; + } + default: { + if (_cnt151 >= 1) { + break _loop151; + } else { + throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn()); + } + } + } + _cnt151++; + } while (true); + } + _ttype = Token.SKIP; + if (_createToken && _token == null && _ttype != Token.SKIP) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin)); + } + _returnToken = _token; + } + + + private static final long[] mk_tokenSet_0() { + long[] data = new long[1025]; + data[1] = 576460743847706622L; + return data; + } + + public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); + + private static final long[] mk_tokenSet_1() { + long[] data = new long[3988]; + data[0] = 68719476736L; + data[1] = 576460745995190270L; + data[3] = -36028797027352577L; + for (int i = 4; i <= 127; i++) { + data[i] = -1L; + } + for (int i = 193; i <= 197; i++) { + data[i] = -1L; + } + data[198] = 65535L; + for (int i = 204; i <= 205; i++) { + data[i] = -1L; + } + for (int i = 208; i <= 243; i++) { + data[i] = -1L; + } + data[244] = 70368744177663L; + for (int i = 312; i <= 639; i++) { + data[i] = -1L; + } + for (int i = 688; i <= 861; i++) { + data[i] = -1L; + } + data[862] = 281474976710655L; + for (int i = 996; i <= 1003; i++) { + data[i] = -1L; + } + return data; + } + + public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); + + private static final long[] mk_tokenSet_2() { + long[] data = new long[2048]; + data[0] = -17179869192L; + data[1] = -268435457L; + for (int i = 2; i <= 1022; i++) { + data[i] = -1L; + } + data[1023] = 9223372036854775807L; + return data; + } + + public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); + + private static final long[] mk_tokenSet_3() { + long[] data = new long[2048]; + data[0] = -549755813896L; + data[1] = -268435457L; + for (int i = 2; i <= 1022; i++) { + data[i] = -1L; + } + data[1023] = 9223372036854775807L; + return data; + } + + public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); + +} + diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java index f91322f689..302be0b08d 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java @@ -2,7 +2,6 @@ package com.fr.design.formula; import com.fr.design.formula.exception.FormulaExceptionTipsProcessor; import com.fr.design.i18n.Toolkit; -import com.fr.parser.FRLexer; import com.fr.parser.FRParser; import com.fr.script.checker.FunctionCheckerDispatcher; import com.fr.script.checker.result.FormulaCheckResult; @@ -29,7 +28,8 @@ public class FormulaChecker { } //过滤一些空格等符号 StringReader in = new StringReader(formulaText); - FRLexer lexer = new FRLexer(in); + //此lexer为公式校验定制 + FRFormulaLexer lexer = new FRFormulaLexer(in); FRParser parser = new FRParser(lexer); try { From 8bfc7697e9e3d355c9162535cc064b7ef3b37ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 26 Nov 2021 11:37:24 +0800 Subject: [PATCH 05/94] =?UTF-8?q?REPORT-62439=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96-=E5=B1=8F=E8=94=BD=E6=B5=B7=E5=A4=96=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/config/DesignerProperties.java | 52 +++++++++++++++++++ .../mainframe/NorthRegionContainerPane.java | 16 +----- .../com/fr/design/os/impl/SupportOSImpl.java | 7 +-- .../fr/start/module/DesignerActivator.java | 13 +++-- 4 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/config/DesignerProperties.java diff --git a/designer-base/src/main/java/com/fr/design/config/DesignerProperties.java b/designer-base/src/main/java/com/fr/design/config/DesignerProperties.java new file mode 100644 index 0000000000..d14c7938a9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/config/DesignerProperties.java @@ -0,0 +1,52 @@ +package com.fr.design.config; + +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.Properties; + +public class DesignerProperties { + private static DesignerProperties holder = null; + private boolean supportLoginEntry = true; + + public DesignerProperties() { + String filePath = StableUtils.pathJoin(StableUtils.getInstallHome(), "/config/config.properties"); + InputStream is = null; + try { + is = new BufferedInputStream(new FileInputStream(filePath)); + Properties ps = new Properties(); + ps.load(is); + this.initProperties(ps); + } catch (FileNotFoundException e) { + // ignore + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } finally { + IOUtils.close(is); + } + } + + public static DesignerProperties getInstance() { + if (holder == null) { + holder = new DesignerProperties(); + } + return holder; + } + + private void initProperties(Properties ps) { + String supportLoginEntry = ps.getProperty("supportLoginEntry"); + if (StringUtils.isNotEmpty(supportLoginEntry)) { + this.supportLoginEntry = Boolean.valueOf(supportLoginEntry); + } + } + + public boolean isSupportLoginEntry() { + return supportLoginEntry; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index 6802024eac..68d783ba3b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -2,8 +2,6 @@ package com.fr.design.mainframe; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; @@ -25,7 +23,6 @@ import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.FlowLayout; /** @@ -143,17 +140,6 @@ public class NorthRegionContainerPane extends JPanel { northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); - TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); - if (processor != null) { - final Component[] bbsLoginPane = {null}; - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - bbsLoginPane[0] = ad.createBBSLoginPane(); - } - }, SupportOSImpl.USERINFOPANE); - processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); - } northEastPane.add(ad.createAlphaFinePane()); if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); @@ -166,7 +152,7 @@ public class NorthRegionContainerPane extends JPanel { public void execute(Object... objects) { northEastPane.add(ad.createBBSLoginPane()); } - }, SupportOSImpl.USERINFOPANE); + }, SupportOSImpl.BBS_USER_LOGIN_PANE); } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 949d770456..e8871154e6 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -1,6 +1,7 @@ package com.fr.design.os.impl; import com.fr.base.FRContext; +import com.fr.design.config.DesignerProperties; import com.fr.design.jdk.JdkVersion; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; @@ -22,11 +23,11 @@ import java.util.Locale; public enum SupportOSImpl implements SupportOS { /** - * ARM下屏蔽登录 + * 屏蔽登录入口 */ - USERINFOPANE{ + BBS_USER_LOGIN_PANE { public boolean support(){ - return Arch.getArch() != Arch.ARM; + return Arch.getArch() != Arch.ARM && DesignerProperties.getInstance().isSupportLoginEntry(); } }, /** diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 921d8efe77..477ac8ae38 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -6,10 +6,10 @@ import com.fr.base.MultiFieldParameter; import com.fr.base.passport.FinePassportListenerAdapter; import com.fr.base.passport.FinePassportManager; import com.fr.base.process.ProcessOperator; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.config.MarketConfig; import com.fr.base.theme.migrator.FormThemeConfigMigrator; import com.fr.base.theme.migrator.ReportThemeConfigMigrator; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.config.MarketConfig; import com.fr.decision.update.backup.RecoverManager; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -29,9 +29,9 @@ import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.env.DesignerWorkspaceLoader; import com.fr.design.fit.NewJForm; import com.fr.design.fit.common.TemplateTool; -import com.fr.design.env.DesignerWorkspaceLoader; import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.fun.ElementUIProvider; import com.fr.design.gui.controlpane.NameObjectCreator; @@ -62,7 +62,6 @@ import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormElementCaseDesigner; import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.guide.GuideRegister; -import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.share.constants.ShareEntryKey; import com.fr.design.mainframe.socketio.DesignerSocketIO; @@ -131,11 +130,11 @@ import com.fr.task.Once; import com.fr.workspace.WorkContext; import com.fr.xml.ReportXMLUtils; +import java.awt.Image; +import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import java.util.Set; -import java.awt.Image; -import java.awt.image.BufferedImage; /** * Created by juhaoyu on 2018/1/31. @@ -175,7 +174,7 @@ public class DesignerActivator extends Activator implements Prepare { public void execute(Object... objects) { UserInfoPane.getInstance().updateBBSUserInfo(); } - }, SupportOSImpl.USERINFOPANE); + }, SupportOSImpl.BBS_USER_LOGIN_PANE); storePassport(); AlphaFineHelper.switchConfig4Locale(); RecoverManager.register(new RecoverForDesigner()); From ce3ee0989b71376a3ba9449643f9be1a15bc9174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 26 Nov 2021 14:28:10 +0800 Subject: [PATCH 06/94] =?UTF-8?q?REPORT-62439=20=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/NorthRegionContainerPane.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index 68d783ba3b..544dc392a6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -2,6 +2,8 @@ package com.fr.design.mainframe; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; @@ -23,6 +25,7 @@ import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.FlowLayout; /** @@ -140,6 +143,17 @@ public class NorthRegionContainerPane extends JPanel { northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); + TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); + if (processor != null) { + final Component[] bbsLoginPane = {null}; + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute(Object... objects) { + bbsLoginPane[0] = ad.createBBSLoginPane(); + } + }, SupportOSImpl. BBS_USER_LOGIN_PANE); + processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); + } northEastPane.add(ad.createAlphaFinePane()); if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); From 76430cddae7f9d578acf572c3a2a05ed29d0a104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 26 Nov 2021 17:05:36 +0800 Subject: [PATCH 07/94] =?UTF-8?q?CHART-22040=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=92=E5=BA=8F=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/VanChartFunnelSeriesPane.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index f2aa328a4b..5d8c896072 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -1,13 +1,13 @@ package com.fr.van.chart.funnel.designer.style; import com.fr.chart.chartattr.Plot; -import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - +import com.fr.plugin.chart.funnel.FunnelSortType; import com.fr.plugin.chart.funnel.VanChartFunnelPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; @@ -51,7 +51,11 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { private JPanel createFunnelStylePane() { useSameSlantAngle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Same_Slant_Angle"), Toolkit.i18nText("Fine-Design_Chart_Use_Diff_Slant_Angle")}); - sort = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto_Sort"), Toolkit.i18nText("Fine-Design_Chart_Origin")}); + sort = new UIButtonGroup(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Ascending_Sort"), + Toolkit.i18nText("Fine-Design_Chart_Descending_Sort"), + Toolkit.i18nText("Fine-Design_Chart_Origin_Sort") + }); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -78,7 +82,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { if(plot instanceof VanChartFunnelPlot){ useSameSlantAngle.setSelectedIndex(((VanChartFunnelPlot) plot).isUseSameSlantAngle() ? 0 : 1); - sort.setSelectedIndex(((VanChartFunnelPlot) plot).isSort() ? 0 : 1); + sort.setSelectedIndex(((VanChartFunnelPlot) plot).getSortType().getSortType()); } } @@ -94,7 +98,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { if(plot instanceof VanChartFunnelPlot){ ((VanChartFunnelPlot) plot).setUseSameSlantAngle(useSameSlantAngle.getSelectedIndex() == 0); - ((VanChartFunnelPlot) plot).setSort(sort.getSelectedIndex() == 0); + ((VanChartFunnelPlot) plot).setSortType(FunnelSortType.parseSortType(sort.getSelectedIndex())); } } } From 99762bf62231dc01547e9481f870db8ac833393a Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 30 Nov 2021 17:20:13 +0800 Subject: [PATCH 08/94] =?UTF-8?q?=20REPORT-63322=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=8F=8A=E8=81=9A=E5=90=88=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E6=B3=95=E6=8B=96=E5=8A=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 在某些场景下,组件可能会被破坏或无法被当前设计器解析,从而出现 异常。若拖拽时的异常不被处理,会导致无法完成整个swing拖拽过程, 从而影响后续其他所有的组件拖拽。 【改动思路】 同产品以及交互讨论,新增了一个错误提示信息,当拖拽组件出现 异常时,提示用户,同时终结当前的拖拽。 --- .../mainframe/FormCreatorDropTarget.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 6efc496f8f..5eb354c6cb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -31,12 +32,15 @@ import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.JOptionPane; import javax.swing.JWindow; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -316,6 +320,24 @@ public class FormCreatorDropTarget extends DropTarget { */ @Override public synchronized void drop(DropTargetDropEvent dtde) { + + try { + dropXCreator(dtde); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (addingModel.getXCreator().isShared()) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } + dtde.rejectDrop(); + } + } + + private void dropXCreator(DropTargetDropEvent dtde) { Point loc = dtde.getLocation(); this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); // 放到事件末尾执行 From 0113bf2e89ab9aa2095337b201a4dfa9ed509271 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 22 Nov 2021 15:28:16 +0800 Subject: [PATCH 09/94] =?UTF-8?q?REPORT-62689=20=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=9A=84=E8=BE=B9=E6=A1=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 实现主题单元格样式支持内边框配置 【改动思路】 同上 --- .../cell/CellRectangleStylePreviewPane.java | 79 ++++++++++++++ .../fr/design/cell/CellStylePreviewPane.java | 13 ++- .../com/fr/design/gui/style/BorderPane.java | 103 +++++++++++------- .../theme}/ThemedCellStyleListPane.java | 86 ++++++++------- .../theme/ThemedFeatureController.java | 17 +++ .../theme/edit/CellStyleListEditPane.java | 18 +-- .../theme/edit/cell/CellStyleEditPane.java | 21 +++- .../fr/design/actions/cell/BorderAction.java | 60 +++++++++- .../cell/settingpane/CellStylePane.java | 63 ++++------- .../style/CellPredefinedStyleSettingPane.java | 15 +-- .../settingpane/style/CustomStylePane.java | 27 ++--- .../settingpane/style/NameStyleListPane.java | 54 +++++++++ .../cell/settingpane/style/StylePane.java | 36 +++--- .../com/fr/design/report/ReportStylePane.java | 16 +-- .../java/com/fr/design/style/BorderUtils.java | 98 ++++------------- 15 files changed, 430 insertions(+), 276 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java rename {designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style => designer-base/src/main/java/com/fr/design/mainframe/theme}/ThemedCellStyleListPane.java (64%) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java diff --git a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java new file mode 100644 index 0000000000..bde6b1371d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java @@ -0,0 +1,79 @@ +package com.fr.design.cell; + +import com.fr.report.cell.CellElementBorderSourceFlag; +import com.fr.base.CellBorderStyle; +import com.fr.base.Style; +import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; +import com.fr.report.cell.TemplateCellElement; + +import javax.swing.JPanel; +import java.awt.Dimension; +import java.awt.GridLayout; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/9/3 + */ +public class CellRectangleStylePreviewPane extends JPanel { + private static final int ROW_COUNT = 2; + private static final int COLUMN_COUNT = 2; + + private final TemplateCellElement[][] cellElementGrid = new TemplateCellElement[ROW_COUNT][COLUMN_COUNT]; + private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT]; + + public CellRectangleStylePreviewPane() { + setLayout(new GridLayout(2, 2)); + + for (int r = 0; r < ROW_COUNT; r++) { + for (int c = 0; c < COLUMN_COUNT; c++) { + CellStylePreviewPane pane = new CellStylePreviewPane(); + TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); + int flags = CellElementBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; + if (r != 0) { + flags |= CellElementBorderSourceFlag.TOP_BORDER_SOURCE_INNER; + } + if (r != ROW_COUNT - 1) { + flags |= CellElementBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; + } + if (c != 0) { + flags |= CellElementBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; + } + if (c != COLUMN_COUNT - 1) { + flags |= CellElementBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; + } + cellElement.setBorderSourceFlags(flags); + + pane.setStyle(cellElement.getStyle()); + add(pane); + + cellElementGrid[r][c] = cellElement; + cellStylePreviewPaneGrid[r][c] = pane; + } + } + } + + public void setPlainText(String text) { + cellStylePreviewPaneGrid[0][1].setPaintText(text); + cellStylePreviewPaneGrid[1][1].setPaintText(text); + repaint(); + } + + public void setStyle(Style style, CellBorderStyle borderStyle) { + for (int i = 0; i < ROW_COUNT; i++) { + for (int j = 0; j < COLUMN_COUNT; j++) { + CellStylePreviewPane pane = cellStylePreviewPaneGrid[i][j]; + TemplateCellElement cellElement = cellElementGrid[i][j]; + cellElement.setStyle(style, borderStyle); + + pane.setStyle(cellElement.getStyle()); + } + } + repaint(); + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index cb6cfc8d58..885d3e8e15 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -33,14 +33,21 @@ public class CellStylePreviewPane extends JPanel { transparentBackgroundHeight = transparentBackgroundImage.getHeight(null); } + public void setPaintText(String paintText) { + this.paintText = paintText; + repaint(); + } + public void setStyle(Style style) { this.style = style; - if (style instanceof NameStyle) { - paintText = ((NameStyle) style).getName(); - } repaint(); } + public void setStyle(NameStyle style) { + paintText = style.getName(); + setStyle(style.getRealStyle()); + } + @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java index 2e04b6ce58..fe85d55030 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java @@ -4,7 +4,6 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ -import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.Style; import com.fr.design.constants.LayoutConstants; @@ -17,14 +16,20 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectBox; - +import com.fr.general.IOUtils; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GridLayout; import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -38,7 +43,6 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", "leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; private static final Set BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY)); - private boolean insideMode = false; private UIToggleButton topToggleButton; private UIToggleButton horizontalToggleButton; @@ -50,11 +54,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse private UIToggleButton innerToggleButton; private UIToggleButton outerToggleButton; - private LineComboBox currentLineCombo; - private NewColorSelectBox currentLineColorPane; - private JPanel panel; - private JPanel borderPanel; - private JPanel backgroundPanel; + protected LineComboBox currentLineCombo; + protected NewColorSelectBox currentLineColorPane; private BackgroundPane backgroundPane; private GlobalNameListener globalNameListener = null; @@ -81,18 +82,18 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/out.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Out_Border") + " ", SwingConstants.LEFT), outerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/out.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/out_white.png")}, false)}, new Component[]{null, externalPane}, new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("com/fr/design/images/m_format/in.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_In_Border") + " ", SwingConstants.LEFT), innerToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("com/fr/design/images/m_format/in.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/in_white.png")}, false)}, new Component[]{null, insidePane}, new Component[]{null, null} }; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); - borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); + JPanel borderPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), 280, 24, panel); this.add(borderPanel, BorderLayout.NORTH); UILabel backgroundFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Background_Fill")); @@ -102,7 +103,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse JPanel backgroundContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{backgroundFillLabel, backgroundPane}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); - backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); + JPanel backgroundPanel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 280, 24, backgroundContainPane); this.add(backgroundPanel, BorderLayout.CENTER); initAllNames(); outerToggleButton.addChangeListener(outerToggleButtonChangeListener); @@ -130,12 +131,12 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse }; private void initButtonsWithIcon() { - topToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); - leftToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); - bottomToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); - rightToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false); - horizontalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false); - verticalToggleButton = new UIToggleButton(new Icon[]{BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false); + topToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/top.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/top_white.png")}, false); + leftToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/left.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/left_white.png")}, false); + bottomToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bottom_white.png")}, false); + rightToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/right.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/right_white.png")}, false); + horizontalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/horizontal_white.png")}, false); + verticalToggleButton = new UIToggleButton(new Icon[]{IOUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/vertical_white.png")}, false); this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); this.currentLineColorPane = new NewColorSelectBox(100); } @@ -174,15 +175,15 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse cellBorderStyle.setRightStyle(style.getBorderRight()); cellBorderStyle.setRightColor(style.getBorderRightColor()); this.backgroundPane.populateBean(style.getBackground()); - this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor()); + this.populateBean(cellBorderStyle, false); } - public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) { - this.insideMode = insideMode; + public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode) { + populateBean(cellBorderStyle, insideMode, true); + } - this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle() == Constants.LINE_NONE ? Constants.LINE_THIN : cellBorderStyle.getTopStyle()); - this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); + public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, boolean onlyInspectTop) { this.topToggleButton.setSelected(cellBorderStyle.getTopStyle() != Constants.LINE_NONE); this.bottomToggleButton.setSelected(cellBorderStyle.getBottomStyle() != Constants.LINE_NONE); @@ -195,9 +196,39 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse this.innerToggleButton.setSelected(cellBorderStyle.getInnerBorder() != Constants.LINE_NONE); this.outerToggleButton.setSelected(cellBorderStyle.getOuterBorderStyle() != Constants.LINE_NONE); - this.innerToggleButton.setEnabled(this.insideMode); - this.horizontalToggleButton.setEnabled(this.insideMode); - this.verticalToggleButton.setEnabled(this.insideMode); + this.innerToggleButton.setEnabled(insideMode); + this.horizontalToggleButton.setEnabled(insideMode); + this.verticalToggleButton.setEnabled(insideMode); + + populateLineStyleAndColor(cellBorderStyle, onlyInspectTop); + } + + public void populateLineStyleAndColor(CellBorderStyle cellBorderStyle, boolean onlyInspectTop) { + if (cellBorderStyle.getTopStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); + } else if (!onlyInspectTop) { + if (cellBorderStyle.getBottomStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getBottomStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getBottomColor()); + } else if (cellBorderStyle.getLeftStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getLeftStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getLeftColor()); + } else if (cellBorderStyle.getRightStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getRightStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getRightColor()); + } else if (cellBorderStyle.getVerticalStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getVerticalStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getVerticalColor()); + } else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle()); + this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor()); + } + } + + if (this.currentLineCombo.getSelectedLineStyle() == Constants.LINE_NONE) { + this.currentLineCombo.setSelectedLineStyle(Constants.LINE_THIN); + } } @Override @@ -213,7 +244,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse if (BORDER_SET.contains(globalNameListener.getGlobalName())) { CellBorderStyle cellBorderStyle = this.update(); style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), - cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); + cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); } return style; @@ -253,16 +284,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse } cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE); - if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) { - outerToggleButton.setSelected(true); - } else { - outerToggleButton.setSelected(false); - } - if (verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()) { - innerToggleButton.setSelected(true); - } else { - innerToggleButton.setSelected(false); - } + outerToggleButton.setSelected(leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()); + innerToggleButton.setSelected(verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()); return cellBorderStyle; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java similarity index 64% rename from designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java rename to designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java index 78369ba134..53838d1c7f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java @@ -1,17 +1,15 @@ -package com.fr.design.mainframe.cell.settingpane.style; +package com.fr.design.mainframe.theme; -import com.fr.base.NameStyle; -import com.fr.base.Style; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.cell.CellRectangleStylePreviewPane; import com.fr.design.cell.CellStylePreviewPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerBean; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; @@ -30,18 +28,22 @@ import java.awt.Dimension; import java.io.Serializable; import java.util.List; -public class ThemedCellStyleListPane extends FurtherBasicBeanPane implements DesignerBean { +public class ThemedCellStyleListPane extends FurtherBasicBeanPane implements DesignerBean { private static final int LEFT_BORDER = 10; private static final int RIGHT_BORDER = 10; - private final DefaultListModel defaultListModel; - private final JList styleList; + private final DefaultListModel defaultListModel; + private final JList styleList; private ChangeListener changeListener; public ThemedCellStyleListPane() { + this(false); + } + + public ThemedCellStyleListPane(boolean supportCellRange) { defaultListModel = new DefaultListModel<>(); styleList = new JList<>(defaultListModel); - styleList.setCellRenderer(new RadioButtonListCellRenderer()); + styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); styleList.setOpaque(false); styleList.setBackground(null); styleList.addListSelectionListener(new ListSelectionListener() { @@ -55,15 +57,8 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp setLayout(FRGUIPaneFactory.createBorderLayout()); add(styleList, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER)); - - DesignerContext.setDesignerBean("predefinedStyle", this); } - /** - * 添加改变监听 - * - * @param changeListener 监听事件 - */ public void addChangeListener(ChangeListener changeListener) { this.changeListener = changeListener; } @@ -77,7 +72,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp } @Override - public void populateBean(NameStyle ob) { + public void populateBean(ThemedCellStyle ob) { refreshBeanElement(); if (ob == null) { styleList.setSelectedIndex(0); @@ -92,32 +87,21 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp } @Override - public NameStyle updateBean() { + public ThemedCellStyle updateBean() { return styleList.getSelectedValue(); } - /** - * 获取面板标题 - * - * @return 标题 - */ + @Override public String title4PopupWindow() { return Toolkit.i18nText("Fine-Design_Report_Predefined_Style"); } - /** - * 是否可以接纳对象 - * - * @param ob 组件对象 - * @return 是否可以接纳对象 - */ + @Override public boolean accept(Object ob) { - return ob instanceof NameStyle; + return ob instanceof ThemedCellStyle; } - /** - * 刷新组件对象 - */ + @Override public void refreshBeanElement() { defaultListModel.removeAllElements(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -125,16 +109,13 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp TemplateTheme theme = template.getTemplateTheme(); List styleList = theme.getCellStyleList().getCellStyleList(); for (ThemedCellStyle themedCellStyle: styleList) { - String name = themedCellStyle.getName(); - Style realStyle = themedCellStyle.getStyle(); - NameStyle nameStyle = NameStyle.getPassiveInstance(name, realStyle); - defaultListModel.addElement(nameStyle); + defaultListModel.addElement(themedCellStyle); } } styleList.setModel(defaultListModel); } - private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer, Serializable { + private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer, Serializable { private final UIRadioButton button; private final CellStylePreviewPane previewArea; @@ -151,9 +132,36 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + public Component getListCellRendererComponent(JList list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) { + button.setSelected(isSelected); + previewArea.setPaintText(value.getName()); + previewArea.setStyle(value.getStyle()); + return this; + } + } + + private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer, Serializable { + + private final UIRadioButton button; + private final CellRectangleStylePreviewPane previewArea; + + public RadioButtonListCellRangeRenderer() { + super(); + setLayout(new BorderLayout(5, 0)); + setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + setPreferredSize(new Dimension(getPreferredSize().width, 80)); + button = new UIRadioButton(); + button.setBorder(BorderFactory.createEmptyBorder()); + previewArea = new CellRectangleStylePreviewPane(); + add(button, BorderLayout.WEST); + add(previewArea, BorderLayout.CENTER); + } + + @Override + public Component getListCellRendererComponent(JList list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) { button.setSelected(isSelected); - previewArea.setStyle((Style) value); + previewArea.setPlainText(value.getName()); + previewArea.setStyle(value.getStyle(), value.getCellBorderStyle()); return this; } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java new file mode 100644 index 0000000000..2e0fc5c387 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedFeatureController.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.theme; + +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.theme.SupportThemedCellInnerBorderFeature; +import com.fr.workspace.server.theme.ThemedCellBorderFeature; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/11/26 + */ +public class ThemedFeatureController { + public static boolean isCellStyleSupportInnerBorder() { + ThemedCellBorderFeature controller = WorkContext.getCurrent().get(ThemedCellBorderFeature.class); + return controller instanceof SupportThemedCellInnerBorderFeature; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java index 6b12c37d47..ec0d085b95 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java @@ -1,9 +1,7 @@ package com.fr.design.mainframe.theme.edit; -import com.fr.base.Style; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyleList; -import com.fr.config.predefined.PredefinedCellStyle; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.FineJOptionPane; @@ -122,7 +120,7 @@ public class CellStyleListEditPane extends JListControlPane { } @Override - public BasicBeanPane createPaneByCreators(NameableCreator creator) { + public BasicBeanPane createPaneByCreators(NameableCreator creator) { CellStyleEditPane stylePane = (CellStyleEditPane) super.createPaneByCreators(creator); stylePane.registerAttrChangeListener(attributeChangeListener); return stylePane; @@ -256,23 +254,15 @@ public class CellStyleListEditPane extends JListControlPane { this(CellStyleEditPane.class); } - public CellStyleNameObjectCreator(Class updatePane) { + public CellStyleNameObjectCreator(Class> updatePane) { super(i18nText("Fine-Design_Predefined_Cell_New_Style"), ThemedCellStyle.class, updatePane); } @Override public Nameable createNameable(UnrepeatedNameHelper helper) { - ThemedCellStyle cellStyle = new ThemedCellStyle(); + ThemedCellStyle cellStyle = ThemedCellStyle.createInstanceUsed4New(); cellStyle.setName(menuName); - cellStyle.setStyle(Style.getInstance()); - cellStyle.setRemovable(true); - cellStyle.setUse4Default(false); - cellStyle.setUse4BigTitle(false); - cellStyle.setUse4SmallTitle(false); - cellStyle.setUse4Header(false); - cellStyle.setUse4MainText(false); - cellStyle.setUse4SupportInfo(false); - cellStyle.setUse4HighlightText(false); + return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java index b2d182422e..39e4394b8d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.theme.edit.cell; import com.fr.base.theme.settings.ThemedCellStyle; -import com.fr.design.cell.CellStylePreviewPane; +import com.fr.design.cell.CellRectangleStylePreviewPane; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicPane; @@ -14,6 +14,7 @@ import com.fr.design.gui.style.AlignmentPane; import com.fr.design.gui.style.BorderPane; import com.fr.design.gui.style.TextFontTippedPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.theme.ThemedFeatureController; import com.fr.design.mainframe.theme.ui.BorderUtils; import javax.swing.BorderFactory; @@ -35,7 +36,7 @@ import static com.fr.design.i18n.Toolkit.i18nText; */ public class CellStyleEditPane extends MultiTabPane { private ThemedCellStyle cellStyle; - private CellStylePreviewPane previewArea; + private CellRectangleStylePreviewPane previewArea; private boolean populating; private AttributeChangeListener attributeChangeListener; @@ -74,7 +75,11 @@ public class CellStyleEditPane extends MultiTabPane { for (BasicPane basicPane : paneList) { ((AbstractBasicStylePane) basicPane).populateBean(ob.getStyle()); - previewArea.setStyle(ob.getStyle()); + previewArea.setPlainText(ob.getName()); + previewArea.setStyle(ob.getStyle(), ob.getCellBorderStyle()); + if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicPane instanceof BorderPane) { + ((BorderPane) basicPane).populateBean(ob.getCellBorderStyle(), true, false); + } } this.populating = false; } @@ -83,6 +88,9 @@ public class CellStyleEditPane extends MultiTabPane { public ThemedCellStyle updateBean() { AbstractBasicStylePane basicStylePane = (AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex()); this.cellStyle.setStyle(basicStylePane.update(this.cellStyle.getStyle())); + if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicStylePane instanceof BorderPane) { + this.cellStyle.setCellBorderStyle(((BorderPane) basicStylePane).update()); + } return this.cellStyle; } @@ -108,8 +116,8 @@ public class CellStyleEditPane extends MultiTabPane { jPanel.setLayout(new BorderLayout(0, 4)); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewArea = new CellStylePreviewPane(); - previewArea.setPreferredSize(new Dimension(223, 30)); + previewArea = new CellRectangleStylePreviewPane(); + previewArea.setPreferredSize(new Dimension(223, 60)); previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview"))); previewPane.add(previewArea, BorderLayout.CENTER); @@ -135,7 +143,8 @@ public class CellStyleEditPane extends MultiTabPane { } ThemedCellStyle cellStyle = updateBean(); if (cellStyle != null) { - previewArea.setStyle(cellStyle.getStyle()); + previewArea.setPlainText(cellStyle.getName()); + previewArea.setStyle(cellStyle.getStyle(), cellStyle.getCellBorderStyle()); } fireAttrChangeListener(); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java index a23ec781b6..596b61157a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java @@ -3,17 +3,27 @@ */ package com.fr.design.actions.cell; -import javax.swing.JComponent; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; +import com.fr.base.NameStyle; +import com.fr.base.Style; import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.BorderUtils; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; +import com.fr.grid.selection.Selection; +import com.fr.report.cell.CellElementBorderSourceFlag; +import com.fr.report.cell.FloatElement; +import com.fr.report.cell.StyleProvider; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.elementcase.TemplateElementCase; -import com.fr.design.mainframe.ElementCasePane; +import javax.swing.JComponent; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Rectangle; /** * Border. @@ -65,7 +75,45 @@ public class BorderAction extends ElementCaseAction implements ChangeListener { return (JComponent) object; } - public boolean update(ElementCasePane elementCasePane) { + public void resetElementStyleToCustom(StyleProvider provider) { + Style style = provider.getStyle(); + if (style instanceof NameStyle) { + style = ((NameStyle) style).getRealStyle(); + } + provider.setStyle(style); + } + + public void resetSelectedElementsStyleToCustom(ElementCasePane elementCasePane) { + Selection selection = elementCasePane.getSelection(); + TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); + if (selection instanceof FloatSelection) { + FloatSelection floatSelection = (FloatSelection) selection; + FloatElement selectedFloatElement = elementCase.getFloatElement(floatSelection.getSelectedFloatName()); + resetElementStyleToCustom(selectedFloatElement); + } else { + CellSelection cellSelection = (CellSelection) selection; + int cellRectangleCount = cellSelection.getCellRectangleCount(); + for (int rect = 0; rect < cellRectangleCount; rect++) { + Rectangle cellRectangle = cellSelection.getCellRectangle(rect); + for (int j = 0; j < cellRectangle.height; j++) { + for (int i = 0; i < cellRectangle.width; i++) { + int column = i + cellRectangle.x; + int row = j + cellRectangle.y; + TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); + if (cellElement != null) { + resetElementStyleToCustom(cellElement); + cellElement.setBorderSourceFlags(CellElementBorderSourceFlag.INVALID_BORDER_SOURCE); + }; + } + } + } + } + } + + + public boolean update(ElementCasePane elementCasePane) { + resetSelectedElementsStyleToCustom(elementCasePane); + if (oldCellBorderStyle.isNoneBorderStyle()) { //无边框格式 return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index a678c501ac..c28c00de56 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -1,8 +1,10 @@ package com.fr.design.mainframe.cell.settingpane; +import com.fr.base.CellBorderStyle; import com.fr.base.Style; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; +import com.fr.design.gui.style.BorderPane; import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.style.BorderUtils; @@ -70,51 +72,28 @@ public class CellStylePane extends AbstractCellAttrPane { @Override public void updateBeans() { Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane); - if (stylePane.getSelectedIndex() == 0) { - Style s = stylePane.updateBean(); - TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); - int cellRectangleCount = cs.getCellRectangleCount(); - for (int rect = 0; rect < cellRectangleCount; rect++) { - Rectangle cellRectangle = cs.getCellRectangle(rect); - for (int j = 0; j < cellRectangle.height; j++) { - for (int i = 0; i < cellRectangle.width; i++) { - int column = i + cellRectangle.x; - int row = j + cellRectangle.y; - TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); - if (cellElement == null) { - cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); - elementCase.addCellElement(cellElement); - } - cellElement.setStyle(s); + TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); + int cellRectangleCount = cs.getCellRectangleCount(); + for (int rect = 0; rect < cellRectangleCount; rect++) { + Rectangle cellRectangle = cs.getCellRectangle(rect); + for (int j = 0; j < cellRectangle.height; j++) { + for (int i = 0; i < cellRectangle.width; i++) { + int column = i + cellRectangle.x; + int row = j + cellRectangle.y; + TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); + if (cellElement == null) { + cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); + elementCase.addCellElement(cellElement); } + Style style = stylePane.updateBean(); + cellElement.setStyle(style); } } - } else { - TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); - int cellRectangleCount = cs.getCellRectangleCount(); - for (int rect = 0; rect < cellRectangleCount; rect++) { - Rectangle cellRectangle = cs.getCellRectangle(rect); - for (int j = 0; j < cellRectangle.height; j++) { - for (int i = 0; i < cellRectangle.width; i++) { - int column = i + cellRectangle.x; - int row = j + cellRectangle.y; - TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); - if (cellElement == null) { - cellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); - elementCase.addCellElement(cellElement); - } - Style style = cellElement.getStyle(); - if (style == null) { - style = Style.DEFAULT_STYLE; - - } - style = stylePane.updateStyle(style); - cellElement.setStyle(style); - } - } - } - // border必须特别处理 - stylePane.updateBorder(selectionCellBorderObjects); + } + // border必须特别处理 + CellBorderStyle cellBorderStyle = stylePane.updateBorderStyle(); + if (cellBorderStyle != null) { + BorderUtils.update(elementCasePane, selectionCellBorderObjects, cellBorderStyle); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java index 4f38c8baa5..bc246da8c1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CellPredefinedStyleSettingPane.java @@ -3,15 +3,11 @@ package com.fr.design.mainframe.cell.settingpane.style; import com.fr.base.CellBorderStyle; import com.fr.base.NameStyle; import com.fr.base.Style; -import com.fr.config.predefined.PredefinedCellStyle; -import com.fr.config.predefined.PredefinedCellStyleConfig; -import com.fr.config.predefined.PredefinedStyle; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.MultiTabPane; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.AbstractBasicStylePane; @@ -21,25 +17,20 @@ import com.fr.design.gui.style.FormatPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; import com.fr.design.mainframe.predefined.ui.preview.StyleSettingPreviewPane; import com.fr.design.style.BorderUtils; //import com.fr.predefined.PredefinedPatternStyleManager; -import com.fr.stable.Constants; -import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.GridLayout; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * Created by kerry on 2020-09-02 @@ -212,11 +203,9 @@ public class CellPredefinedStyleSettingPane extends PredefinedStyleSettingPane { } public void dealWithBorder() { + dealWithBorder(true); + } + + public void dealWithBorder(boolean onlyInspectTop) { if (reportPane == null) { return; } Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); - if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) { + if (fourObjectArray.length % LENGTH_FOUR == 0) { + CellBorderStyle cellBorderStyle = new CellBorderStyle(); + boolean insideMode = true; if (fourObjectArray.length == LENGTH_FOUR) { - ((BorderPane) paneList.get(ONE_INDEX)).populateBean((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), ((Integer) fourObjectArray[2]).intValue(), - (Color) fourObjectArray[THREE_INDEX]); - } else { - ((BorderPane) paneList.get(ONE_INDEX)).populateBean(new CellBorderStyle(), Boolean.TRUE, Constants.LINE_NONE, - (Color) fourObjectArray[THREE_INDEX]); + cellBorderStyle = (CellBorderStyle) fourObjectArray[0]; + insideMode = (Boolean) fourObjectArray[1]; } + + BorderPane borderPane = (BorderPane) paneList.get(ONE_INDEX); + borderPane.populateBean(cellBorderStyle, insideMode, onlyInspectTop); } } @@ -139,11 +143,8 @@ public class CustomStylePane extends MultiTabPane