Browse Source

Merge branch '9.0' into REPORT-2419

master
hzzz 7 years ago
parent
commit
55f5c90d26
  1. 674
      LICENSE
  2. 7
      build.release.gradle
  3. 30
      designer/designer.iml
  4. 6
      designer/src/com/fr/design/cell/bar/DynamicScrollBar.java
  5. 2
      designer/src/com/fr/design/cell/editor/RichTextToolBar.java
  6. 22
      designer/src/com/fr/design/expand/ExpandFatherPane.java
  7. 21
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  8. 34
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  9. 20
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  10. 2
      designer/src/com/fr/design/mainframe/InformationCollector.java
  11. 5
      designer/src/com/fr/design/mainframe/JPolyWorkBook.java
  12. 133
      designer/src/com/fr/design/mainframe/JWorkBook.java
  13. 4
      designer/src/com/fr/design/mainframe/ReportComponentCardPane.java
  14. 116
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  15. 50
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  16. 11
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  17. 8
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  18. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected1.png
  19. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected2.png
  20. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected3.png
  21. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected4.png
  22. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected5.png
  23. 46
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  24. 2
      designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
  25. 95
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  26. 3
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  27. 21
      designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
  28. 20
      designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  29. 130
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfo.java
  30. 139
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  31. 98
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  32. 140
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  33. 1
      designer/src/com/fr/design/present/BarCodePane.java
  34. 35
      designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java
  35. 16
      designer/src/com/fr/grid/Grid.java
  36. 31
      designer/src/com/fr/grid/GridColumn.java
  37. 9
      designer/src/com/fr/grid/GridColumnMouseHandler.java
  38. 17
      designer/src/com/fr/grid/GridColumnUI.java
  39. 16
      designer/src/com/fr/grid/GridHeader.java
  40. 37
      designer/src/com/fr/grid/GridMouseAdapter.java
  41. 32
      designer/src/com/fr/grid/GridRow.java
  42. 34
      designer/src/com/fr/grid/GridRowUI.java
  43. 7
      designer/src/com/fr/grid/GridUI.java
  44. 81
      designer/src/com/fr/grid/GridUtils.java
  45. 18
      designer/src/com/fr/poly/PolyArea.java
  46. 78
      designer/src/com/fr/poly/PolyDesignUI.java
  47. 344
      designer/src/com/fr/poly/PolyDesigner.java
  48. 9
      designer/src/com/fr/poly/creator/BlockCreator.java
  49. 2
      designer/src/com/fr/poly/creator/BlockEditor.java
  50. 23
      designer/src/com/fr/poly/creator/ChartBlockCreator.java
  51. 13
      designer/src/com/fr/poly/creator/ChartBlockEditor.java
  52. 13
      designer/src/com/fr/poly/creator/ECBlockCreator.java
  53. 7
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  54. 34
      designer_base/src/com/fr/design/DesignerEnvManager.java
  55. 2
      designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java
  56. 1
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  57. 7
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  58. 36
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  59. 111
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java
  60. 95
      designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
  61. 286
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  62. 974
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  63. 162
      designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  64. 4
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  65. 311
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  66. 6
      designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
  67. 398
      designer_base/src/com/fr/design/gui/ilist/UINameEdList.java
  68. 24
      designer_base/src/com/fr/design/gui/style/BackgroundPane.java
  69. 109
      designer_base/src/com/fr/design/gui/style/BorderPane.java
  70. 146
      designer_base/src/com/fr/design/gui/style/FRFontPane.java
  71. 171
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  72. 49
      designer_base/src/com/fr/design/locale/designer.properties
  73. 50
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  74. 177
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  75. 54
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  76. 50
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  77. 50
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  78. 10
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  79. 862
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  80. 370
      designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
  81. 436
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  82. 34
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  83. 42
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java
  84. 61
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  85. 73
      designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java
  86. 3
      designer_base/src/com/fr/design/menu/MenuManager.java
  87. 1
      designer_base/src/com/fr/design/module/DesignModule.java
  88. 40
      designer_base/src/com/fr/design/preview/WriteEnhancePreview.java
  89. 2
      designer_base/src/com/fr/design/roleAuthority/RoleTree.java
  90. 6
      designer_base/src/com/fr/env/RemoteEnv.java
  91. 9
      designer_base/src/com/fr/start/BaseDesigner.java
  92. 13
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  93. 6
      designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java
  94. 6
      designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java
  95. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  96. 5
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  97. 16
      designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
  98. 37
      designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java
  99. 1203
      designer_form/src/com/fr/design/mainframe/FormArea.java
  100. 11
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  101. Some files were not shown because too many files have changed in this diff Show More

674
LICENSE

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

7
build.release.gradle

@ -2,8 +2,9 @@ apply plugin: "java"
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
}
def basicDir="../../"
def libDir="${basicDir}/finereport-lib-stable/master"
def libDir="${basicDir}/finereport-lib-stable"
//
FileTree files =fileTree(dir:"./",include:"build.*.gradle")
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\"))
@ -26,8 +27,8 @@ task appletJar<<{
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main")
}
unjar(src:"${libDir}/3rd.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")
unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"./tmp")
unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"./tmp")
jar(jarfile:"build/libs/fr-applet-8.0.jar"){
fileset(dir:"build/classes"){
exclude(name:"*.*")

30
designer/designer.iml

@ -10,5 +10,35 @@
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="designer_form" />
<orderEntry type="module" module-name="designer_chart" />
<orderEntry type="module" module-name="designer_chart" />
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="designer_form" />
<orderEntry type="module" module-name="base" />
<orderEntry type="module" module-name="base-basic" />
<orderEntry type="module" module-name="base-calculate" />
<orderEntry type="module" module-name="base-data" />
<orderEntry type="module" module-name="base-file" />
<orderEntry type="module" module-name="base-performance" />
<orderEntry type="module" module-name="base-plugin-engine" />
<orderEntry type="module" module-name="base-stable" />
<orderEntry type="module" module-name="chart-base" />
<orderEntry type="module" module-name="chart-chartattr" />
<orderEntry type="module" module-name="chart-chartdata" />
<orderEntry type="module" module-name="chart-chartglyph" />
<orderEntry type="module" module-name="chart-web" />
<orderEntry type="module" module-name="engine" />
<orderEntry type="module" module-name="engine-cross" />
<orderEntry type="module" module-name="engine-enhancement" />
<orderEntry type="module" module-name="engine-page" />
<orderEntry type="module" module-name="engine-remote" />
<orderEntry type="module" module-name="engine-view" />
<orderEntry type="module" module-name="engine-write" />
<orderEntry type="module" module-name="fmobile" />
<orderEntry type="module" module-name="form" />
<orderEntry type="module" module-name="fsbakrestore" />
<orderEntry type="module" module-name="fschedule" />
<orderEntry type="module" module-name="fservice" />
<orderEntry type="module" module-name="fsmonitor" />
<orderEntry type="library" name="lib" level="project" />
</component>
</module>

6
designer/src/com/fr/design/cell/bar/DynamicScrollBar.java

@ -59,6 +59,10 @@ public class DynamicScrollBar extends JScrollBar {
});
}
public void setDpi(int dpi){
this.dpi = dpi;
}
public ElementCasePane getReportPane() {
return reportPane;
}
@ -112,6 +116,8 @@ public class DynamicScrollBar extends JScrollBar {
}
}
private abstract class DynamicScrollBarHelper extends BarHelper {
protected abstract DynamicUnitList getSizeList();

2
designer/src/com/fr/design/cell/editor/RichTextToolBar.java

@ -81,7 +81,7 @@ public class RichTextToolBar extends BasicPane{
private void initAllButton(){
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox = new UIComboBox(FRFontPane.getFontSizes());
colorSelectPane = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
colorSelectPane.set4Toolbar();

22
designer/src/com/fr/design/expand/ExpandFatherPane.java

@ -22,6 +22,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver {
@ -33,15 +35,16 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
private String expandFatherName = "";
private GlobalNameListener globalNameListener = null;
private boolean isAlreadyAddListener = false;
private final JPanel customPane;
public ExpandFatherPane() {
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
comboBox = new UIComboBox(new String[]{
Inter.getLocText("None"),
Inter.getLocText("Default"),
Inter.getLocText("Custom")});
Inter.getLocText("FR-Designer_None"),
Inter.getLocText("FR-Designer_DEFAULT"),
Inter.getLocText("FR-Designer_Custom")});
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
customPane = new JPanel(cardLayout);
customParentColumnRowPane = new ColumnRowPane() {
@Override
@ -63,13 +66,22 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
cc.add(imageButton, BorderLayout.EAST);
customPane.add(cc, "content");
customPane.add(new JPanel(), "none");
customPane.setPreferredSize(new Dimension(0, 0) );
this.add(comboBox, BorderLayout.NORTH);
this.add(customPane, BorderLayout.CENTER);
comboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
if(comboBox.getSelectedIndex() == 2){
customPane.setPreferredSize(new Dimension(100, 20) );
cardLayout.show(customPane,"content");
}else {
cardLayout.show(customPane,"none");
customPane.setPreferredSize(new Dimension(0, 0) );
}
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(expandFatherName);
}

21
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -3,7 +3,13 @@
*/
package com.fr.design.mainframe;
import java.awt.*;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.fun.PresentKindProvider;
import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
@ -22,9 +28,6 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.Elem;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import java.awt.*;
/**
* 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s
@ -35,7 +38,7 @@ import java.awt.*;
* @since 2012-5-24下午1:50:21
*/
public class CellElementPropertyPane extends DockingView {
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@ -43,7 +46,7 @@ public class CellElementPropertyPane extends DockingView {
public void on(PluginEvent event) {
synchronized (CellElementPropertyPane.class) {
singleton = null;
singleton = new CellElementPropertyPane();
}
}
}, new PluginFilter() {
@ -51,11 +54,13 @@ public class CellElementPropertyPane extends DockingView {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) ||
context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING);
}
});
}
public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) {
singleton = new CellElementPropertyPane();
@ -97,7 +102,7 @@ public class CellElementPropertyPane extends DockingView {
title.setVerticalAlignment(SwingConstants.CENTER);
titlePane.add(title, BorderLayout.CENTER);
titlePane.setBorder(BorderFactory.createEmptyBorder(0,0,1,0));
this.add(titlePane, BorderLayout.NORTH);
// this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
}
@ -130,7 +135,7 @@ public class CellElementPropertyPane extends DockingView {
public void reInit(ElementCasePane ePane) {
if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示
this.add(titlePane, BorderLayout.NORTH);
// this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
}
cellElementEditPane.populate(ePane);

34
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -11,12 +11,7 @@ import java.awt.Rectangle;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.lang.reflect.Constructor;
import java.util.Set;
@ -191,7 +186,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/**
* Constructor.
*/
public ElementCasePane(T t) {
public ElementCasePane(T t) {
super(t);
// marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能
// 下拉grid。
@ -213,7 +208,10 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected void initComponents() {
this.setLayout(new RGridLayout());
this.resolution = ScreenResolution.getScreenResolution();
//todo 直接修改分辨率
if (this.resolution == 0){
this.resolution = ScreenResolution.getScreenResolution();
}
this.initGridComponent();
@ -231,7 +229,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution);
horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution);
this.add(RGridLayout.VerticalBar, this.verScrollBar);
// this.add(RGridLayout.HorizontalBar, this.horScrollBar);
// this.add(RGridLayout.HorizontalBar, this.horScrollBar);
// Init input/action map defaultly.
initInputActionMap();
@ -244,6 +242,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
initFormatBrush();
}
public int getMenuState() {
return DesignState.WORK_SHEET;
}
@ -297,7 +297,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
if(DesignerContext.getReferencedElementCasePane() == null){
return;
}
((ElementCasePane) DesignerContext.getReferencedElementCasePane()).getGrid().setNotShowingTableSelectPane(true);
((ElementCasePane) DesignerContext.getReferencedElementCasePane()).getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
DesignerContext.setReferencedElementCasePane(null);
@ -348,6 +348,14 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
public void setResolution(int resolution){
this.resolution = resolution;
}
public int getResolution(){
return this.resolution;
}
/**
* 所有的操作都必须在可见范围内否则不做任何操作
*
@ -504,7 +512,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*/
public void setSelection(Selection selection) {
if (!ComparatorUtils.equals(this.selection, selection) ||
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getDownPane(), CellElementPropertyPane.getInstance())) {
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
this.selection = selection;
fireSelectionChanged();
}
@ -1049,7 +1057,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false;
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(this, evt.getX(), evt.getY());
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(), this.resolution);
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();
ElementCase report = this.getEditingElementCase();
if (reportPageAttr != null) {
@ -1142,7 +1150,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
HeadColumnAction headcolumnAction = new HeadColumnAction(this);
FootColumnAction footcolumnAction = new FootColumnAction(this);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(this, evt.getX(), evt.getY());
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(),this.resolution);
ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false;
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();

20
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState;
@ -47,8 +48,9 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return;
}
@ -56,8 +58,18 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance());
// 模板初始化完成后,才能初始化超级链接面板
ReportHyperlinkGroupPane.getInstance().populate(ElementCasePaneDelegate.this);
if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceFloatElementPane(QuickEditorRegion.getInstance());
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
}
EastRegionContainerPane.getInstance().replaceHyperlinkPane(ReportHyperlinkGroupPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
}
}

2
designer/src/com/fr/design/mainframe/InformationCollector.java

@ -10,6 +10,7 @@ import com.fr.data.core.db.dml.Delete;
import com.fr.data.core.db.dml.Select;
import com.fr.data.core.db.dml.Table;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.general.*;
import com.fr.general.http.HttpClient;
@ -317,6 +318,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
sendFunctionsInfo();
sendUserInfo();
TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo();
}
});
sendThread.start();

5
designer/src/com/fr/design/mainframe/JPolyWorkBook.java

@ -38,4 +38,9 @@ public class JPolyWorkBook extends JWorkBook {
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){
return new PolySheetNameTabPane(reportCompositeX);
}
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
}
}

133
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -1,9 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.base.*;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
@ -14,6 +11,7 @@ import com.fr.design.actions.report.ReportExportAttrAction;
import com.fr.design.actions.report.ReportMobileAttrAction;
import com.fr.design.actions.report.ReportParameterAction;
import com.fr.design.actions.report.ReportWebAttrAction;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent;
@ -23,6 +21,7 @@ import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.imenu.UIMenuItem;
@ -36,6 +35,7 @@ import com.fr.design.parameter.ParameterDefinitePane;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.preview.PagePreview;
import com.fr.design.preview.ViewPreview;
import com.fr.design.preview.WriteEnhancePreview;
import com.fr.design.preview.WritePreview;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
@ -51,16 +51,18 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.general.web.ParameterConsts;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.poly.PolyDesigner;
import com.fr.poly.creator.BlockCreator;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.cellcase.CellCase;
import com.fr.report.ReportHelper;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.Report;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
@ -69,6 +71,7 @@ import com.fr.stable.module.Module;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileOutputStream;
@ -84,8 +87,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private static final int TOOLBARPANEDIMHEIGHT = 26;
private UIModeControlContainer centerPane;
private ReportComponentComposite reportComposite;
public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane;
private int resolution;
public JWorkBook() {
super(new WorkBook(new WorkSheet()), "WorkBook");
@ -102,6 +106,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
populateReportParameterAttr();
}
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
}
@Override
protected UIModeControlContainer createCenterPane() {
parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null;
@ -139,6 +150,16 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return processInfo;
}
@Override
public void setJTemplateResolution(int resolution) {
this.resolution = resolution;
}
@Override
public int getJTemplateResolution() {
return this.resolution;
}
/**
* 判断sheet权限
*
@ -159,6 +180,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
}
/**
* 无条件取消格式刷
*/
@ -317,6 +339,91 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
parameterPane.getParaDesigner().removeSelection();
}
/**
* 缩放条
*/
@Override
public void setScale(int resolution) {
//更新resolution
this.resolution = resolution;
ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi();
if (elementCasePane != null){
elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution);
//更新Grid
Grid grid = elementCasePane.getGrid();
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase());
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI();
//更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI();
}
if (polyDezi != null){
polyDezi.setResolution(resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution);
polyDezi.updateUI();
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
@Override
public int selfAdaptUpdate(){
PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi();
ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
if (polyDezi != null && polyDezi.getSelection() != null){
BlockCreator blockCreator =polyDezi.getSelection();
double x = blockCreator.getEditorBounds().getX();
double y = blockCreator.getEditorBounds().getY();
polyDezi.setHorizontalValue((int) x);
polyDezi.setVerticalValue((int) y);
double creatorHeight = blockCreator.getEditorBounds().height;
double creatorWidth = blockCreator.getEditorBounds().width;
double areaHeight = polyDezi.polyArea.getHeight();
double areaWidth = polyDezi.polyArea.getWidth();
if (creatorWidth == 0||creatorHeight == 0){
return resolution;
}
double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth);
return (int) (time * ScreenResolution.getScreenResolution());
}else if (elementCasePane != null) {
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
return resolution;
}
double time = (columnExtent/columnLength) < (rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * elementCasePane.getGrid().getResolution());
}else {
return resolution;
}
}
@Override
public int getScale() {
return this.resolution;
}
public int getToolBarHeight() {
return TOOLBARPANEDIMHEIGHT;
}
@ -673,7 +780,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public PreviewProvider[] supportPreview() {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);
return ArrayUtils.addAll(new PreviewProvider[]{
new PagePreview(), new WritePreview(), new ViewPreview()
new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview()
}, set.toArray(new PreviewProvider[set.size()]));
}
@ -717,6 +824,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return true;
}
@Override
public HyperlinkGroupPane getHyperLinkPane() {
return ReportHyperlinkGroupPane.getInstance();
}
public void setAuthorityMode(boolean isUpMode) {
centerPane.setAuthorityMode(isUpMode);
}
@ -746,7 +858,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (delegate4ToolbarMenuAdapter() instanceof PolyDesigner) {
PolyDesigner polyDesigner = (PolyDesigner) delegate4ToolbarMenuAdapter();
if (polyDesigner.getSelectionType() == PolyDesigner.SelectionType.NONE || polyDesigner.getSelection() == null) {
EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
QuickEditorRegion.getInstance().populate(QuickEditor.DEFAULT_EDITOR);
} else {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());

4
designer/src/com/fr/design/mainframe/ReportComponentCardPane.java

@ -37,6 +37,10 @@ public class ReportComponentCardPane extends JComponent implements TargetModifie
}
}
public PolyDesigner getPolyDezi(){
return this.polyDezi;
}
protected void stopEditing() {
if (editingComponet != null) {
editingComponet.stopEditing();

116
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -1,22 +1,25 @@
package com.fr.design.mainframe;
import java.awt.BorderLayout;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import com.fr.base.FRContext;
import com.fr.base.ScreenResolution;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook;
import com.fr.report.report.TemplateReport;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
/**
* 整个报表编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
*
@ -24,6 +27,10 @@ import com.fr.report.report.TemplateReport;
* @since 2012-3-27下午12:12:05
*/
public class ReportComponentComposite extends JComponent {
private static final int MAX = 400;
private static final int HUND = 100;
private static final int MIN = 10;
private JWorkBook parent;
private UIModeControlContainer parentContainer = null;
@ -36,13 +43,17 @@ public class ReportComponentComposite extends JComponent {
private JPanel hbarContainer;
private JSliderPane jSliderContainer;
private boolean isCtrl = false;
/**
* Constructor with workbook..
*
* @param workBook the current workbook.
*/
public ReportComponentComposite(JWorkBook jwb) {
setFocusable(true);
setFocusTraversalKeysEnabled(false);
this.parent = jwb;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(centerCardPane = new ReportComponentCardPane(), BorderLayout.CENTER);
@ -51,8 +62,63 @@ public class ReportComponentComposite extends JComponent {
CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(CellElementRegion, BorderLayout.NORTH);
this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
}
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) {
int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
}
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner) e.getSource()).getValue();
value = value > MAX ? MAX : value;
value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
}
};
ItemListener selfAdaptButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()) {
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().selfAdaptUpdate();
jSliderContainer.getShowVal().setValue(resolution * HUND / ScreenResolution.getScreenResolution());
}
}
};
protected void doBeforeChange(int oldIndex) {
if (oldIndex >= 0) {
templateStateList.set(oldIndex, centerCardPane.editingComponet.createEditingState());
@ -62,11 +128,12 @@ public class ReportComponentComposite extends JComponent {
protected void doAfterChange(int newIndex) {
WorkBook workbook = getEditingWorkBook();
if (workbook == null) {
FRContext.getLogger().error(Inter.getLocText("Read_failure") + "!");
FRContext.getLogger().error(Inter.getLocText("FR-Designer_Read_failure") + "!");
//AUGUST:加个报错,不然测试总是SB的认为打不开一个坏的excel文件就是BUG,也不知道去检查下源文件。
return;
}
centerCardPane.populate(workbook.getTemplateReport(newIndex));
if (parentContainer != null) {
parentContainer.setDownPane(ReportComponentComposite.this);
}
@ -94,11 +161,10 @@ public class ReportComponentComposite extends JComponent {
}
/**
* 移除选中状态
*
* @date 2015-2-5-上午11:41:44
*
*/
* 移除选中状态
*
* @date 2015-2-5-上午11:41:44
*/
public void removeSelection() {
if (centerCardPane.editingComponet instanceof WorkSheetDesigner) {
((WorkSheetDesigner) centerCardPane.editingComponet).removeSelection();
@ -116,6 +182,10 @@ public class ReportComponentComposite extends JComponent {
return sheetNameTab.getSelectedIndex();
}
public JSliderPane getjSliderContainer() {
return this.jSliderContainer;
}
public void setParentContainer(UIModeControlContainer parentContainer) {
this.parentContainer = parentContainer;
@ -153,15 +223,23 @@ public class ReportComponentComposite extends JComponent {
}
private JComponent createSouthControlPane() {
// hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
// hbarContainer.add(createSouthControlPaneWithJSliderPane());
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
// JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
JPanel southPane = new JPanel(new BorderLayout());
jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
splitpane.setBorder(null);
splitpane.setDividerSize(3);
splitpane.setResizeWeight(0.6);
return splitpane;
splitpane.setResizeWeight(1);
southPane.add(hbarContainer, BorderLayout.NORTH);
southPane.add(splitpane, BorderLayout.CENTER);
return southPane;
}
public void setSelectedIndex(int selectedIndex) {
sheetNameTab.setSelectedIndex(selectedIndex);
centerCardPane.populate(getEditingWorkBook().getTemplateReport(selectedIndex));

50
designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -0,0 +1,50 @@
package com.fr.design.mainframe;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
/**
* Created by plough on 2017/7/21.
*/
public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
private static ReportHyperlinkGroupPane singleton;
private ReportHyperlinkGroupPane() {
super();
}
public synchronized static ReportHyperlinkGroupPane getInstance() {
if (singleton == null) {
singleton = new ReportHyperlinkGroupPane();
}
return singleton;
}
public void populate(ElementCasePane reportPane) {
final TemplateElementCase report = reportPane.getEditingElementCase();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report);
populate(nameHyperlinks);
}
private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) {
NameJavaScriptGroup nameHyperlinks = null;
final Selection sel = reportPane.getSelection();
if (sel instanceof FloatSelection) {
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName());
nameHyperlinks = selectedFloatElement.getNameHyperlinkGroup();
} else {
CellElement editCellElement = report.getCellElement(((CellSelection)sel).getColumn(), ((CellSelection)sel).getRow());
if (editCellElement != null) {
nameHyperlinks = editCellElement.getNameHyperlinkGroup();
}
}
return nameHyperlinks;
}
}

11
designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -28,13 +28,18 @@ public class ContentCellRender implements ListCellRenderer<Object> {
panel.setBackground(null);
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
titleLabel.setText(" " + model.getName());
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
if (model.hasAction()) {
if (isSelected) {
String iconUrl = "/com/fr/design/mainframe/alphafine/images/selected" + model.getType().getTypeValue() + ".png";
panel.setBackground(AlphaFineConstants.BLUE);
titleLabel.setForeground(Color.white);
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
} else {
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
titleLabel.setForeground(AlphaFineConstants.BLACK);
}
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
titleLabel.setForeground(AlphaFineConstants.BLACK);
} else {
titleLabel.setIcon(null);
titleLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY);

8
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -68,7 +68,7 @@ public class AlphaFineDialog extends UIDialog {
private static final String DS_NAME = "dsname=\"";
private static final String PLUGIN_MARK_SHORT = "k:4 ";
private static final String PLUGIN_MARK = "k:shop ";
private static final String PLACE_HOLDER = "AlphaFine";
private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine");
private AlphaFineTextField searchTextField;
private UIButton closeButton;
@ -299,8 +299,12 @@ public class AlphaFineDialog extends UIDialog {
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane = new JPanel();
rightSearchResultPane.setBackground(Color.white);
UILabel splitLine = new UILabel();
splitLine.setBackground(AlphaFineConstants.GRAY);
splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT));
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
searchResultPane.add(splitLine, BorderLayout.CENTER);
searchResultPane.add(rightSearchResultPane, BorderLayout.EAST);
UILabel splitLabel = new UILabel();
splitLabel.setBackground(AlphaFineConstants.GRAY);

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

46
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -1,21 +1,21 @@
package com.fr.design.mainframe.cell;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.*;
import java.util.*;
import java.util.List;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.dialog.BasicPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
@ -44,21 +44,33 @@ public class CellElementEditPane extends BasicPane {
private int PaneListIndex;
private CardLayout card;
private JPanel center;
private JPanel downTitle;
private JPanel title;
private UILabel titlename;
private TitleChangeListener titleChangeListener = null;
private CellAttributeProvider cellAttributeProvider = null;
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel)jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellElementEditPane(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
public CellElementEditPane() {
setLayout(new BorderLayout());
initPaneList();
Icon[] iconArray = new Icon[paneList.size()];
String[] iconArray = new String[paneList.size()];
card = new CardLayout();
center = new JPanel(card);
for (int i = 0; i < paneList.size(); i++) {
AbstractCellAttrPane pane = paneList.get(i);
iconArray[i] = BaseUtils.readIcon(pane.getIconPath());
iconArray[i] = pane.getIconPath();
center.add(pane, pane.title4PopupWindow());
}
@ -74,8 +86,22 @@ public class CellElementEditPane extends BasicPane {
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
this.add(center, BorderLayout.CENTER);
titlename = new UILabel(Inter.getLocText("Cell-Cell_Attributes"));
titlename.setFont(new Font("Dialog", 1, 14));
titlename.setForeground(new Color(30,190,245));
title = new JPanel();
title.setLayout(new BorderLayout());
title.add(titlename, BorderLayout.NORTH);
downTitle = new JPanel();
downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
downTitle.add(center, BorderLayout.CENTER);
this.add(title, BorderLayout.NORTH);
this.add(downTitle, BorderLayout.CENTER);
}

2
designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java

@ -35,7 +35,7 @@ public class QuickEditorRegion extends JPanel {
private static QuickEditorRegion singleton = new QuickEditorRegion();
private static JPanel EMPTY;
private QuickEditorRegion() {
public QuickEditorRegion() {
this.setLayout(new BorderLayout());
}

95
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -10,6 +10,8 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
@ -31,6 +33,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
private UICheckBox horizontalExpandableCheckBox;
private UICheckBox verticalExpandableCheckBox;
private SortExpandAttrPane sortAfterExpand;
private JPanel layoutPane;
private JPanel basicPane;
private JPanel seniorPane;
/**
*
@ -56,33 +61,83 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
}
public static void main(String[] args){
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
// content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(290, 400);
// jf.setVisible(true);
}
private void initAllNames() {
expandDirectionButton.setGlobalName(Inter.getLocText("ExpandD-Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("LeftParent"));
rightFatherPane.setGlobalName(Inter.getLocText("ExpandD-Up_Father_Cell"));
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable"));
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable"));
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
}
private JPanel layoutPane() {
layoutPane = new JPanel(new BorderLayout());
basicPane = new JPanel();
seniorPane = new JPanel();
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"),290,20,basicPane());
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"),290,20,seniorPane());
layoutPane.add(basicPane,BorderLayout.NORTH);
layoutPane.add(seniorPane,BorderLayout.CENTER);
return layoutPane;
// double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
// Component[][] components = new Component[][]{
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
// new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
// new Component[]{new JSeparator(), null},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
// new Component[]{null, verticalExpandableCheckBox},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
// };
// double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
// double[] columnSize = {p, f};
// int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel basicPane(){
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane},
};
double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}, {1, 3}, {1, 3}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel seniorPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
new Component[]{new JSeparator(), null},
new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
new Component[]{null, verticalExpandableCheckBox},
new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
new Component[]{null,null},
new Component[]{horizontalExpandableCheckBox, null},
new Component[]{verticalExpandableCheckBox, null},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand},
};
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
@Override
protected void populateBean() {
this.leftFatherPane.setElementCasePane(elementCasePane);
@ -120,9 +175,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
return "com/fr/design/images/expand/cellAttr.gif";
// return "com/fr/design/images/expand/cellAttr.gif";
return Inter.getLocText("FR-Designer_Expand");
}
@Override
public void updateBean(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
@ -130,19 +187,19 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr);
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) {
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem());
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("LeftParent"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) {
this.leftFatherPane.update(cellExpandAttr);
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) {
this.rightFatherPane.update(cellExpandAttr);
}
// extendable
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expandable"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) {
if (horizontalExpandableCheckBox.isSelected()) {
if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);

3
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -214,7 +214,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
return "com/fr/design/images/m_format/cellstyle/otherset.png";
// return "com/fr/design/images/m_format/cellstyle/otherset.png";
return Inter.getLocText("FR-Designer_Other");
}
@Override

21
designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java

@ -25,21 +25,22 @@ public class CellPresentPane extends AbstractCellAttrPane {
*/
public JPanel createContentPane() {
presentPane = new PresentPane();
JPanel content = new JPanel(new BorderLayout());
content.add(presentPane, BorderLayout.CENTER);
presentPane.addTabChangeListener(new ItemListener() {
JPanel content = new JPanel(new BorderLayout());
content.add(presentPane, BorderLayout.CENTER);
presentPane.addTabChangeListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
adjustValues();
}
});
return content;
@Override
public void itemStateChanged(ItemEvent e) {
adjustValues();
}
});
return content;
}
@Override
public String getIconPath() {
return "com/fr/design/images/data/source/dataDictionary.png";
// return "com/fr/design/images/data/source/dataDictionary.png";
return Inter.getLocText("FR-Designer_Present");
}
@Override

20
designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -2,12 +2,13 @@ package com.fr.design.mainframe.cell.settingpane;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Style;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
@ -40,11 +41,24 @@ public class CellStylePane extends AbstractCellAttrPane {
return content;
}
public static void main(String[] args){
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
// content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(290, 400);
// jf.setVisible(true);
}
@Override
public String getIconPath() {
return "com/fr/design/images/m_format/cell.png";
// return "com/fr/design/images/m_format/cell.png";
return Inter.getLocText("FR-Designer_Style");
}
@Override
public void updateBean(TemplateCellElement cellElement) {
cellElement.setStyle(stylePane.updateBean());
@ -106,7 +120,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public String title4PopupWindow() {
return Inter.getLocText("Style");
return Inter.getLocText(Inter.getLocText("FR-Designer_Style"));
}
public void setSelectedByIds(int level, String... id) {

130
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -0,0 +1,130 @@
package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext;
import com.fr.general.IOUtils;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.core.UUID;
import java.io.*;
import java.text.DateFormat;
import java.util.Date;
/**
* Created by Administrator on 2017/7/24 0024.
*/
public class ErrorInfo {
private String username;
private String uuid;
private String activekey;
private String uploadtime;
private String templateid;
private String logid;
private String log;
public ErrorInfo(String username, String uuid, String activekey) {
this.username = username;
this.uuid = uuid;
this.activekey = activekey;
this.uploadtime = dateToString();
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getActivekey() {
return activekey;
}
public void setActivekey(String activekey) {
this.activekey = activekey;
}
public String getUploadtime() {
return uploadtime;
}
public void setUploadtime(String uploadtime) {
this.uploadtime = uploadtime;
}
public String getTemplateid() {
return templateid;
}
public void setTemplateid(String templateid) {
this.templateid = templateid;
}
public String getLogid() {
return logid;
}
public void setLogid(String logid) {
this.logid = logid;
}
public String getLog() {
return log;
}
public void setLog(String log) {
this.log = log;
}
private String dateToString(){
DateFormat df = FRContext.getDefaultValues().getDateTimeFormat();
return df.format(new Date());
}
/**
* 将出错对象存为json字符串, 并放到设计器缓存目录.
* 等下一次上传到云中心.
*/
public void saveAsJSON(){
JSONObject jo = JSONObject.create();
try {
jo.put("username", username);
jo.put("uuid", uuid);
jo.put("activekey", activekey);
jo.put("templateid", templateid);
jo.put("uploadtime", uploadtime);
jo.put("logid", logid);
jo.put("log", log);
} catch (JSONException ignore) {
}
saveFileToCache(jo);
}
private void saveFileToCache(JSONObject jo) {
String content = jo.toString();
String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX;
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName));
try {
StableUtils.makesureFileExist(file);
FileOutputStream out = new FileOutputStream(file);
InputStream in = new ByteArrayInputStream(content.getBytes(EncodeConstants.ENCODING_UTF_8));
IOUtils.copyBinaryTo(in, out);
out.close();
} catch (IOException ignore) {
}
}
}

139
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -0,0 +1,139 @@
package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext;
import com.fr.base.io.IOFile;
import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.general.FRLogLevel;
import com.fr.general.FRLogManager;
import com.fr.general.LogDuration;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.web.core.SessionDealWith;
import com.fr.web.core.SessionIDInfor;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import java.io.InputStream;
/**
* 收集设计器报错信息的appender.
* <p>
* Created by Administrator on 2017/7/24 0024.
*/
public class ErrorInfoLogAppender extends AppenderSkeleton {
private static final int ERROR_LEN = 8;
// 缓存下不变的, 没必要频繁取.
private String username;
private String uuid;
private String activekey;
public ErrorInfoLogAppender() {
this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
this.username = envManager.getBBSName();
this.uuid = envManager.getUUID();
this.activekey = envManager.getActivationKey();
}
protected void append(LoggingEvent event) {
this.subAppend(event);
}
public boolean requiresLayout() {
return true;
}
public synchronized void close() {
if (this.closed) {
return;
}
this.closed = true;
}
public void subAppend(LoggingEvent event) {
Level level = event.getLevel();
// 只分析上传记录error以上的.
if (level.isGreaterOrEqual(FRLogLevel.ERROR)) {
String msg = this.layout.format(event);
// 这个id并不是一定会有的, 有就记录下, 说明是预览模板出的错.
String templateid = readTemplateID();
String logid = readLogID(msg);
ErrorInfo errorInfo = new ErrorInfo(username, uuid, activekey);
errorInfo.setTemplateid(templateid);
errorInfo.setLog(msg);
errorInfo.setLogid(logid);
errorInfo.saveAsJSON();
}
}
private String readLogID(String log) {
int dotIndex = log.lastIndexOf(":");
if (dotIndex != -1) {
int end = Math.min(dotIndex + ERROR_LEN, log.length());
String logid = log.substring(dotIndex + 1, end).trim();
try {
Long.parseLong(logid);
return logid;
} catch (Exception ignore) {
}
}
return StringUtils.EMPTY;
}
private String readTemplateID() {
LogDuration logDuration = FRLogManager.getSession();
if (logDuration == null) {
return StringUtils.EMPTY;
}
String sessionID = logDuration.getSessionID();
SessionIDInfor infor = SessionDealWith.getSessionIDInfor(sessionID);
if (infor == null) {
return StringUtils.EMPTY;
}
String bookPath = infor.getBookPath();
// 这个iofile只读一个templateid, 其他以后有需要再读.
IOFile file = new IOFile() {
@Override
public void readStream(InputStream in) throws Exception {
XMLableReader xmlReader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER);
xmlReader.readXMLObject(this);
xmlReader.close();
in.close();
}
@Override
public void readXML(XMLableReader reader) {
super.readXML(reader);
readDesign(reader);
}
@Override
protected String openTag() {
return StringUtils.EMPTY;
}
@Override
protected void mainContent(XMLPrintWriter writer) {
}
};
try {
file.readStream(FRContext.getCurrentEnv().readBean(bookPath, ProjectConstants.REPORTLETS_NAME));
return file.getTemplateID();
} catch (Exception ignore) {
}
return StringUtils.EMPTY;
}
}

98
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -0,0 +1,98 @@
package com.fr.design.mainframe.errorinfo;
import com.fr.general.*;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject;
import com.fr.stable.CodeUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import java.io.File;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
/**
* Created by Administrator on 2017/7/24 0024.
*/
public class ErrorInfoUploader {
public static final String SUFFIX = ".json";
public static final String FOLDER_NAME = "errorInfo";
private static ErrorInfoUploader collector;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
FRLogger.getLogger().addLogAppender(new ErrorInfoLogAppender());
}
});
}
private ErrorInfoUploader() {
FRLogger.getLogger().addLogAppender(new ErrorInfoLogAppender());
}
public static ErrorInfoUploader getInstance() {
if (collector == null) {
collector = new ErrorInfoUploader();
}
return collector;
}
public void sendErrorInfo(){
//读取文件夹里的json, 加入上传队列中.
File folder = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FOLDER_NAME));
if (!folder.exists()) {
return;
}
File[] files = folder.listFiles();
try {
for (File file : files) {
String filePath = file.getPath();
String suffix = filePath.substring(filePath.lastIndexOf("."));
if (suffix.endsWith(SUFFIX)) {
Thread.sleep(1000L);
String content = IOUtils.inputStream2String(new FileInputStream(file));
String url = SiteCenter.getInstance().acquireUrlByKind("design.error");
if (sendErroInfo(url, content)) {
file.delete();
}
}
}
} catch (Exception ignore) {
}
}
private boolean sendErroInfo(String url, String content) {
HashMap<String, String> para = new HashMap<>();
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, "", "MD5"));
para.put("content", content);
HttpClient httpClient = new HttpClient(url, para, true);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return false;
}
String res = httpClient.getResponseText();
boolean success;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (Exception ex) {
success = false;
}
return success;
}
}

140
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -1,30 +1,43 @@
package com.fr.design.mainframe.form;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
import com.fr.report.ReportHelper;
import com.fr.report.worksheet.FormElementCase;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
/**
* 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
*/
public class FormReportComponentComposite extends JComponent implements TargetModifiedListener, FormECCompositeProvider{
private FormElementCaseDesigner elementCaseDesigner;
private static final int MAX = 400;
private static final int HUND = 100;
private static final int MIN = 10;
public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm;
private FormTabPane sheetNameTab;
private JPanel hbarContainer;
private JSliderPane jSliderContainer;
private boolean isCtrl = false;
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this.jForm = jform;
@ -33,12 +46,114 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.add(elementCaseDesigner, BorderLayout.CENTER);
sheetNameTab = new FormTabPane(ecContainer, jform);
this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
((JForm)this.jForm).getFormDesign().getArea().addMouseWheelListener(showValSpinnerMouseWheelListener);
((JForm)this.jForm).getFormDesign().getArea().addKeyListener(showValSpinnerKeyListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
elementCaseDesigner.addTargetModifiedListener(this);
}
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if( e.isControlDown()){
isCtrl = true ;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false ;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl){
int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
}
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
value = value > MAX ? MAX : value;
value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
setScale(resolution);
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
}
};
ItemListener selfAdaptButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()){
int resolution = selfAdaptUpdate();
jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution());
}
}
};
private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>();
private void setScale(int resolution){
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution);
//更新Grid
Grid grid = elementCasePane.getGrid();
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase());
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI();
//更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI();
}
private int selfAdaptUpdate(){
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jForm.resolution == 0){
jForm.resolution = ScreenResolution.getScreenResolution();
}
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
return jForm.resolution;
}
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * elementCasePane.getGrid().getResolution());
}
/**
* 添加目标改变的监听
* @param targetModifiedListener 目标改变事件
@ -62,13 +177,18 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
}
private JComponent createSouthControlPane() {
JPanel southPane = new JPanel(new BorderLayout());
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(elementCaseDesigner.getHorizontalScrollBar());
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
southPane.add(hbarContainer,BorderLayout.NORTH);
southPane.add(splitpane,BorderLayout.CENTER);
splitpane.setBorder(null);
splitpane.setDividerSize(3);
splitpane.setResizeWeight(0.6);
return splitpane;
splitpane.setResizeWeight(1);
return southPane;
}
/**

1
designer/src/com/fr/design/present/BarCodePane.java

@ -69,6 +69,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
addlistener();
}
private void initComponents() {
barCodePreviewPane = new BarCodePreviewPane();
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, 100, 0.1));

35
designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -41,7 +41,6 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
protected static final int SEPARATOR_GAP = 5;
private GridHeader gHeader;
private int dragType = GridUtils.DRAG_NONE;
//james 是否为选定多行的drag
private boolean isMultiSelectDragPermited = false;
@ -53,10 +52,16 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private int dragIndex = 0;
private JToolTip tip = null;
private JWindow tipWindow = null;
protected int resolution = ScreenResolution.getScreenResolution();
public AbstractGridHeaderMouseHandler(GridHeader gHeader) {
this.gHeader = gHeader;
}
if (gHeader instanceof GridColumn){
this.resolution = ((GridColumn)gHeader).getResolution();
}else {
this.resolution = ((GridRow)gHeader).getResolution();
}
}
public void setStartMultiSelectIndex(int index) {
this.startMultiSelectIndex = index;
@ -98,7 +103,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
@Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
// richer:这边这么做的原因是调整了行高列宽后需要通知聚合块改变边界
Method method = null;
try {
@ -142,7 +147,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private ScrollAction PRESS_ACTION = new ScrollAction() {
@Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) {
dragType = GridUtils.DRAG_CELL_SIZE;
@ -177,7 +182,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
double tmpIncreaseSize = 0;
double oldEndValueSize = 0;
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
for (int index = beginValue; index < endValue; index++) { // denny:
// beginValue
@ -215,7 +220,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.getGrid().stopEditing();// james 停止当前的所有编辑
// peter:选中格子位置.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evt.getX(), evt.getY());
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(),resolution);
iterateScrollBar(ePane, evt, PRESS_ACTION);
@ -255,7 +260,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
* @param evtY
*/
private void doShiftSelectHeader(ElementCasePane ePane, double evtX, double evtY) {
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evtX, evtY, resolution);
int selectedCellPointX = selectedCellPoint.getColumn();// column.
int selectedCellPointY = selectedCellPoint.getRow();// row.
CellSelection cs = ((CellSelection) ePane.getSelection()).clone();
@ -294,7 +299,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private String createToolTipString(double doubleValue, double totalDoubleValue) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
String unit;
@ -317,11 +322,11 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
unit = Inter.getLocText("Unit_MM");
}
StringBuilder sb = new StringBuilder();
sb.append(Utils.convertNumberStringToString(new Float(len)))
.append('/').append(Utils.convertNumberStringToString(new Float(tlen)))
sb.append(String.format("%.2f", new Double(len)))
.append('/').append(String.format("%.2f", new Double(tlen)))
.append(unit).append('(')
.append(Utils.doubleToString(doubleValue)).append('/')
.append(Utils.doubleToString(totalDoubleValue))
.append((int)(doubleValue)).append('/')
.append((int)(totalDoubleValue))
.append(Inter.getLocText("px"))
.append(')');
return sb.toString();
@ -401,7 +406,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (!this.isMultiSelectDragPermited) {
return;
}
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evt.getX(), evt.getY());
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(), resolution);
endMultiSelectIndex = getColumnOrRowByGridHeader(selectedCellPoint);
resetGridSelectionByDrag(cs, ePane, startMultiSelectIndex, endMultiSelectIndex);
cs.setSelectedType(doChooseFrom());
@ -421,7 +426,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
iterateScrollBar(ePane, evt, DRAG_ACTION);
DynamicUnitList sizeList = getSizeList(report);
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution)));
}
@ -472,7 +477,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
double tmpSize1 = 0;
double tmpSize2;
double tmpIncreaseSize = 0;
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
for (int i = beginValue; i < endValue; i++) {
if (i == 0) {

16
designer/src/com/fr/grid/Grid.java

@ -114,6 +114,7 @@ public class Grid extends BaseGridComponent {
private int resolution;
// 判断SmartJTablePane是否显示,做为动态虚线标识符
private boolean notShowingTableSelectPane = true;
private GridMouseAdapter gridMouseAdapter;
public Grid(int resolution) {
this.resolution = resolution;
@ -121,7 +122,7 @@ public class Grid extends BaseGridComponent {
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
GridKeyAction.initGridInputActionMap(this);
GridMouseAdapter gridMouseAdapter = new GridMouseAdapter(this);
gridMouseAdapter = new GridMouseAdapter(this);
this.addMouseListener(gridMouseAdapter);
this.addMouseMotionListener(gridMouseAdapter);
@ -136,6 +137,14 @@ public class Grid extends BaseGridComponent {
this.updateUI();
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution() {
return this.resolution;
}
/**
* 应用界面设置
*
@ -149,6 +158,7 @@ public class Grid extends BaseGridComponent {
setUI(localComponentUI);
}
/**
* 是否显示格子线
*
@ -173,6 +183,10 @@ public class Grid extends BaseGridComponent {
this.getElementCasePane().repaint();
}
public GridMouseAdapter getGridMouseAdapter(){
return this.gridMouseAdapter;
}
/**
* Gets grid line color.
*

31
designer/src/com/fr/grid/GridColumn.java

@ -6,9 +6,15 @@ package com.fr.grid;
import java.awt.Dimension;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.stable.StableUtils;
import javax.swing.plaf.ComponentUI;
/**
* GridColumn used to paint and edit grid column.
*
@ -17,9 +23,15 @@ import com.fr.stable.StableUtils;
*/
public class GridColumn extends GridHeader<String> {
public int resolution = ScreenResolution.getScreenResolution();
private GridColumnMouseHandler gridColumnMouseHandler;
@Override
protected void initByConstructor() {
GridColumnMouseHandler gridColumnMouseHandler = new GridColumnMouseHandler(this);
resolution = ScreenResolution.getScreenResolution();
this.setResolution(resolution);
gridColumnMouseHandler = new GridColumnMouseHandler(this);
this.addMouseListener(gridColumnMouseHandler);
this.addMouseMotionListener(gridColumnMouseHandler);
this.updateUI();
@ -32,7 +44,22 @@ public class GridColumn extends GridHeader<String> {
@Override
public void updateUI() {
this.setUI(new GridColumnUI());
this.removeMouseListener(gridColumnMouseHandler);
this.removeMouseMotionListener(gridColumnMouseHandler);
gridColumnMouseHandler = new GridColumnMouseHandler(this);
this.addMouseListener(gridColumnMouseHandler);
this.addMouseMotionListener(gridColumnMouseHandler);
// gridColumnMouseHandler.setResolution(resolution);
this.setUI(new GridColumnUI(resolution));
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
@Override
public int getResolution() {
return this.resolution;
}
/**

9
designer/src/com/fr/grid/GridColumnMouseHandler.java

@ -9,6 +9,7 @@ import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection;
@ -22,8 +23,15 @@ import com.fr.stable.ColumnRow;
*/
public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler {
private int resolution;
public GridColumnMouseHandler(GridColumn gridColumn) {
super(gridColumn);
this.resolution = gridColumn.resolution;
}
public void setResolution(int resolution){
this.resolution = resolution;
}
@Override
@ -86,7 +94,6 @@ public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler {
/**
* Checks whether is on zero separator line.
*
* @param evtX event x
*/
@Override
protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpWidth2, double tmpIncreaseWidth) {

17
designer/src/com/fr/grid/GridColumnUI.java

@ -29,7 +29,14 @@ import com.fr.report.elementcase.ElementCase;
public class GridColumnUI extends ComponentUI {
protected Color withoutDetailsBackground = Color.lightGray;
protected int resolution = ScreenResolution.getScreenResolution();
private int resolution ;
public GridColumnUI(int resolution){
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
this.resolution = resolution;
}
@Override
public void paint(Graphics g, JComponent c) {
@ -154,11 +161,11 @@ public class GridColumnUI extends ComponentUI {
}
double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth();
if (stringWidth > tmpIncreaseWidth) {
paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
} else {
// if (stringWidth > tmpIncreaseWidth) {
// paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
// } else {
paintNormalContent(i, g2d, tmpWidth1, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
}
// }
}

16
designer/src/com/fr/grid/GridHeader.java

@ -1,17 +1,21 @@
package com.fr.grid;
import com.fr.base.ScreenResolution;
import java.awt.Color;
public abstract class GridHeader<T> extends BaseGridComponent {
public final static int SIZE_ADJUST = 4;
//属性
private Color separatorLineColor = new Color(172, 168, 153); //separator lines
private Color selectedForeground = Color.black;
private Color selectedBackground = new Color(253, 216, 153);
protected int resolution;
public GridHeader() {
//清除所有的Key Action.
this.getInputMap().clear();
@ -22,7 +26,15 @@ public abstract class GridHeader<T> extends BaseGridComponent {
initByConstructor();
}
public void setResolution(int resolution){
this.resolution = resolution;
}
public int getResolution(){
return this.resolution;
}
protected abstract void initByConstructor();
protected abstract T getDisplay(int index) ;

37
designer/src/com/fr/grid/GridMouseAdapter.java

@ -7,6 +7,7 @@ import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection;
@ -71,6 +72,8 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private int ECBlockGap = 40;
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
protected GridMouseAdapter(Grid grid) {
this.grid = grid;
}
@ -101,7 +104,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的
ElementCasePane ePane = grid.getElementCasePane();
if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow(ePane, oldEvtX, oldEvtY);
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY,resolution);
}
}
@ -118,7 +121,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
FU evtX_fu = FU.valueOfPix(this.oldEvtX, resolution);
FU evtY_fu = FU.valueOfPix(this.oldEvtY, resolution);
@ -142,7 +145,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
FloatElement selectedFloatElement = (FloatElement) tmpFloatElementCursor[0];
reportPane.setSelection(new FloatSelection(selectedFloatElement.getName()));
} else {
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
if (!reportPane.getSelection().containsColumnRow(selectedCellPoint)) {
GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow());
}
@ -187,7 +190,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// peter:选择GridSelection,支持Shift
doOneClickSelection(this.oldEvtX, this.oldEvtY, isShiftDown, isControlDown);
// 得到点击所在的column and row
ColumnRow columnRow = GridUtils.getEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY);
ColumnRow columnRow = GridUtils.getEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
TemplateCellElement cellElement = report.getTemplateCellElement(columnRow.getColumn(), columnRow.getRow());
if (clickCount >= 2 && !BaseUtils.isAuthorityEditing()) {
grid.startEditing();
@ -206,7 +209,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
*/
private void showWidetWindow(TemplateCellElement cellElement, TemplateElementCase report) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
double fixed_pos_x = this.oldEvtX - columnWidthList.getRangeValue(grid.getHorizontalValue(), cellElement.getColumn()).toPixD(resolution);
@ -223,6 +226,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
&& cell_width - fixed_pos_x < WIDGET_WIDTH && cell_height - fixed_pos_y < WIDGET_WIDTH;
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
/**
* @param evt
*/
@ -372,7 +379,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
doWithCellElementDragged(evtX, evtY, (CellSelection) selection);
} else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) {
// peter:获得调整过的Selected Column Row.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) {
grid.getDragRectangle().x = selectedCellPoint.getColumn();
grid.getDragRectangle().y = selectedCellPoint.getRow();
@ -393,7 +400,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private void doWithFloatElementDragged(int evtX, int evtY, FloatSelection fs) {
ElementCase report = grid.getElementCasePane().getEditingElementCase();
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
String floatName = fs.getSelectedFloatName();
FloatElement floatElement = report.getFloatElement(floatName);
int cursorType = grid.getCursor().getType();
@ -453,7 +460,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
ElementCasePane reportPane = grid.getElementCasePane();
java.awt.Rectangle cellRectangle = cs.toRectangle();
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) {
grid.getDragRectangle().setBounds(cellRectangle);
} else {
@ -507,7 +514,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
if (s instanceof FloatSelection) {
return;
}
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int selectedCellPointX = selectedCellPoint.getColumn();
int selectedCellPointY = selectedCellPoint.getRow();
CellSelection gridSelection = ((CellSelection) s).clone();
@ -543,7 +550,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
return;
}
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
//拷贝,而不是直接强制使用以监听单元格选择变化
CellSelection gridSelection = ((CellSelection) s).clone();
gridSelection.setSelectedType(((CellSelection) s).getSelectedType());
@ -606,7 +613,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} else {
grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR);
}
ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
TemplateCellElement curCellElement = report.getTemplateCellElement(selectedCellColumnRow.getColumn(), selectedCellColumnRow.getRow());
if (curCellElement != null) {
@ -630,7 +637,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
* @param report
*/
private void setCursorAndToolTips(TemplateCellElement curCellElement, TemplateElementCase report) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
// 计算相对Grid的显示位置.
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
@ -674,7 +681,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
double leftColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn()).toPixD(resolution);
double rightColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn() + cs.getColumnSpan()).toPixD(resolution);
@ -725,7 +732,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} else if (isControlDown) {
doControlSelectCell(evtX, evtY);
} else {
ColumnRow selectedCellPoint = GridUtils.getEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int type = reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn(), selectedCellPoint.getRow());
if (type == ElementCasePane.NO_OVER) {
GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow());
@ -766,7 +773,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
this.oldEvtX = evtX;
this.oldEvtY = evtY;
FloatElement el = report.getFloatElement(floatName);
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int verticalValue = grid.getVerticalValue();
int horizentalValue = grid.getHorizontalValue();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);

32
designer/src/com/fr/grid/GridRow.java

@ -6,8 +6,13 @@ package com.fr.grid;
import java.awt.Dimension;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane;
import javax.swing.plaf.ComponentUI;
/**
* GridRow used to paint and edit grid row.
*
@ -15,9 +20,16 @@ import com.fr.design.mainframe.ElementCasePane;
* @since 2012-3-22下午6:12:03
*/
public class GridRow extends GridHeader<Integer> {
private static final int MAX = 5;
private int resolution = ScreenResolution.getScreenResolution();
private GridRowMouseHandler gridRowMouseHandler;
@Override
protected void initByConstructor() {
GridRowMouseHandler gridRowMouseHandler = new GridRowMouseHandler(this);
resolution = ScreenResolution.getScreenResolution();
this.setResolution(resolution);
gridRowMouseHandler = new GridRowMouseHandler(this);
this.addMouseListener(gridRowMouseHandler);
this.addMouseMotionListener(gridRowMouseHandler);
this.updateUI();
@ -30,9 +42,23 @@ public class GridRow extends GridHeader<Integer> {
@Override
public void updateUI() {
this.setUI(new GridRowUI());
this.removeMouseListener(gridRowMouseHandler);
this.removeMouseMotionListener(gridRowMouseHandler);
gridRowMouseHandler = new GridRowMouseHandler(this);
this.addMouseListener(gridRowMouseHandler);
this.addMouseMotionListener(gridRowMouseHandler);
this.setUI(new GridRowUI(resolution));
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution() {
return this.resolution;
}
/**
* Gets the preferred size.
*/
@ -52,7 +78,7 @@ public class GridRow extends GridHeader<Integer> {
* Calculates max char number.
*/
private int caculateMaxCharNumber(ElementCasePane reportPane) {
int maxCharNumber = 5;
int maxCharNumber = MAX;
maxCharNumber = Math.max(maxCharNumber, ("" + (reportPane.getGrid().getVerticalValue() + reportPane.getGrid().getVerticalExtent())).length() + 1);
return maxCharNumber;

34
designer/src/com/fr/grid/GridRowUI.java

@ -27,6 +27,14 @@ import com.fr.report.elementcase.ElementCase;
*/
public class GridRowUI extends ComponentUI {
private Color detailsBackground = Color.lightGray;
private int resolution ;
GridRowUI(int resolution){
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
this.resolution = resolution;
}
@Override
public void paint(Graphics g, JComponent c) {
@ -49,7 +57,6 @@ public class GridRowUI extends ComponentUI {
// paint more rows(double extent), for dragging.
int verticalEndValue = verticalValue + verticalExtent + 1;
double horizontalLineHeight = size.getHeight();
int resolution = ScreenResolution.getScreenResolution();
// use background to paint first.
// denny: 用来标识已有数据
@ -149,23 +156,20 @@ public class GridRowUI extends ComponentUI {
float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent();
double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth();
double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight();
// AUGUST:如果高度太小了就不画了
if (stringHeight <= tmpIncreaseHeight + 2) {
if (isSelectedBounds) {
g2d.setColor(gridRow.getSelectedForeground());
if (isSelectedBounds) {
g2d.setColor(gridRow.getSelectedForeground());
} else {
// p:检查eanbled
if (gridRow.isEnabled()) {
g2d.setColor(gridRow.getForeground());
} else {
// p:检查eanbled
if (gridRow.isEnabled()) {
g2d.setColor(gridRow.getForeground());
} else {
g2d.setPaint(UIManager.getColor("controlShadow"));
}
g2d.setPaint(UIManager.getColor("controlShadow"));
}
GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent
- 2);
}
GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent
- 2);
}
}

7
designer/src/com/fr/grid/GridUI.java

@ -429,6 +429,7 @@ public class GridUI extends ComponentUI {
this.calculateForcedPagingOfCellElement(reportPane, tmpCellElement, hideWidth, hideHeight);
storeFatherLocation(selectedCellElement, tmpCellElement);
// element bounds
// TODO: 2017/7/13 tmpRectangle : 72*19
this.caculateScrollVisibleBounds(this.tmpRectangle, tmpCellElement.getColumn(),
tmpCellElement.getRow(), tmpCellElement.getColumnSpan(),
tmpCellElement.getRowSpan());
@ -455,8 +456,9 @@ public class GridUI extends ComponentUI {
paintCellElementList.add(tmpCellElement);
paintCellElementRectangleList.add(this.tmpRectangle.clone());
int cellWidth = (int) this.tmpRectangle.getWidth(), cellHeight = (int) this.tmpRectangle
.getHeight();
int cellWidth = (int) this.tmpRectangle.getWidth();
int cellHeight = (int) this.tmpRectangle.getHeight();
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight);
@ -1077,6 +1079,7 @@ public class GridUI extends ComponentUI {
grid.ajustEditorComponentBounds(); // refresh size
}
private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) {
// 取出所有的行高和列宽的List
this.rowHeightList = ReportHelper.getRowHeightList(elementCase);

81
designer/src/com/fr/grid/GridUtils.java

@ -6,6 +6,7 @@ import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@ -48,6 +49,7 @@ public class GridUtils {
//peter:下面这几个量是在Drag列的时候用.
public final static int DRAG_CELL_SIZE = 1; //peter:drag的时候改变格子的宽度.
public final static int DRAG_SELECT_UNITS = 2; //peter:drag的时候,选中单元格.
// public static int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
/**
* Is above float element.(the return may be null). <br>
@ -67,7 +69,8 @@ public class GridUtils {
double[] floatArray = caculateFloatElementLocations(tmpFloatElement, ReportHelper.getColumnWidthList(report),
ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
//peter:悬浮元素的范围.
Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution));
//peter:不是当前选中的悬浮元素,不支持六个改变大小的点.
@ -123,8 +126,8 @@ public class GridUtils {
*/
public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
@ -166,7 +169,66 @@ public class GridUtils {
private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) {
double tmpIntIndex = 0;
int selectedCellIndex = 0;
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
if (mouseEvtPosition < 0) {
selectedCellIndex = value;
for (; true; selectedCellIndex--) {
if (tmpIntIndex < mouseEvtPosition) {
break;
}
tmpIntIndex -= sizeList.get(selectedCellIndex).toPixD(resolution);
}
} else {
boolean isInnerFrozen = false;
for (int i = beginValue; i < 0; i++) {
tmpIntIndex += sizeList.get(i).toPixD(resolution);
if (tmpIntIndex > mouseEvtPosition) {
selectedCellIndex = i;
isInnerFrozen = true;
break;
}
}
if (!isInnerFrozen) {
selectedCellIndex = value;
for (; true; selectedCellIndex++) {
tmpIntIndex += sizeList.get(selectedCellIndex).toPixD(resolution);
if (tmpIntIndex > mouseEvtPosition) {
break;
}
}
}
}
return selectedCellIndex;
}
public static ColumnRow getEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) {
ElementCase report = reportPane.getEditingElementCase();
// Width and height list.
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
int verticalValue = reportPane.getGrid().getVerticalValue();
int horizentalValue = reportPane.getGrid().getHorizontalValue();
// denny: get verticalBeginValue and horizontalBeginValue;
int verticalBeginValue = reportPane.getGrid().getVerticalBeginValue();
int horizontalBeginValue = reportPane.getGrid().getHorizontalBeginValue();
return ColumnRow.valueOf(
cc_selected_column_or_row_withresolution(evtX, horizontalBeginValue, horizentalValue, columnWidthList, resolution),
cc_selected_column_or_row_withresolution(evtY, verticalBeginValue, verticalValue, rowHeightList, resolution)
);
}
private static int cc_selected_column_or_row_withresolution(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList, int resolution) {
double tmpIntIndex = 0;
int selectedCellIndex = 0;
// int resolution = ScreenResolution.getScreenResolution();
if (mouseEvtPosition < 0) {
selectedCellIndex = value;
for (; true; selectedCellIndex--) {
@ -222,6 +284,16 @@ public class GridUtils {
return ColumnRow.valueOf(col, row);
}
public static ColumnRow getAdjustEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) {
ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int col = Math.max(selectedCellPoint.getColumn(), 0);
int row = Math.max(selectedCellPoint.getRow(), 0);
return ColumnRow.valueOf(col, row);
}
/**
* 是否可将当前单元格变为可见的格子
*/
@ -395,4 +467,5 @@ public class GridUtils {
}
}
}

18
designer/src/com/fr/poly/PolyArea.java

@ -1,15 +1,29 @@
package com.fr.poly;
import javax.swing.JComponent;
public class PolyArea extends JComponent {
private PolyDesigner polyDesigner;
private int resolution;
public PolyArea(PolyDesigner polyDesigner) {
public PolyArea(PolyDesigner polyDesigner, int resolution) {
this.polyDesigner = polyDesigner;
setUI(new PolyDesignUI());
this.resolution = resolution;
this.setUI(new PolyDesignUI(resolution));
// setUI(new PolyDesignUI());
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution() {
return this.resolution;
}
public PolyDesigner getPolyDesigner() {
return polyDesigner;
}

78
designer/src/com/fr/poly/PolyDesignUI.java

@ -10,6 +10,7 @@ import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -27,12 +28,14 @@ import com.fr.general.Inter;
import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider;
import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.model.AddedData;
import com.fr.poly.model.AddingData;
import com.fr.report.report.Report;
import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportConstants;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.UNIT;
/**
@ -44,13 +47,17 @@ public class PolyDesignUI extends ComponentUI {
private static final double SCROLL_POINT = 50;
private static final int SCROLL_DISTANCE = 15;
private static final int TEN = 10;
private static final int HHUNDRED = 100;
private PolyDesigner designer;
private int resolution = ScreenResolution.getScreenResolution();
private int ten = 10;
private int hundred = 100;
private int resolution;
private float time;
public PolyDesignUI() {
public PolyDesignUI(int resolution) {
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
this.resolution = resolution;
}
/**
@ -83,6 +90,8 @@ public class PolyDesignUI extends ComponentUI {
@Override
public void paint(Graphics g, JComponent c) {
this.resolution = ((PolyArea)c).getResolution();
this.time = (float)resolution/ScreenResolution.getScreenResolution();
paintBackground(g, c);
Graphics2D g2d = (Graphics2D) g;
paintAddedData(g2d);
@ -100,20 +109,20 @@ public class PolyDesignUI extends ComponentUI {
BlockCreator creator = addedData.getAddedAt(i);
// richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来
if (creator == designer.getSelection()) {
paintPositionLine(g, creator.getX(), creator.getY(), designer.getHorizontalValue(), designer
.getVerticalValue());
if (creator.getEditor().isDragging()) {
creator.getEditor().paintAbsorptionline(g);
//如果与其他块重合了, 需要画出提示禁止重叠
changeForbiddenWindowVisibility(creator);
//到边缘地带自动滚动
scrollWhenCreatorAtCorner(creator);
}else{
creator.getEditor().hideForbiddenWindow();
}
paintPositionLine(g, creator.getX(time), creator.getY(time),
(int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time));
if (creator.getEditor().isDragging()) {
creator.getEditor().paintAbsorptionline(g);
//如果与其他块重合了, 需要画出提示禁止重叠
changeForbiddenWindowVisibility(creator);
//到边缘地带自动滚动
scrollWhenCreatorAtCorner(creator);
}else{
creator.getEditor().hideForbiddenWindow();
}
} else {
paintCreator(g, creator, creator.getX() - designer.getHorizontalValue(), creator.getY() - designer.getVerticalValue(),
creator.getWidth(), creator.getHeight());
paintCreator(g, creator, (int) (creator.getX()*time - designer.getHorizontalValue()*time), (int) (creator.getY()*time - designer.getVerticalValue()*time),
(int) (creator.getWidth()*time), (int) (creator.getHeight()*time));
}
}
}
@ -126,8 +135,8 @@ public class PolyDesignUI extends ComponentUI {
return;
}
int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX() - designer.getHorizontalValue());
int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY() - designer.getVerticalValue());
int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX()*time - designer.getHorizontalValue());
int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY()*time - designer.getVerticalValue());
creator.getEditor().showForbiddenWindow(x, y);
}
@ -183,16 +192,16 @@ public class PolyDesignUI extends ComponentUI {
private String convertUnit(int i) {
short unit = designer.getRulerLengthUnit();
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
if (unit == Constants.UNIT_MM) {
Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution;
return j.intValue() + Inter.getLocText("Unit_MM");
} else if (unit == Constants.UNIT_CM) {
Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution;
return new DecimalFormat("0.0").format(j.intValue() * 1.0 / ten) + Inter.getLocText("Unit_CM");
return new DecimalFormat("0.0").format(j.intValue() * 1.0 / TEN) + Inter.getLocText("Unit_CM");
} else if (unit == Constants.UNIT_INCH) {
Double j = i == 0 ? 0 : (i + 2) * 1.0 / resolution * hundred;
return new DecimalFormat("0.00").format(j.intValue() * 1.0 / hundred) + Inter.getLocText("Unit_INCH");
Double j = i == 0 ? 0 : (i + 2) * 1.0 / resolution * HHUNDRED;
return new DecimalFormat("0.00").format(j.intValue() * 1.0 / HHUNDRED) + Inter.getLocText("Unit_INCH");
} else if (unit == Constants.UNIT_PT) {
int j = i == 0 ? 0 : (i + 2) * UNIT.PT_PER_INCH / resolution;
return j + Inter.getLocText("Unit_PT");
@ -203,10 +212,10 @@ public class PolyDesignUI extends ComponentUI {
private void paintAddingData(Graphics g, AddingData addingData) {
BlockCreator comp = addingData.getCreator();
int x = addingData.getCurrentX();
int y = addingData.getCurrentY();
int width = comp.getWidth();
int height = comp.getHeight();
int x = (int) (addingData.getCurrentX()*time);
int y = (int) (addingData.getCurrentY()*time);
int width = (int) (comp.getWidth()*time);
int height = (int) (comp.getHeight()*time);
paintCreator(g, comp, x, y, width, height);
}
@ -214,9 +223,16 @@ public class PolyDesignUI extends ComponentUI {
ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>();
// richer:禁止双缓冲行为,否则会出现两个图像
ComponentUtils.disableBuffer(comp, dbcomponents);
Graphics clipg = g.create(x, y, width, height);
comp.paint(clipg);
clipg.dispose();
// Graphics clipg = g.create(x, y, width*resolution/ScreenResolution.getScreenResolution(), height*resolution/ScreenResolution.getScreenResolution());
//
BufferedImage img = CoreGraphHelper.createBufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = img.createGraphics();
comp.printAll(g2d);
g2d.dispose();
g.drawImage(img,x,y,width,height,null);
// comp.paint(clipg);
// clipg.dispose();
ComponentUtils.resetBuffer(dbcomponents);
}

344
designer/src/com/fr/poly/PolyDesigner.java

@ -3,25 +3,6 @@
*/
package com.fr.poly;
import java.awt.AWTEvent;
import java.awt.Adjustable;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
@ -36,16 +17,7 @@ import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane;
import com.fr.design.mainframe.FormScrollBar;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
@ -61,11 +33,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.Selection;
import com.fr.poly.actions.DeleteBlockAction;
import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.BlockEditor;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.creator.ECBlockEditor;
import com.fr.poly.creator.PolyElementCasePane;
import com.fr.poly.creator.*;
import com.fr.poly.hanlder.DataEditingListener;
import com.fr.poly.hanlder.PolyDesignerDropTarget;
import com.fr.poly.model.AddedData;
@ -81,6 +49,15 @@ import com.fr.stable.unit.OLDPIX;
import com.fr.stable.unit.UNIT;
import com.fr.stable.unit.UnitRectangle;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/**
* @author richer
* @since 6.5.3 聚合报表的设计块不包括底部和右边的滚动条以及左边和上边的像素标识条
@ -99,6 +76,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
NONE, INNER, BLOCK
}
public JComponent polyArea;
private SelectionType selectedtype = SelectionType.NONE;
private AddingData addingData;
private AddedData addedData;
@ -108,20 +86,24 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private int horizontalValue = 0;
private int verticalValue = 0;
private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>();
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
private static final int ROTATIONS = 50;
private static final int MIN = 10;
private JScrollBar verScrollBar;
private JScrollBar horScrollBar;
private JComponent polyArea;
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar();
private JComponent[] toolBarComponent = null;
private int resolution = ScreenResolution.getScreenResolution();
private JPanel ployareaPane;
private JSliderPane jSliderContainer;
private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
private float time;
private boolean isCtrl = false;
public PolyDesigner(PolyWorkSheet report) {
super(report);
setDoubleBuffered(true);
// 为了处理键盘事件,需要FormDesigner能够获取焦点
setFocusable(true);
setFocusTraversalKeysEnabled(false);
@ -131,11 +113,13 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
setOpaque(true);
initComponents();
this.initDataListeners();
this.initPolyBlocks();
this.setFocusTraversalKeysEnabled(false);
new PolyDesignerDropTarget(this);
toolBarComponent = new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new DeleteBlockAction(this).createToolBarComponent()};
@ -155,9 +139,10 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
}
private void initComponents() {
jSliderContainer = ((JWorkBook) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).reportComposite.getjSliderContainer();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this);
ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this, resolution);
ployareaPane.add(PolyDesignerLayout.Center, polyArea);
horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this);
@ -169,8 +154,28 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
ployareaPane.add(PolyDesignerLayout.HRuler, new HorizontalRuler(this));
this.add(ployareaPane, BorderLayout.CENTER);
this.add(polyComponetsBar, BorderLayout.WEST);
this.addKeyListener(showValSpinnerKeyListener);
}
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
private void initPolyBlocks() {
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) {
TemplateBlock block = (TemplateBlock) getTarget().getBlock(i);
@ -181,10 +186,25 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
repaint();
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution() {
return this.resolution;
}
public void updateUI() {
((PolyArea) this.polyArea).setResolution(resolution);
polyArea.repaint();
// this.polyArea = (JComponent) new PolyArea(this, resolution);
}
/**
* 是否含有聚和报表块
* @param targetComponent 目标组件
* @return 是则返回true
*
* @param targetComponent 目标组件
* @return 是则返回true
*/
public boolean containsBlocks(TargetComponent targetComponent) {
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) {
@ -217,17 +237,23 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
}
public JPanel getPloyAreaPane() {
return this.ployareaPane;
}
/**
* 增加组件
* @param currentEditor 组件
* 增加组件
*
* @param currentEditor 组件
*/
public void addEditor(BlockEditor currentEditor) {
this.polyArea.add(currentEditor);
}
/**
* 移除组件
* @param currentEditor 组件
* 移除组件
*
* @param currentEditor 组件
*/
public void removeEditor(BlockEditor currentEditor) {
this.polyArea.remove(currentEditor);
@ -235,7 +261,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 权限编辑状态
* @return 权限编辑面板
*
* @return 权限编辑面板
*/
public AuthorityEditPane createAuthorityEditPane() {
if (elementCasePane == null) {
@ -250,16 +277,28 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
@Override
public void paintComponent(Graphics g) {
this.time = (float) resolution / ScreenResolution.getScreenResolution();
resetEditorComponentBounds();
LayoutUtils.layoutRootContainer(this);
g.setColor(Color.black);
GraphHelper.drawLine(g, 0, 0, this.getWidth(), 0);
GraphHelper.drawLine(g, 0, 0, 0, this.getHeight());
super.paintComponent(g);
}
private void resetEditorComponentBounds() {
if (selection != null) {
selection.setResolution(this.resolution);
selection.getEditor().setBounds((int) (selection.getEditorBounds().x * time), (int) (selection.getEditorBounds().y * time),
(int) (selection.getEditorBounds().width * time), (int) (selection.getEditorBounds().height * time));
LayoutUtils.layoutRootContainer(this);
}
}
/**
* 增加组件
* @param creator 组件
* 增加组件
*
* @param creator 组件
*/
public void addBlockCreator(BlockCreator creator) {
TemplateBlock block = creator.getValue();
@ -345,7 +384,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 选中的是否是报表块
* @return 是则返回true
*
* @return 是则返回true
*/
public boolean isSelectedECBolck() {
return this.selection instanceof ECBlockCreator;
@ -368,12 +408,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
repaint();
}
private void resetEditorComponentBounds() {
if (selection != null) {
selection.getEditor().setBounds(selection.getEditorBounds());
LayoutUtils.layoutRootContainer(this);
}
}
/**
* @return
@ -425,6 +459,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 黏贴
*
* @return 黏贴成功返回true
*/
public boolean paste() {
@ -484,6 +519,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 删除
*
* @return 删除成功返回true
*/
public boolean delete() {
@ -523,6 +559,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 剪切
*
* @return 剪切成功返回true
*/
public boolean cut() {
@ -533,8 +570,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 移动
* @param x 横坐标
* @param y 纵坐标
*
* @param x 横坐标
* @param y 纵坐标
*/
public void move(int x, int y) {
if (selection == null) {
@ -636,8 +674,14 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
int rotations = evt.getWheelRotation();
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS);
if (isCtrl) {
int dir = evt.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
} else {
int rotations = evt.getWheelRotation();
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS);
}
break;
}
}
@ -645,7 +689,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 开始编辑
* @param blockName 聚合块名称
*
* @param blockName 聚合块名称
*/
public void startEditing(String blockName) {
if (StringUtils.isBlank(blockName)) {
@ -835,18 +880,21 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
if (!ComparatorUtils.equals(selectedtype, type) || type == SelectionType.NONE) {
selectedtype = type;
JTemplate<?, ?> jt = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if(jt != null){
jt.setComposite();
}
if (jt != null) {
jt.setComposite();
}
DesignerContext.getDesignerFrame().resetToolkitByPlus(DesignerContext.getDesignerFrame().getSelectedJTemplate());
if (BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
} else if (isChooseBlock()) {
EastRegionContainerPane.getInstance().replaceDownPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
} else if (type != SelectionType.NONE) {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
} else {
EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
}
}
}
@ -873,8 +921,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
}
/**
* 是否选中聚合块本身
* @return 是则返回true
* 是否选中聚合块本身
*
* @return 是则返回true
*/
public boolean isChooseBlock() {
return selectedtype == SelectionType.BLOCK;
@ -922,89 +971,82 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 计算滚动条的值和max
* @param oldmax 之前最大值
* @param max 当前最大值
* @param newValue 当前value
* @param oldValue 之前value
* @param visi designer的大小
*
* @param oldmax 之前最大值
* @param max 当前最大值
* @param newValue 当前value
* @param oldValue 之前value
* @param visi designer的大小
* @param orientation 滚动条方向
* @return 计算后的值和max
*/
public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) {
return new Point(newValue, max);
}
/**
* 获取当前聚合报表区域左上角x坐标
*
* @return 当前聚合报表区域左上角x坐标
*
*/
public double getAreaLocationX(){
return polyArea.getLocationOnScreen().getX();
}
/**
* 获取当前聚合报表区域左上角y坐标
*
* @return 当前聚合报表区域左上角y坐标
*
*/
public double getAreaLocationY(){
return polyArea.getLocationOnScreen().getY();
}
/**
* 检测指定块是否与其他的块有重叠区域
*
* @param creator 指定的块编辑器
*
* @return 是否与其他的块有重叠区域
*
*/
public boolean intersectsAllBlock(BlockCreator creator){
return intersectsAllBlock(creator.getValue());
}
/**
* 检测指定块是否与其他的块有重叠区域
*
* @param block 指定的块
*
* @return 是否与其他的块有重叠区域
*
*/
public boolean intersectsAllBlock(TemplateBlock block){
UnitRectangle rec = block.getBounds();
String blockName = block.getBlockName();
return intersectsAllBlock(rec, blockName);
}
/**
* 检测指定块是否与其他的块有重叠区域
*
* @param rec 指定的块区域
* @param blockName 指定的块名称
*
* @return 是否与其他的块有重叠区域
*
*/
public boolean intersectsAllBlock(UnitRectangle rec, String blockName){
PolyWorkSheet worksheet = this.getTarget();
int count = worksheet.getBlockCount();
for (int i = 0; i < count; i++) {
Block temp_block = worksheet.getBlock(i);
UnitRectangle temp_rect = temp_block.getBounds();
if(ComparatorUtils.equals(blockName, temp_block.getBlockName())){
continue;
}
if(temp_rect.intersects(rec)){
return true;
}
}
return false;
}
public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) {
return new Point(newValue, max);
}
/**
* 获取当前聚合报表区域左上角x坐标
*
* @return 当前聚合报表区域左上角x坐标
*/
public double getAreaLocationX() {
return polyArea.getLocationOnScreen().getX();
}
/**
* 获取当前聚合报表区域左上角y坐标
*
* @return 当前聚合报表区域左上角y坐标
*/
public double getAreaLocationY() {
return polyArea.getLocationOnScreen().getY();
}
/**
* 检测指定块是否与其他的块有重叠区域
*
* @param creator 指定的块编辑器
* @return 是否与其他的块有重叠区域
*/
public boolean intersectsAllBlock(BlockCreator creator) {
return intersectsAllBlock(creator.getValue());
}
/**
* 检测指定块是否与其他的块有重叠区域
*
* @param block 指定的块
* @return 是否与其他的块有重叠区域
*/
public boolean intersectsAllBlock(TemplateBlock block) {
UnitRectangle rec = block.getBounds();
String blockName = block.getBlockName();
return intersectsAllBlock(rec, blockName);
}
/**
* 检测指定块是否与其他的块有重叠区域
*
* @param rec 指定的块区域
* @param blockName 指定的块名称
* @return 是否与其他的块有重叠区域
*/
public boolean intersectsAllBlock(UnitRectangle rec, String blockName) {
PolyWorkSheet worksheet = this.getTarget();
int count = worksheet.getBlockCount();
for (int i = 0; i < count; i++) {
Block temp_block = worksheet.getBlock(i);
UnitRectangle temp_rect = temp_block.getBounds();
if (ComparatorUtils.equals(blockName, temp_block.getBlockName())) {
continue;
}
if (temp_rect.intersects(rec)) {
return true;
}
}
return false;
}
}

9
designer/src/com/fr/poly/creator/BlockCreator.java

@ -75,6 +75,10 @@ public abstract class BlockCreator<T extends TemplateBlock> extends JComponent i
LayoutUtils.layoutContainer(this);
}
public void setResolution(int resolution){
this.resolution = resolution;
}
//默认大小, 报表块默认3列6行, 图表块默认330*240
public abstract UnitRectangle getDefaultBlockBounds();
@ -85,6 +89,11 @@ public abstract class BlockCreator<T extends TemplateBlock> extends JComponent i
public abstract BlockEditor getEditor();
public abstract int getX(float time);
public abstract int getY(float time);
/**
* 检测按钮状态

2
designer/src/com/fr/poly/creator/BlockEditor.java

@ -50,7 +50,7 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock>
public BlockEditor(PolyDesigner designer, BlockCreator<U> creator) {
this.designer = designer;
this.creator = creator;
this.resolution = creator.resolution;
this.initComponets();
this.addColumnRowListeners();

23
designer/src/com/fr/poly/creator/ChartBlockCreator.java

@ -3,13 +3,15 @@
*/
package com.fr.poly.creator;
import java.awt.Color;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.*;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
@ -34,6 +36,7 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
private static final UNIT DEFAULT_WIDTH = FU.getInstance(12573000);
private static final UNIT DEFAULT_HEIGHT = FU.getInstance(9144000);
public ChartBlockCreator() {
}
@ -42,6 +45,10 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
super(block);
}
public void setResolution(int resolution){
this.resolution = resolution;
}
/**
* 初始化
* @return 初始化的控件.
@ -64,6 +71,16 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
return editor;
}
@Override
public int getX(float time) {
return (int) (this.getX() * time);
}
@Override
public int getY(float time) {
return (int) (this.getY() * time);
}
/**
* 检测按钮状态

13
designer/src/com/fr/poly/creator/ChartBlockEditor.java

@ -5,6 +5,7 @@ package com.fr.poly.creator;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGetter;
@ -13,6 +14,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.cell.QuickEditorRegion;
@ -25,6 +27,7 @@ import com.fr.poly.PolyDesigner.SelectionType;
import com.fr.poly.hanlder.ColumnOperationMouseHandler;
import com.fr.poly.hanlder.RowOperationMouseHandler;
import com.fr.report.poly.PolyChartBlock;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
@ -32,6 +35,7 @@ import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
/**
* @author richer
@ -43,6 +47,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
private static Border buttonBorder;
private static String[][] chartsNames;
private static BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames();
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
static {
buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5);
@ -60,8 +65,14 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) {
super(designer, creator);
this.resolution = creator.resolution;
//shine:和产品商量后决定把最上面一排切换按钮去掉
//this.initNorthBarComponent();
// this.initNorthBarComponent();
}
private void setResolution(int resolution){
this.resolution = resolution;
}
private void initNorthBarComponent() {

13
designer/src/com/fr/poly/creator/ECBlockCreator.java

@ -23,6 +23,9 @@ import com.fr.stable.unit.UnitRectangle;
*/
public class ECBlockCreator extends BlockCreator<PolyECBlock> {
private ECBlockEditor editor;
private static final int CREATOR_WIDTH = 30;
private static final int CREATOR_HEIGHT = 19;
public ECBlockCreator() {
@ -64,6 +67,16 @@ public class ECBlockCreator extends BlockCreator<PolyECBlock> {
return editor;
}
@Override
public int getX(float time) {
return (int) ((this.getX() - CREATOR_WIDTH) * time) + CREATOR_WIDTH;
}
@Override
public int getY(float time) {
return (int) ((this.getY() - CREATOR_HEIGHT) * time) + CREATOR_HEIGHT;
}
/**
* 检测按钮状态
*

7
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -6,6 +6,7 @@ package com.fr.poly.creator;
import java.awt.Dimension;
import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@ -70,6 +71,10 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
@Override
protected void initSize() {
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Dimension cornerSize = getCornerSize();
PolyECBlock block = getValue();
UnitRectangle ub = block.getBounds();
@ -142,6 +147,6 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
}
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent);
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
}
}

34
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -3,7 +3,10 @@
*/
package com.fr.design;
import com.fr.base.*;
import com.fr.base.BaseXMLUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.Utils;
import com.fr.dav.LocalEnv;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
@ -18,7 +21,6 @@ import com.fr.stable.xml.*;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
import java.awt.*;
import java.io.*;
import java.util.*;
@ -26,7 +28,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import org.apache.log4j.Level;
/**
* The manager of Designer GUI.
@ -150,17 +152,19 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
designerEnvManager.setCurEnvName(name);
}
}
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX);
designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME);
}
});
}
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
designerEnvManager.setCurrentDirectoryPrefix(FILEFactory.ENV_PREFIX);
designerEnvManager.setDialogCurrentDirectory(ProjectConstants.REPORTLETS_NAME);
}
});
return designerEnvManager;
}
@ -1798,8 +1802,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (env == null) {
return;
}
writer.startTAG("Env").attr("class", env.getClass().getName()).attr("name", name);
writer.startTAG("Env");
writer.classAttr(env.getClass());
writer.attr("name", name);
env.writeXML(writer);

2
designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java

@ -1 +1 @@
package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } }
package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } }

1
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -327,6 +327,7 @@ public class LoginWebBridge {
DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setBbsUid(uid);
DesignerEnvManager.getEnvManager().setInShowBBsName(username);
BBSPluginLogin.getInstance().login(new BBSUserInfo(username, ""));
} else if (status.equals(LOGIN_FAILED)) {
//账号没有QQ授权
closeQQWindow();

7
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -509,6 +509,13 @@ public class PluginWebBridge {
LoginWebBridge.getHelper().showQQ();
}
//通过QQ登录后通知登录
public void ucsynLogin(long uid, String username){
BBSUserInfo bbsUserInfo = new BBSUserInfo(username, "");
BBSPluginLogin.getInstance().login(bbsUserInfo);
uiLabel.setText(username);
}
/**
* 清除用户信息
*/

36
designer_base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -80,21 +80,29 @@ public class WebViewDlgHelper {
public static void checkAndCopyMainFile(String indexPath, String mainJsPath){
File file = new File(indexPath);
if (!file.exists()) {
try {
File mainJsFile = new File(mainJsPath);
int byteread = 0;
if (mainJsFile.exists()) {
InputStream inStream = new FileInputStream(mainJsPath);
FileOutputStream fs = new FileOutputStream(indexPath);
byte[] buffer = new byte[BYTES_NUM];
while ((byteread = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteread);
}
inStream.close();
copyMainFile(indexPath, mainJsPath);
}
}
/**
* 將script文件夹中的index.html文件复制到webreport下
*
*/
public static void copyMainFile(String indexPath, String mainJsPath){
try {
File mainJsFile = new File(mainJsPath);
int byteread = 0;
if (mainJsFile.exists()) {
InputStream inStream = new FileInputStream(mainJsPath);
FileOutputStream fs = new FileOutputStream(indexPath);
byte[] buffer = new byte[BYTES_NUM];
while ((byteread = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteread);
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
inStream.close();
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
@ -186,7 +194,9 @@ public class WebViewDlgHelper {
try {
if (get()) {
String relativePath = "/scripts/store/web/index.html";
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
copyMainFile(StableUtils.pathJoin(installHome, "index.html"), StableUtils.pathJoin(installHome, relativePath));
// TODO: 2017/4/17 删除之前存放在安装目录下的script
int rv = JOptionPane.showOptionDialog(
null,

111
designer_base/src/com/fr/design/foldablepane/HeaderPane.java

@ -0,0 +1,111 @@
package com.fr.design.foldablepane;
import com.fr.design.constants.UIConstants;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
/**
* Created by MoMeak on 2017/7/5.
*/
public class HeaderPane extends JPanel {
private static final long serialVersionUID = 1L;
private int headWidth = 280;
private int headHeight = 25;
private Color bgColor;
private boolean isShow;
private String title;
private Image image;
private int fontSize = 13;
public void setShow(boolean isShow) {
this.isShow = isShow;
}
public void setTitle(String title)
{
this.title = title;
}
public void setHeadWidth(int headwidth){
this.headWidth = headwidth;
}
public void setheadHeight(int headHeight){
this.headHeight = headHeight;
}
public void setFontSize(int fontSize){
this.fontSize = fontSize;
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
BufferedImage panelImage = createPanelImage();
g2d.drawImage(panelImage, null, 0, 0);
}
private BufferedImage createPanelImage() {
BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = panelImage.createGraphics();
g2d.fillRect(0, 0, headWidth, headHeight);
g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null);
g2d.setFont(new Font("SimSun", 0, fontSize));
g2d.setPaint(bgColor);
// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3);
g2d.drawString(this.title, 0, headHeight-fontSize/3);
if(this.isShow)
{
image = UIConstants.DRAG_DOWN_PRESS;
g2d.drawImage(image, title.length() * fontSize, headHeight/2-1, null);
}
else
{
image = UIConstants.DRAG_RIGHT_PRESS;
g2d.drawImage(image, title.length() * fontSize, headHeight/3, null);
}
return panelImage;
}
@Override
public Dimension getPreferredSize() {
return new Dimension(this.getWidth(), headHeight);
}
@Override
public Dimension getSize() {
return new Dimension(this.getWidth(), headHeight);
}
public HeaderPane(Color bgColor) {
this.bgColor = bgColor;
this.isShow = true;
}
public HeaderPane(Color bgColor, String title , int headWidth, int headHeight) {
this(bgColor);
this.title = title;
this.headHeight = headHeight;
this.headWidth = headWidth;
}
public static void main(String[] args)
{
// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
// mainFrame.getContentPane().setLayout(new BorderLayout());
// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本",280,25), BorderLayout.CENTER);
// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// mainFrame.pack();
// mainFrame.setSize(280, 400);
// mainFrame.setVisible(true);
}
}

95
designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java

@ -0,0 +1,95 @@
package com.fr.design.foldablepane;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
/**
* Created by MoMeak on 2017/7/5.
*/
public class UIExpandablePane extends JPanel {
private static final long serialVersionUID = 1L;
private HeaderPane headerPanel;
private JPanel contentPanel;
private Color color = Color.black;
private String title;
private int headWidth;
private int headHeight;
public UIExpandablePane(String title,int headWidth,int headHeight,JPanel contentPanel)
{
super();
this.title = title;
this.headWidth = headWidth;
this.headHeight = headHeight;
this.contentPanel = contentPanel;
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
headerPanel = new HeaderPane(color, title,headWidth,headHeight);
headerPanel.addMouseListener(new PanelAction());
this.add(headerPanel, BorderLayout.NORTH);
this.add(contentPanel, BorderLayout.CENTER);
setOpaque(false);
}
class PanelAction extends MouseAdapter
{
public void mousePressed(MouseEvent e)
{
HeaderPane hp = (HeaderPane)e.getSource();
if(contentPanel.isShowing())
{
contentPanel.setVisible(false);
hp.setShow(false);
}
else
{
contentPanel.setVisible(true);
hp.setShow(true);
}
hp.getParent().validate();
hp.getParent().repaint();
}
}
public static void main(String[] args)
{
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
//
// JPanel myPanel = new JPanel();
// myPanel.setLayout(new BorderLayout());
// JPanel Panel = new JPanel();
// Panel.setBackground(Color.blue);
// myPanel.add(new UIExpandablePane("基本",280,25,Panel),BorderLayout.CENTER);
//// myPanel.setLayout(new GridBagLayout());
//// myPanel.add(new JExpandablePanel());
//// GridBagConstraints gbc = new GridBagConstraints();
//// JPanel[] panels = new JPanel[4]; //
//// gbc.insets = new Insets(1,3,0,3);
//// gbc.weightx = 1.0;
//// gbc.fill = GridBagConstraints.HORIZONTAL;
//// gbc.gridwidth = GridBagConstraints.REMAINDER;
//// for(int j = 0; j < panels.length; j++)
//// {
//// panels[j] = new JExpandablePanel();
//// myPanel.add(panels[j], gbc);
//// }
// content.add(myPanel, BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(280, 400);
// jf.setVisible(true);
}
}

286
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -0,0 +1,286 @@
package com.fr.design.gui.controlpane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import javax.swing.*;
import java.awt.*;
/**
* Created by plough on 2017/7/21.
*/
public abstract class UIControlPane extends BasicPane implements UnrepeatedNameHelper {
protected static final int SHORT_WIDTH = 30; //每加一个short Divider位置加30
protected JPanel controlUpdatePane;
private ShortCut4JControlPane[] shorts;
private NameableCreator[] creators;
private ToolBarDef toolbarDef;
private UIToolbar toolBar;
protected PopupEditPane popupEditPane;
// peter:这是整体的一个cardLayout Pane
protected CardLayout cardLayout;
protected JPanel cardPane;
public UIControlPane() {
this.initComponentPane();
}
/**
* 生成添加按钮的NameableCreator
*
* @return 按钮的NameableCreator
*/
public abstract NameableCreator[] createNameableCreators();
public ShortCut4JControlPane[] getShorts() {
return shorts;
}
public void setShorts(ShortCut4JControlPane[] shorts) {
this.shorts = shorts;
}
public void setCreators(NameableCreator[] creators) {
this.creators = creators;
}
public ToolBarDef getToolbarDef() {
return toolbarDef;
}
public void setToolbarDef(ToolBarDef toolbarDef) {
this.toolbarDef = toolbarDef;
}
public UIToolbar getToolBar() {
return toolBar;
}
public void setToolBar(UIToolbar toolBar) {
this.toolBar = toolBar;
}
public CardLayout getCardLayout() {
return cardLayout;
}
public void setCardLayout(CardLayout cardLayout) {
this.cardLayout = cardLayout;
}
public JPanel getCardPane() {
return cardPane;
}
public void setCardPane(JPanel cardPane) {
this.cardPane = cardPane;
}
protected void initComponentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creators = this.createNameableCreators();
this.controlUpdatePane = createControlUpdatePane();
// p: edit card layout
this.cardLayout = new CardLayout();
cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardPane.setLayout(this.cardLayout);
// p:选择的Label
UILabel selectLabel = new UILabel();
cardPane.add(selectLabel, "SELECT");
cardPane.add(controlUpdatePane, "EDIT");
popupEditPane = new PopupEditPane(cardPane);
// SplitPane
// JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
// mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
// mainSplitPane.setOneTouchExpandable(true);
this.add(getLeftPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 12, 10));
// mainSplitPane.setDividerLocation(getLeftPreferredSize());
this.checkButtonEnabled();
}
protected abstract JPanel createControlUpdatePane();
protected JPanel getLeftPane() {
// LeftPane
JPanel leftPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel leftContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initLeftPane(leftContentPane);
leftPane.add(leftContentPane, BorderLayout.CENTER);
shorts = this.createShortcuts();
if (ArrayUtils.isEmpty(shorts)) {
return leftPane;
}
toolbarDef = new ToolBarDef();
for (ShortCut4JControlPane sj : shorts) {
toolbarDef.addShortCut(sj.getShortCut());
}
toolBar = ToolBarDef.createJToolBar();
// toolBar.setLayout(new FlowLayout(FlowLayout.LEFT));
toolbarDef.updateToolBar(toolBar);
// 封装一层,加边框
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(201, 198, 184)));
leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184)));
// 顶部标签及add按钮
UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
ShortCut addItem = addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar);
topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p};
Component[][] components = new Component[][]{
new Component[]{new UILabel("add hyperlink "), topToolBar},
};
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH);
return leftPane;
}
/**
* 初始化左边面板
*/
protected void initLeftPane(JPanel leftPane) {
}
protected int getLeftPreferredSize() {
return shorts.length * SHORT_WIDTH;
}
protected ShortCut4JControlPane[] createShortcuts() {
return new ShortCut4JControlPane[]{
// addItemShortCut(),
copyItemShortCut(),
moveUpItemShortCut(),
moveDownItemShortCut(),
sortItemShortCut(),
removeItemShortCut()
};
}
protected abstract ShortCut4JControlPane addItemShortCut();
protected abstract ShortCut4JControlPane removeItemShortCut();
protected abstract ShortCut4JControlPane copyItemShortCut();
protected abstract ShortCut4JControlPane moveUpItemShortCut();
protected abstract ShortCut4JControlPane moveDownItemShortCut();
protected abstract ShortCut4JControlPane sortItemShortCut();
public abstract Nameable[] update();
public void populate(Nameable[] nameableArray) {
}
/**
* 检查按钮可用状态 Check button enabled.
*/
public void checkButtonEnabled() {
}
protected void doBeforeRemove() {
}
protected void doAfterRemove() {
}
public NameableCreator[] creators() {
return creators == null ? new NameableCreator[0] : creators;
}
protected abstract boolean hasInvalid(boolean isAdd);
/**
* 刷新 NameableCreator
*
* @param creators 生成器
*/
public void refreshNameableCreator(NameableCreator[] creators) {
this.creators = creators;
shorts = this.createShortcuts();
toolbarDef.clearShortCuts();
for (ShortCut4JControlPane sj : shorts) {
toolbarDef.addShortCut(sj.getShortCut());
}
toolbarDef.updateToolBar(toolBar);
toolBar.validate();
toolBar.repaint();
this.repaint();
}
// 点击"编辑"按钮,弹出面板
protected class PopupEditPane extends JPopupMenu {
private JComponent contentPane;
private static final int WIDTH = 460;
private static final int HEIGHT = 500;
// private PopupToolPane popupToolPane;
// private int fixedHeight;
PopupEditPane(JComponent pane) {
contentPane = pane;
this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.CENTER);
this.setOpaque(false);
contentPane.setPreferredSize(new Dimension(WIDTH, HEIGHT));
// fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height;
// updateSize();
}
// private void updateSize() {
// int newHeight = fixedHeight + contentPane.getPreferredSize().height;
// this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
// }
public JComponent getContentPane() {
return contentPane;
}
public void replaceContentPane(JComponent pane) {
// remove(pane);
this.remove(this.contentPane);
this.add(this.contentPane = pane);
// updateSize();
refreshContainer();
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
}
}

974
designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -0,0 +1,974 @@
package com.fr.design.gui.controlpane;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.core.PropertyChangeAdapter;
import sun.swing.DefaultLookup;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Comparator;
/**
* Created by plough on 2017/7/19.
*/
public abstract class UIListControlPane extends UIControlPane {
public static final String LIST_NAME = "UIControl_List";
private static final int EDIT_RANGE = 25; // 编辑按钮的x坐标范围
protected UINameEdList nameableList;
protected int editingIndex;
protected String selectedName;
private boolean isNameRepeated = false;
public UIListControlPane() {
this.initComponentPane();
}
@Override
protected JPanel createControlUpdatePane() {
return new JControlUpdatePane();
}
/**
* 生成添加按钮的NameableCreator
*
* @return 按钮的NameableCreator
*/
@Override
public abstract NameableCreator[] createNameableCreators();
@Override
protected void initLeftPane(JPanel leftPane) {
nameableList = createJNameList();
nameableList.setName(LIST_NAME);
leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER);
nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
nameableList.addMouseListener(listMouseListener);
nameableList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
// richie:避免多次update和populate大大降低效率
if (!evt.getValueIsAdjusting()) {
// shoc 切换的时候加检验
if (hasInvalid(false)) {
return;
}
((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).update();
((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate();
UIListControlPane.this.checkButtonEnabled();
}
}
});
}
public UINameEdList createJNameList() {
UINameEdList nameEdList = new UINameEdList(new DefaultListModel()) {
@Override
protected void doAfterLostFocus() {
UIListControlPane.this.updateControlUpdatePane();
}
};
nameEdList.setCellRenderer(new UINameableListCellRenderer(this));
return nameEdList;
}
public void updateControlUpdatePane() {
((JControlUpdatePane) controlUpdatePane).update();
}
protected void doWhenPopulate(BasicBeanPane beanPane) {
}
protected void doBeforePopulate(ListModelElement el, Object obj) {
}
@Override
protected ShortCut4JControlPane addItemShortCut() {
ShortCut addItemShortCut;
NameableCreator[] creators = creators();
if (creators.length == 1) {
addItemShortCut = new AddItemUpdateAction(creators);
} else {
addItemShortCut = new AddItemMenuDef(creators);
}
return new AbsoluteEnableShortCut(addItemShortCut);
}
@Override
protected ShortCut4JControlPane removeItemShortCut() {
return new NormalEnableShortCut(new RemoveItemAction());
}
@Override
protected ShortCut4JControlPane copyItemShortCut() {
return new NormalEnableShortCut(new CopyItemAction());
}
@Override
protected ShortCut4JControlPane moveUpItemShortCut() {
return new NormalEnableShortCut(new MoveUpItemAction());
}
@Override
protected ShortCut4JControlPane moveDownItemShortCut() {
return new NormalEnableShortCut(new MoveDownItemAction());
}
@Override
protected ShortCut4JControlPane sortItemShortCut() {
return new NormalEnableShortCut(new SortItemAction());
}
public void setNameListEditable(boolean editable) {
this.nameableList.setEditable(editable);
}
@Override
public Nameable[] update() {
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>();
((JControlUpdatePane) this.controlUpdatePane).update();
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
for (int i = 0, len = listModel.getSize(); i < len; i++) {
res.add(((ListModelElement) listModel.getElementAt(i)).wrapper);
}
return res.toArray(new Nameable[res.size()]);
}
@Override
public void populate(Nameable[] nameableArray) {
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
listModel.removeAllElements();
if (ArrayUtils.isEmpty(nameableArray)) {
return;
}
for (Nameable aNameableArray : nameableArray) {
listModel.addElement(new ListModelElement(aNameableArray));
}
if (listModel.size() > 0) {
this.nameableList.setSelectedIndex(0);
}
this.checkButtonEnabled();
}
/**
* 添加名字改变时的listener
*
* @param l 名字改变时的监听
*/
public void addModNameActionListener(ModNameActionListener l) {
this.nameableList.addModNameActionListener(l);
}
/**
* 添加Editinglistener
*
* @param l 监听
*/
public void addEditingListner(PropertyChangeAdapter l) {
this.nameableList.addEditingListner(l);
}
/*
* 刷新当前的选中的UpdatePane
*/
protected void populateSelectedValue() {
((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate();
}
/**
* 根据name,选中UINameEdList中的item
*/
public void setSelectedName(String name) {
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
for (int i = 0, len = listModel.getSize(); i < len; i++) {
Nameable item = ((ListModelElement) listModel.getElementAt(i)).wrapper;
if (ComparatorUtils.equals(name, item.getName())) {
this.nameableList.setSelectedIndex(i);
break;
}
}
}
public String getEditingName() {
return this.nameableList.getEditingName();
}
public Object getEditingType() {
return this.nameableList.getAllTypes()[editingIndex];
}
public void setWarnigText(int index) {
this.nameableList.setWarnigText(index);
}
/**
* 获取选中的名字
*/
public String getSelectedName() {
ListModelElement el = (ListModelElement) this.nameableList.getSelectedValue();
return el == null ? null : el.wrapper.getName();
}
protected boolean isNameRepeted(java.util.List[] list, String name) {
for (int i = 0; i < list.length; i++) {
if (list[i].contains(name)) {
isNameRepeated = true;
return true;
}
}
isNameRepeated = false;
return false;
}
/**
* 名字是否重复
*
* @return 重复则返回true
*/
public boolean isNameRepeated() {
return isNameRepeated;
}
/**
* 添加 Nameable
*
* @param nameable 添加的Nameable
* @param index 序号
*/
public void addNameable(Nameable nameable, int index) {
UINameEdList nameEdList = UIListControlPane.this.nameableList;
DefaultListModel model = (DefaultListModel) nameEdList.getModel();
ListModelElement el = new ListModelElement(nameable);
model.add(index, el);
nameableList.setSelectedIndex(index);
nameableList.ensureIndexIsVisible(index);
nameEdList.repaint();
}
/**
* 是否重命名
*
* @return 是则true
*/
public boolean isContainsRename() {
String rename = Inter.getLocText("FR-Please_Rename") + "!";
String[] names = this.nameableList.getAllNames();
for (int i = names.length - 1; i >= 0; i--) {
if (ComparatorUtils.equals(names[i], rename)) {
return true;
}
}
return false;
}
protected DefaultListModel getModel() {
return (DefaultListModel) UIListControlPane.this.nameableList.getModel();
}
private String createUnrepeatedCopyName(String suffix) {
DefaultListModel model = this.getModel();
String[] names = new String[model.getSize()];
for (int i = 0; i < model.size(); i++) {
names[i] = ((ListModelElement) model.get(i)).wrapper.getName();
}
String lastName = "CopyOf" + suffix;
while (ArrayUtils.contains(names, lastName)) {
lastName = "CopyOf" + lastName;
}
return lastName;
}
/**
* 生成不重复的名字
*
* @param prefix 名字前缀
* @return 名字
*/
@Override
public String createUnrepeatedName(String prefix) {
DefaultListModel model = this.getModel();
Nameable[] all = new Nameable[model.getSize()];
for (int i = 0; i < model.size(); i++) {
all[i] = ((ListModelElement) model.get(i)).wrapper;
}
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
int count = all.length + 1;
while (true) {
String name_test = prefix + count;
boolean repeated = false;
for (int i = 0, len = model.size(); i < len; i++) {
Nameable nameable = all[i];
if (ComparatorUtils.equals(nameable.getName(), name_test)) {
repeated = true;
break;
}
}
if (!repeated) {
return name_test;
}
count++;
}
}
private void popupEditPane() {
if (editingIndex < 0) {
return;
}
GUICoreUtils.showPopupMenu(popupEditPane, this,
- popupEditPane.getPreferredSize().width, editingIndex * EDIT_RANGE);
}
/**
* 增加项的UpdateAction
*/
protected class AddItemUpdateAction extends UpdateAction {
final NameableCreator creator;
public AddItemUpdateAction(NameableCreator[] creators) {
this.creator = creators[0];
this.setName(Inter.getLocText("FR-Action_Add"));
this.setMnemonic('A');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
Nameable nameable = creator.createNameable(UIListControlPane.this);
UIListControlPane.this.addNameable(nameable, getModel().getSize());
}
}
/*
* 增加项的MenuDef
*/
protected class AddItemMenuDef extends MenuDef {
public AddItemMenuDef(NameableCreator[] creators) {
this.setName(Inter.getLocText("FR-Action_Add"));
this.setMnemonic('A');
this.setIconPath("/com/fr/design/images/control/addPopup.png");
wrapActionListener(creators);
}
/**
* 生成UIButton
* @return 菜单按钮
*/
public UIButton createUIButton() {
createdButton = super.createUIButton();
// 此按钮单独抽出,不应使用工具栏外观
if (!createdButton.isOpaque()) {
createdButton.setOpaque(true);
createdButton.setNormalPainted(true);
createdButton.setBorderPaintedOnlyWhenPressed(false);
}
return createdButton;
}
private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) {
if (!whetherAdd(creator.menuName())) {
continue;
}
boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) ||
ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), Inter.getLocText("DS-Multi_Dimensional_Database"));
if (isTrue) {
this.addShortCut(new LineSeparator());
}
this.addShortCut(new UpdateAction() {
{
this.setName(creator.menuName());
Icon icon = creator.menuIcon();
if (icon != null) {
this.setSmallIcon(icon);
}
}
@Override
public void actionPerformed(ActionEvent e) {
if (hasInvalid(true)) {
return;
}
Nameable nameable = creator.createNameable(UIListControlPane.this);
UIListControlPane.this.addNameable(nameable, getModel().getSize());
}
});
}
}
private boolean whetherAdd(String itemName) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate == null) {
return false;
}
//先屏蔽掉这个,之后还有别的
String[] names = {Inter.getLocText("FR-Hyperlink_Chart_Float")};
for (String name : names) {
if (!jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, name)) {
return false;
}
}
String formName = Inter.getLocText("Hyperlink-Form_link");
return !(jTemplate.isJWorkBook() && ComparatorUtils.equals(itemName, formName));
}
}
/*
* 移除item
*/
private class RemoveItemAction extends UpdateAction {
public RemoveItemAction() {
this.setName(Inter.getLocText("FR-Action_Remove"));
this.setMnemonic('R');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/base/images/cell/control/remove.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
try {
UIListControlPane.this.nameableList.getCellEditor()
.stopCellEditing();
} catch (Exception ignored) {
}
// bug:在选中一个NameObject并删除,会遗留下Name.
doBeforeRemove();
if (GUICoreUtils.removeJListSelectedNodes(SwingUtilities
.getWindowAncestor(UIListControlPane.this), nameableList)) {
checkButtonEnabled();
doAfterRemove();
}
}
}
/*
* CopyItem
*/
private class CopyItemAction extends UpdateAction {
public CopyItemAction() {
this.setName(Inter.getLocText("FR-Action_Copy"));
this.setMnemonic('C');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/base/images/cell/control/copy.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
// p:选中的值.
ListModelElement selectedValue = (ListModelElement) nameableList.getSelectedValue();
if (selectedValue == null) {
return;
}
((JControlUpdatePane) controlUpdatePane).update();
Nameable selectedNameable = selectedValue.wrapper;
// p: 用反射机制实现
try {
Nameable newNameable = (Nameable) BaseUtils.cloneObject(selectedNameable);
newNameable.setName(createUnrepeatedCopyName(selectedNameable.getName()));
UIListControlPane.this.addNameable(newNameable, nameableList.getSelectedIndex() + 1);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
}
/*
* 上移Item
*/
private class MoveUpItemAction extends UpdateAction {
public MoveUpItemAction() {
this.setName(Inter.getLocText("Utils-Move_Up"));
this.setMnemonic('U');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/control/up.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
int selectedIndex = nameableList.getSelectedIndex();
if (selectedIndex == -1) {
return;
}
// 上移
if (selectedIndex > 0) {
DefaultListModel listModel = (DefaultListModel) nameableList
.getModel();
Object selecteObj1 = listModel.get(selectedIndex - 1);
listModel.set(selectedIndex - 1, listModel.get(selectedIndex));
listModel.set(selectedIndex, selecteObj1);
nameableList.setSelectedIndex(selectedIndex - 1);
nameableList.ensureIndexIsVisible(selectedIndex - 1);
}
}
}
/*
* 下移Item
*/
private class MoveDownItemAction extends UpdateAction {
public MoveDownItemAction() {
this.setName(Inter.getLocText("Utils-Move_Down"));
this.setMnemonic('D');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/control/down.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
int selectedIndex = nameableList.getSelectedIndex();
if (selectedIndex == -1) {
return;
}
if (selectedIndex < nameableList.getModel().getSize() - 1) {
DefaultListModel listModel = (DefaultListModel) nameableList
.getModel();
Object selecteObj1 = listModel.get(selectedIndex + 1);
listModel.set(selectedIndex + 1, listModel.get(selectedIndex));
listModel.set(selectedIndex, selecteObj1);
nameableList.setSelectedIndex(selectedIndex + 1);
nameableList.ensureIndexIsVisible(selectedIndex + 1);
}
}
}
private class SortItemAction extends UpdateAction {
private boolean isAtoZ = false;
public SortItemAction() {
this.setName(Inter.getLocText("FR-Action_Sort"));
this.setMnemonic('S');
this.setSmallIcon(BaseUtils
.readIcon("/com/fr/design/images/control/sortAsc.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
// p:选中的值.
Object selectedValue = nameableList.getSelectedValue();
DefaultListModel listModel = (DefaultListModel) nameableList
.getModel();
Nameable[] nameableArray = new Nameable[listModel.getSize()];
if (nameableArray.length <= 0) {
return;
}
for (int i = 0; i < listModel.getSize(); i++) {
nameableArray[i] = ((ListModelElement) listModel.getElementAt(i)).wrapper;
}
// p:排序.
if (isAtoZ) {
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() {
@Override
public int compare(Nameable o1, Nameable o2) {
return -ComparatorUtils.compare(o1.getName(), o2
.getName());
}
};
isAtoZ = !isAtoZ;
Arrays.sort(nameableArray, nameableComparator);
} else {
Comparator<Nameable> nameableComparator = new Comparator<Nameable>() {
@Override
public int compare(Nameable o1, Nameable o2) {
return ComparatorUtils.compare(o1.getName(), o2
.getName());
}
};
isAtoZ = !isAtoZ;
Arrays.sort(nameableArray, nameableComparator);
}
for (int i = 0; i < nameableArray.length; i++) {
listModel.set(i, new ListModelElement(nameableArray[i]));
}
// p:需要选中以前的那个值.
if (selectedValue != null) {
nameableList.setSelectedValue(selectedValue, true);
}
checkButtonEnabled();
// p:需要repaint.
nameableList.repaint();
}
}
/*
* UINameEdList的鼠标事件
*/
private MouseListener listMouseListener = new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent evt) {
nameableList.stopEditing();
if (evt.getClickCount() >= 2
&& SwingUtilities.isLeftMouseButton(evt) && evt.getX() > EDIT_RANGE) {
editingIndex = nameableList.getSelectedIndex();
selectedName = nameableList.getNameAt(editingIndex);
nameableList.editItemAt(nameableList.getSelectedIndex());
} else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) {
editingIndex = nameableList.getSelectedIndex();
popupEditPane();
}
// peter:处理右键的弹出菜单
if (!SwingUtilities.isRightMouseButton(evt)) {
return;
}
// peter: 注意,在checkButtonEnabled()方法里面,设置了所有的Action的Enabled.
checkButtonEnabled();
// p:右键菜单.
JPopupMenu popupMenu = new JPopupMenu();
for (ShortCut4JControlPane sj : getShorts()) {
sj.getShortCut().intoJPopupMenu(popupMenu);
}
// peter: 只有弹出菜单有子菜单的时候,才需要弹出来.
GUICoreUtils.showPopupMenu(popupMenu, nameableList, evt.getX() - 1,
evt.getY() - 1);
}
@Override
public void mouseMoved(MouseEvent e) {
}
};
/**
* 检查按钮可用状态 Check button enabled.
*/
@Override
public void checkButtonEnabled() {
int selectedIndex = nameableList.getSelectedIndex();
if (selectedIndex == -1) {
this.cardLayout.show(cardPane, "SELECT");
} else {
this.cardLayout.show(cardPane, "EDIT");
}
for (ShortCut4JControlPane sj : getShorts()) {
sj.checkEnable();
}
}
public class AbsoluteEnableShortCut extends ShortCut4JControlPane {
public AbsoluteEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(true);
}
}
public class NormalEnableShortCut extends ShortCut4JControlPane {
public NormalEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel()
.getSize() > 0
&& UIListControlPane.this.nameableList.getSelectedIndex() != -1);
}
}
public class SortEnableShortCut extends ShortCut4JControlPane {
public SortEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel().getSize() > 1);
}
}
public class MoveUpEnableShortCut extends ShortCut4JControlPane {
public MoveUpEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel().getSize() > 1
&& UIListControlPane.this.nameableList.getSelectedIndex() > 0);
}
}
public class MoveDownEnableShortCut extends ShortCut4JControlPane {
public MoveDownEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel().getSize() > 1
&& UIListControlPane.this.nameableList.getSelectedIndex() < UIListControlPane.this.nameableList.getModel().getSize() - 1);
}
}
private class JControlUpdatePane extends JPanel {
private CardLayout card;
private JPanel cardPane;
private BasicBeanPane[] updatePanes;
private ListModelElement elEditing;
public JControlUpdatePane() {
initUpdatePane();
}
private void initUpdatePane() {
NameableCreator[] creators = creators();
if (creators == null) {
return;
}
card = new CardLayout();
cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardPane.setLayout(card);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(cardPane);
int len = creators.length;
updatePanes = new BasicBeanPane[len];
}
public void populate() {
ListModelElement el = (ListModelElement) UIListControlPane.this.nameableList.getSelectedValue();
if (el == null) {
return;
}
elEditing = el;
NameableCreator[] creators = creators();
for (int i = 0, len = updatePanes.length; i < len; i++) {
Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper);
if (ob2Populate != null) {
if (updatePanes[i] == null) {
if (isMulti(creators[i].getUpdatePane()) || isTree(creators[i].getUpdatePane())) {
updatePanes[i] = createPaneByCreators(creators[i], el.wrapper.getName());
} else {
updatePanes[i] = createPaneByCreators(creators[i]);
}
cardPane.add(updatePanes[i], String.valueOf(i));
}
card.show(cardPane, String.valueOf(i));
doBeforePopulate(el, ob2Populate);
updatePanes[i].populateBean(ob2Populate);
doWhenPopulate(updatePanes[i]);
break;
}
}
}
public boolean isMulti(Class _class) {
return ComparatorUtils.equals(_class, GlobalMultiTDTableDataPane.class) || ComparatorUtils.equals(_class, MultiTDTableDataPane.class);
}
public boolean isTree(Class _class) {
return ComparatorUtils.equals(_class, GlobalTreeTableDataPane.class) || ComparatorUtils.equals(_class, TreeTableDataPane.class);
}
public void update() {
NameableCreator[] creators = creators();
for (int i = 0; i < updatePanes.length; i++) {
BasicBeanPane pane = updatePanes[i];
if (pane != null && pane.isVisible()) {
Object bean = pane.updateBean();
if (i < creators.length) {
creators[i].saveUpdatedBean(elEditing, bean);
}
}
}
}
public void checkValid() throws Exception {
if (updatePanes != null) {
for (int i = 0; i < updatePanes.length; i++) {
if (updatePanes[i] != null) {
updatePanes[i].checkValid();
}
}
}
}
}
protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
try {
return creator.getUpdatePane().newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
protected BasicBeanPane createPaneByCreators(NameableCreator creator, String string) {
Constructor constructor = null;
try {
constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class});
constructor.setAccessible(true);
return (BasicBeanPane) constructor.newInstance(string);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
}
// 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) {
ToolBarDef toolbarDef = getToolbarDef();
if (toolbarDef.getShortCutCount() > shortCutIndex) {
ShortCut sc = toolbarDef.getShortCut(shortCutIndex);
if (sc instanceof AddItemMenuDef) {
AddItemMenuDef am = (AddItemMenuDef) sc;
if (am.getShortCutCount() > itemIndex) {
am.getShortCut(itemIndex).setEnabled(enabled);
}
}
}
}
/**
* 检查是否符合规范
*
* @throws Exception
*/
@Override
public void checkValid() throws Exception {
((JControlUpdatePane) this.controlUpdatePane).checkValid();
}
private int getInValidIndex() {
BasicBeanPane[] p = ((JControlUpdatePane) controlUpdatePane).updatePanes;
if (p != null) {
for (int i = 0; i < p.length; i++) {
if (p[i] != null) {
try {
p[i].checkValid();
} catch (Exception e) {
return i;
}
}
}
}
return -1;
}
@Override
protected boolean hasInvalid(boolean isAdd) {
int idx = UIListControlPane.this.getInValidIndex();
if (isAdd || nameableList.getSelectedIndex() != idx) {
try {
checkValid();
} catch (Exception exp) {
JOptionPane.showMessageDialog(UIListControlPane.this, exp.getMessage());
nameableList.setSelectedIndex(idx);
return true;
}
}
return false;
}
/**
* 设置选中项
*
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
nameableList.setSelectedIndex(index);
}
}

162
designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java

@ -0,0 +1,162 @@
package com.fr.design.gui.controlpane;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Nameable;
import sun.swing.DefaultLookup;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Nameable的ListCellRenerer
* Created by plough on 2017/7/21.
*/
public class UINameableListCellRenderer extends
JPanel implements ListCellRenderer {
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private static final Color BORDER_COLOR = new Color(201, 198, 184);
protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
private static final int BUTTON_WIDTH = 25;
private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件
private UILabel label;
private UIListControlPane listControlPane;
public UINameableListCellRenderer(UIListControlPane listControlPane) {
super();
this.listControlPane = listControlPane;
initComponents();
setOpaque(true);
setBorder(getNoFocusBorder());
setName("List.cellRenderer");
}
private void initComponents() {
editButton = new UILabel() {
public Dimension getPreferredSize() {
return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH);
}
};
// editButton.set4LargeToolbarButton();
editButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR));
editButton.setHorizontalAlignment(SwingConstants.CENTER);
// editButton.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// popupEditPane();
// }
// });
label = new UILabel();
label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
// label.setEditable(false);
this.setLayout(new BorderLayout());
this.add(editButton, BorderLayout.WEST);
this.add(label, BorderLayout.CENTER);
}
private Border getNoFocusBorder() {
// return BorderFactory.createLineBorder(new Color(201, 198, 184));
return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR);
// Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
// if (System.getSecurityManager() != null) {
// if (border != null) return border;
// return SAFE_NO_FOCUS_BORDER;
// } else {
// if (border != null &&
// (noFocusBorder == null ||
// noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
// return border;
// }
// return noFocusBorder;
// }
}
private void setText(String t) {
label.setText(t);
}
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
setComponentOrientation(list.getComponentOrientation());
Color bg = null;
Color fg = null;
JList.DropLocation dropLocation = list.getDropLocation();
if (dropLocation != null
&& !dropLocation.isInsert()
&& dropLocation.getIndex() == index) {
bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground");
fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground");
isSelected = true;
}
if (isSelected) {
setBackground(bg == null ? list.getSelectionBackground() : bg);
setForeground(fg == null ? list.getSelectionForeground() : fg);
}
else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
// if (value instanceof Icon) {
// setIcon((Icon)value);
// setText("");
// }
// else {
// setIcon(null);
setText((value == null) ? "" : value.toString());
// }
setEnabled(list.isEnabled());
setFont(list.getFont());
Border border = null;
if (cellHasFocus) {
if (isSelected) {
border = DefaultLookup.getBorder(this, ui, "List.focusSelectedCellHighlightBorder");
}
if (border == null) {
border = DefaultLookup.getBorder(this, ui, "List.focusCellHighlightBorder");
}
} else {
border = getNoFocusBorder();
}
setBorder(border);
if (value instanceof ListModelElement) {
Nameable wrappee = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName());
boolean iconSet = false;
for (NameableCreator creator : listControlPane.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
// this.setIcon(creator.menuIcon());
this.setToolTipText(creator.createTooltip());
iconSet = true;
break;
}
}
// if (!iconSet) {
// this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
// }
}
return this;
}
}

4
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -4,6 +4,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter;
import com.fr.general.NameObject;
@ -23,8 +24,7 @@ import java.util.Set;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-6-25 上午11:17:57
*/
public class HyperlinkGroupPane extends JListControlPane {
public abstract class HyperlinkGroupPane extends UIListControlPane {
/**
* 生成添加按钮的NameableCreator
*

311
designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -0,0 +1,311 @@
package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
/**
* Created by plough on 2017/7/7.
*/
public class UIEastResizableContainer extends JPanel {
private static final long serialVersionUID = 1854340560790476907L;
private int containerWidth = 240;
private int preferredWidth = 240;
private int topToolPaneHeight = 20;
private int leftPaneWidth = 40;
private JComponent leftPane;
private JComponent rightPane;
// private HorizotalToolPane horizontToolPane;
private TopToolPane topToolPane;
private static final int ARROW_MARGIN = 15;
private static final int ARROW_RANGE = 35;
// private boolean isRightPaneVisible = true;
public UIEastResizableContainer() {
this(new JPanel(), new JPanel());
}
/**
* 设置面板宽度
*
* @param width
*/
public void setContainerWidth(int width) {
this.containerWidth = width;
this.preferredWidth = width;
}
public boolean isRightPaneVisible() {
return containerWidth > leftPaneWidth;
}
// public void setRightPaneVisible(boolean isVisible){
// this.isRightPaneVisible = isVisible;
// }
private void setPreferredWidth(int width) {
this.preferredWidth = width;
}
public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) {
setBackground(UIConstants.NORMAL_BACKGROUND);
this.leftPane = leftPane;
this.rightPane = rightPane;
this.topToolPane = new TopToolPane();
setLayout(containerLayout);
add(topToolPane);
add(leftPane);
add(rightPane);
}
public static void main(String... args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
JPanel leftPane = new JPanel();
leftPane.setBackground(Color.yellow);
JPanel rightPane = new JPanel();
rightPane.setBackground(Color.green);
UIButton b1, b2;
b1 = new UIButton("b1");
b2 = new UIButton("b2");
b1.setPreferredSize(new Dimension(40, 40));
b2.setPreferredSize(new Dimension(40, 40));
leftPane.add(b1);
leftPane.add(b2);
UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane);
JPanel cc = new JPanel();
cc.setBackground(Color.white);
content.add(bb, BorderLayout.EAST);
content.add(cc, BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(500, 500);
jf.setVisible(true);
}
/**
* 将面板设置成最佳的宽度
*/
public void setWindow2PreferWidth() {
if (containerWidth == leftPaneWidth) {
containerWidth = preferredWidth;
refreshContainer();
}
}
/**
* 得到容器的宽度
*
* @return
*/
public int getContainerWidth() {
return this.containerWidth;
}
/**
* 设置关闭设计器前最后一次面板的宽度
*
* @param containerWidth
*/
public void setLastContainerWidth(int containerWidth) {
this.containerWidth = containerWidth;
}
private LayoutManager containerLayout = new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
// TODO Auto-generated method stub
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return parent.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return null;
}
@Override
public void layoutContainer(Container parent) {
if (topToolPane == null || rightPane == null) {
return;
}
// topToolPane.setBounds(0, 0, containerWidth, topToolPaneHeight);//0,0,10,462
topToolPane.setBounds(0, 0, leftPaneWidth, topToolPaneHeight);//0,0,10,462
leftPane.setBounds(0, topToolPaneHeight, leftPaneWidth, getHeight() - topToolPaneHeight);
// parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462
rightPane.setBounds(leftPaneWidth, 0, containerWidth-leftPaneWidth, getHeight());//20,0,230,0
}
@Override
public void addLayoutComponent(String name, Component comp) {
}
};
@Override
/**
* 得到最佳大小
*/
public Dimension getPreferredSize() {
return new Dimension(containerWidth, 400);
}
/**
* 替换左子面板
*
* @param pane 面板
*/
public void replaceLeftPane(JComponent pane) {
remove(pane);
remove(this.leftPane);
add(this.leftPane = pane);
refreshContainer();
}
/**
* 替换右子面板
*
* @param pane 面板
*/
public void replaceRightPane(JComponent pane) {
remove(pane);
remove(this.rightPane);
add(this.rightPane = pane);
refreshContainer();
}
/**
* 得到左子面板
*
* @return
*/
public JComponent getLeftPane() {
return this.leftPane;
}
/**
* 得到右子面板
*
* @return
*/
public JComponent getRightPane() {
return this.rightPane;
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
/**
* 伸缩右子面板时触发此方法
*/
public void onResize() {
}
private class TopToolPane extends JPanel {
private int model = UIConstants.MODEL_NORMAL;
public TopToolPane() {
super();
addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
model = UIConstants.MODEL_PRESS;
} else {
setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
if (containerWidth == leftPaneWidth) {
containerWidth = preferredWidth;
} else {
setPreferredWidth(containerWidth);
containerWidth = leftPaneWidth;
}
onResize();
refreshContainer();
if (BaseUtils.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();
}
}
}
});
}
@Override
public void paint(Graphics g) {
Image button;
g.drawImage(UIConstants.DRAG_BAR, 0, 0, containerWidth, topToolPaneHeight, null);
if (containerWidth == leftPaneWidth) {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_LEFT_NORMAL;
} else {
button = UIConstants.DRAG_LEFT_PRESS;
}
} else {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_RIGHT_NORMAL;
} else {
button = UIConstants.DRAG_RIGHT_PRESS;
}
}
// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
g.drawImage(button, 18, 7, 5, 5, null);
}
}
}

6
designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -37,9 +37,9 @@ public class UIResizableContainer extends JPanel {
private static final int MIN_WIDTH = 165;
private static final int ARROW_MARGIN = 15;
private static final int ARROW_MARGIN_VERTICAL = 20;
private static final int ARROW_MARGIN_VERTICAL = 7;
private static final int ARROW_RANGE = 35;
private static final int ARROW_RANGE_VERTICAL = 40;
private static final int ARROW_RANGE_VERTICAL = 25;
private boolean isLeftRightDragEnabled = true;
private boolean isDownPaneVisible = true ;
@ -502,7 +502,7 @@ public class UIResizableContainer extends JPanel {
button = UIConstants.DRAG_LEFT_PRESS;
}
}
g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, 5, null);
} else {
g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null);
if (containerWidth == toolPaneHeight) {

398
designer_base/src/com/fr/design/gui/ilist/UINameEdList.java

@ -0,0 +1,398 @@
package com.fr.design.gui.ilist;
import com.fr.base.Utils;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Vector;
/**
* Created by plough on 2017/7/23.
*/
public class UINameEdList extends UIList implements CellEditorListener {
private static final int TEST_LIST_LENTH = 20;
private static final int BUTTON_WIDTH = 25;
private boolean editable = true;
// kunsnat: 是否强制ListName是数字 (int型)
private boolean isNameShouldNumber = false;
transient protected ListCellEditor cellEditor;
transient protected Component editorComp;
transient protected int editingIndex;
private PropertyChangeAdapter editingListner;
private java.util.List<ModNameActionListener> ll = new ArrayList<ModNameActionListener>();
public UINameEdList(ListModel dataModel) {
super(dataModel);
}
public UINameEdList(final Object[] listData) {
super(listData);
}
public UINameEdList(final Vector<?> listData) {
super(listData);
}
public UINameEdList() {
super();
}
/*
* Sets是否可编辑
*/
public void setEditable(boolean editable) {
this.editable = editable;
}
/**
* 是否可编辑
*
* @return 是则返回true
*/
public boolean isEditable() {
return this.editable;
}
public void setNameShouldNumber(boolean isNameShouldNumber) {
this.isNameShouldNumber = isNameShouldNumber;
}
/**
* 是否强制ListName是数字 (int型)
*
* @return 是则返回true
*/
public boolean isNameShouldNumber() {
return isNameShouldNumber;
}
/**
* 添加名字改变时的listener
*
* @param l 监听器
*/
public void addModNameActionListener(ModNameActionListener l) {
ll.add(l);
}
/**
* 编辑时的监听器
*
* @param l 监听器
*/
public void addEditingListner(PropertyChangeAdapter l) {
this.editingListner = l;
}
/**
* 移除某名字改变时的listener
*
* @param l 监听器
*/
public void removeModNameActionListener(ModNameActionListener l) {
ll.remove(l);
}
public ListCellEditor getCellEditor() {
if (cellEditor == null) {
UITextField editField = new UITextField();
if (editingListner != null) {
editField.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
editingListner.propertyChange();
}
@Override
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
}
});
}
cellEditor = new DefaultListCellEditor(editField) {
public boolean stopCellEditing() {
boolean isTrue = super.stopCellEditing();
stopEditing();
return isTrue;
}
};
cellEditor.addCellEditorListener(this);
}
return cellEditor;
}
protected void doAfterLostFocus() {
}
public void setCellEditor(ListCellEditor editor) {
this.cellEditor = editor;
}
/*
* 取得index节点的名字
*/
public String getNameAt(int index) {
Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
if (nameable != null) {
return nameable.getName();
}
return null;
}
public Object getType(int index) {
Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
if (nameable != null && nameable instanceof NameObject) {
return ((NameObject) nameable).getObject();
}
return null;
}
public void setWarnigText() {
setWarnigText(this.getSelectedIndex());
}
public void setWarnigText(int index) {
setNameAt(Inter.getLocText("Please_Rename") + "!", index);
this.repaint();
}
/*
* 设置index节点的名字
*/
// b:edit改变name的时候怎么办?
public void setNameAt(String name, int index) {
Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
if (nameable != null) {
String oldName = nameable.getName();
if (isNameShouldNumber()) {
// kunsnat: 限制只能是数字(int型)
Number number = Utils.string2Number(name);
if (number == null) {
nameable.setName(oldName);
} else {
int newName = number.intValue();
nameable.setName(String.valueOf(newName));
}
} else {
nameable.setName(name);
}
for (int i = 0, len = ll.size(); i < len; i++) {
ll.get(i).nameModed(index, oldName, name);
}
}
}
/*
* 编辑第index个item
*/
private String oldName;
/**
* 编辑第index项
*
* @param index 序号
* @return 成功返回true
*/
public boolean editItemAt(int index) {
// 如果不可编辑,返回
if (!this.editable) {
return false;
}
if (cellEditor != null && !cellEditor.stopCellEditing()) {
return false;
}
if (index < 0 || index >= this.getModel().getSize()) {
return false;
}
ListCellEditor editor = getCellEditor();
Object value = editor.getCellEditorValue();
if (!StringUtils.isBlank(value.toString())) {
oldName = value.toString();
}
editorComp = prepareEditor(editor, index);
if (editorComp == null) {
return false;
}
Rectangle rect = this.getCellBounds(index, index);
// alex:所有的UINameEdList都有Icon,空出前面20 * 20的位置就是放的Icon
rect.setRect(createRect(rect, BUTTON_WIDTH));
editorComp.setBounds(rect);
add(editorComp);
editorComp.validate();
editorComp.requestFocus();
if (editorComp instanceof UITextField) {
((UITextField) editorComp).selectAll();
}
setEditingIndex(index);
return true;
}
public Rectangle createRect(Rectangle rect, int iconWidth) {
return new Rectangle(rect.x + iconWidth, rect.y, rect.width - iconWidth, rect.height);
}
public String getEditingName() {
return (String) getCellEditor().getCellEditorValue();
}
/*
* 根据ListCellEditor取得编辑器的Component
*/
private Component prepareEditor(ListCellEditor cellEditor, int index) {
String name = getNameAt(index);
boolean isSelected = this.isSelectedIndex(index);
Component comp = cellEditor.getListCellEditorComponent(this, name, isSelected, index);
return comp;
}
/*
* 记录正在编辑的index
*/
private void setEditingIndex(int idx) {
editingIndex = idx;
}
/**
* 编辑取消
*
* @param e 事件
*/
public void editingCanceled(ChangeEvent e) {
removeComp();
}
/**
* 编辑结束
*
* @param e 事件
*/
public void editingStopped(ChangeEvent e) {
doAfterLostFocus();
stopEditing();
}
/**
* 停止编辑事件
*/
public void stopEditing() {
ListCellEditor editor = getCellEditor();
if (editor != null && editorComp != null) {
Object value = editor.getCellEditorValue();
String name = StringUtils.isBlank(value.toString()) ? oldName : value.toString();
setNameAt(name, editingIndex);
removeComp();
}
}
public String[] getAllNames() {
int length = this.getModel().getSize();
String[] names = new String[length];
for (int i = 0; i < length; i++) {
names[i] = getNameAt(i);
}
return names;
}
public Object[] getAllTypes() {
int length = this.getModel().getSize();
Object[] types = new Object[length];
for (int i = 0; i < length; i++) {
types[i] = getType(i);
}
return types;
}
/*
* 移除编辑器的Component
*/
private void removeComp() {
if (editorComp != null) {
remove(editorComp);
}
Rectangle cellRect = this.getCellBounds(editingIndex, editingIndex);
setEditingIndex(-1);
editorComp = null;
repaint(cellRect);
}
/**
* 主函数
*
* @param args 参数
*/
public static void main(String... args) {
JFrame f = new JFrame();
JPanel c = (JPanel) f.getContentPane();
c.setLayout(new BorderLayout());
ListModelElement[] data = new ListModelElement[TEST_LIST_LENTH];
for (int i = 0; i < TEST_LIST_LENTH; i++) {
data[i] = new ListModelElement(new NameObject(i + 1 + "", i));
}
final UINameEdList list = new UINameEdList(data);
list.setEditable(true);
list.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent evt) {
list.stopEditing();
if (evt.getClickCount() >= 2
&& SwingUtilities.isLeftMouseButton(evt)) {
list.editItemAt(list.getSelectedIndex());
}
}
})
;
list.setCellEditor(new DefaultListCellEditor(new UITextField()));
list.setCellRenderer(new NameableListCellRenderer());
c.add(list, BorderLayout.CENTER);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setSize(400, 600);
f.setVisible(true);
}
private static class NameableListCellRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Nameable) {
Nameable wrappee = (Nameable) value;
this.setText(wrappee.getName());
}
return this;
}
}
}

24
designer_base/src/com/fr/design/gui/style/BackgroundPane.java

@ -1,9 +1,15 @@
package com.fr.design.gui.style;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.*;
import com.fr.general.Background;
import com.fr.general.Inter;
@ -35,7 +41,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
this.add(typeComboBox, BorderLayout.NORTH);
// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI();
@ -50,7 +56,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
this.add(centerPane, BorderLayout.CENTER);
// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() {
@Override
@ -59,6 +65,20 @@ public class BackgroundPane extends AbstractBasicStylePane {
fireStateChanged();
}
});
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill") + " ", SwingConstants.LEFT),typeComboBox},
new Component[]{null, centerPane}
};
double[] rowSize = {p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel, BorderLayout.CENTER);
}
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {

109
designer_base/src/com/fr/design/gui/style/BorderPane.java

@ -9,8 +9,11 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -21,6 +24,7 @@ import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
@ -45,22 +49,28 @@ public class BorderPane extends AbstractBasicStylePane {
private LineComboBox currentLineCombo;
private NewColorSelectBox currentLineColorPane;
private JPanel panel;
private JPanel borderPanel;
private JPanel backgroundPanel;
private BackgroundPane backgroundPane;
public BorderPane() {
this.initComponents();
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new BorderPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
protected void initComponents() {
initButtonsWithIcon();
this.setLayout(new BorderLayout(0, 6));
double p = TableLayout.PREFERRED, f = TableLayout.FILL;
double[] columnSize1 = {p, f}, rowSize1 = {p, p};
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + ":"), currentLineCombo},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + ":"), currentLineColorPane},
};
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
double[] columnSize2 = {p, f}, rowSize2 = {p, p};
JPanel externalPane = new JPanel(new GridLayout(0, 4));
externalPane.add(topToggleButton);
externalPane.add(leftToggleButton);
@ -69,34 +79,56 @@ public class BorderPane extends AbstractBasicStylePane {
JPanel insidePane = new JPanel(new GridLayout(0, 2));
insidePane.add(horizontalToggleButton);
insidePane.add(verticalToggleButton);
Component[][] components2 = new Component[][]{
new Component[]{outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png")), innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{externalPane, insidePane,}
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + " ", SwingConstants.LEFT), currentLineCombo},
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane},
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") +" ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))},
new Component[]{null,externalPane},
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") +" ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{null,insidePane},
new Component[]{null,null}
};
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2);
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
outerToggleButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = outerToggleButton.isSelected();
topToggleButton.setSelected(value);
bottomToggleButton.setSelected(value);
leftToggleButton.setSelected(value);
rightToggleButton.setSelected(value);
}
});
innerToggleButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = innerToggleButton.isSelected();
horizontalToggleButton.setSelected(value);
verticalToggleButton.setSelected(value);
}
});
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(Inter.getLocText("FR-Designer_Border"),280,20,panel);
this.add(borderPanel,BorderLayout.NORTH);
backgroundPane = new BackgroundPane();
backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane);
this.add(backgroundPanel,BorderLayout.CENTER);
outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
innerToggleButton.addChangeListener(innerToggleButtonChangeListener);
}
ChangeListener outerToggleButtonChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = outerToggleButton.isSelected();
topToggleButton.setSelected(value);
bottomToggleButton.setSelected(value);
leftToggleButton.setSelected(value);
rightToggleButton.setSelected(value);
}
};
ChangeListener innerToggleButtonChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = innerToggleButton.isSelected();
horizontalToggleButton.setSelected(value);
verticalToggleButton.setSelected(value);
}
};
private void initButtonsWithIcon(){
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"));
@ -113,7 +145,8 @@ public class BorderPane extends AbstractBasicStylePane {
return Inter.getLocText("FR-Designer_Border");
}
public void populate(Style style) {
@Override
public void populateBean(Style style) {
if (style == null) {
style = Style.DEFAULT_STYLE;
}
@ -127,8 +160,9 @@ public class BorderPane extends AbstractBasicStylePane {
cellBorderStyle.setBottomColor(style.getBorderBottomColor());
cellBorderStyle.setRightStyle(style.getBorderRight());
cellBorderStyle.setRightColor(style.getBorderRightColor());
this.backgroundPane.populateBean(style.getBackground());
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor());
}
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) {
@ -151,10 +185,10 @@ public class BorderPane extends AbstractBasicStylePane {
this.innerToggleButton.setEnabled(this.insideMode);
this.horizontalToggleButton.setEnabled(this.insideMode);
this.verticalToggleButton.setEnabled(this.insideMode);
}
public Style update(Style style) {
style = style.deriveBackground(backgroundPane.update());
if (style == null) {
style = Style.DEFAULT_STYLE;
}
@ -163,7 +197,6 @@ public class BorderPane extends AbstractBasicStylePane {
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
return style;
}

146
designer_base/src/com/fr/design/gui/style/FRFontPane.java

@ -7,6 +7,7 @@ package com.fr.design.gui.style;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -37,12 +38,15 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Pane to edit Font.
*/
public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final int MAX_FONT_SIZE = 100;
public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16),
new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)};
private static final Dimension BUTTON_SIZE = new Dimension(24, 20);
private static final Dimension BUTTON_SIZE = new Dimension(20, 18);
private final String[] fontSizeStyles = {Inter.getLocText("FR-Designer_FRFont_plain"), Inter.getLocText("FR-Designer_FRFont_bold"), Inter.getLocText("FR-Designer_FRFont_italic"), Inter.getLocText("FR-Designer_FRFont_bolditalic")};
private JPanel buttonPane;
private JPanel isSuperOrSubPane;
private UIComboBox fontNameComboBox;
private UIComboBox fontSizeStyleComboBox;
private UIComboBox fontSizeComboBox;
private UIToggleButton bold;
private UIToggleButton italic;
@ -58,14 +62,27 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton superPane;
private UIToggleButton subPane;
private JPanel linePane;
private int italic_bold;
public FRFontPane() {
this.initComponents();
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FRFontPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Sytle-FRFont");
return Inter.getLocText("FR-Designer_Sytle-FRFont");
}
/**
@ -73,7 +90,8 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/
public void populateBean(FRFont frFont) {
fontNameComboBox.setSelectedItem(frFont.getFamily());
fontSizeComboBox.setSelectedItem(frFont.getSize());
fontSizeStyleComboBox.setSelectedIndex(frFont.getStyle());
fontSizeComboBox.setSelectedItem(Utils.round5(frFont.getSize2D()));
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
@ -112,31 +130,34 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/
public FRFont update(FRFont frFont) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Family"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Name"))) {
frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Size"))) {
frFont = frFont.applySize((Integer) fontSizeComboBox.getSelectedItem());
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Style"))) {
frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Size"))) {
frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Foreground"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Foreground"))) {
frFont = frFont.applyForeground(this.colorSelectPane.getColor());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Underline"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Underline"))) {
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Line-Style"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Line_Style"))) {
frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Strikethrough"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Strikethrough"))) {
frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Shadow"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Shadow"))) {
frFont = frFont.applyShadow(isShadowCheckBox.isSelected());
}
@ -147,7 +168,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateOthers(FRFont frFont) {
frFont = updateItalicBold(frFont);
frFont = updateSubSuperscript(frFont);
return frFont;
}
@ -155,7 +175,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateSubSuperscript(FRFont frFont) {
boolean isSuper = frFont.isSuperscript();
boolean isSub = frFont.isSubscript();
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Superscript"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Superscript"))) {
//如果上标没有选中,点击则选中上标,并且下标一定是不选中状态
//如果上标选中,点击则取消选中上标,字体回复正常
if (superPane.isSelected() && !isSuper) {
@ -165,7 +185,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
frFont = frFont.applySuperscript(false);
}
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Subscript"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Subscript"))) {
if (subPane.isSelected() && !isSub) {
frFont = frFont.applySubscript(true);
frFont = frFont.applySuperscript(false);
@ -176,29 +196,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return frFont;
}
private FRFont updateItalicBold(FRFont frFont) {
int italic_bold = frFont.getStyle();
boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC);
boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC);
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-italic"))) {
if (italic.isSelected() && !isItalic) {
italic_bold += Font.ITALIC;
} else if (!italic.isSelected() && isItalic) {
italic_bold -= Font.ITALIC;
}
frFont = frFont.applyStyle(italic_bold);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-bold"))) {
if (bold.isSelected() && !isBold) {
italic_bold += Font.BOLD;
} else if (!bold.isSelected() && isBold) {
italic_bold -= Font.BOLD;
}
frFont = frFont.applyStyle(italic_bold);
}
return frFont;
}
@Override
public void populateBean(Style style) {
this.populateBean(style.getFRFont());
@ -212,10 +209,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return style.deriveFRFont(frFont);
}
public static Vector<Integer> getFontSizes(){
Vector<Integer> FONT_SIZES = new Vector<Integer>();
for (int i = 1; i < MAX_FONT_SIZE; i++) {
FONT_SIZES.add(i);
}
return FONT_SIZES;
}
protected void initComponents() {
fontSizeStyleComboBox = new UIComboBox(fontSizeStyles);
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(FONT_SIZES);
fontSizeComboBox = new UIComboBox(getFontSizes());
fontSizeComboBox.setEditable(true);
this.underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY);
colorSelectPane = new UIColorButton();
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
@ -229,48 +236,53 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
isShadowCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/shadow.png"));
isShadowCheckBox.setPreferredSize(BUTTON_SIZE);
superPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sup.png"));
superPane.setPreferredSize(new Dimension(22, 18));
superPane.setPreferredSize(BUTTON_SIZE);
subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png"));
subPane.setPreferredSize(new Dimension(22, 18));
subPane.setPreferredSize(BUTTON_SIZE);
isSuperOrSubPane = new TwoButtonPane(superPane, subPane);
// Component[] components_font = new Component[]{
// colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
// };
Component[] components_font = new Component[]{
colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox
};
buttonPane = new JPanel(new BorderLayout());
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
// buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
linePane = new JPanel(new CardLayout());
initAllNames();
setToolTips();
this.setLayout(new BorderLayout());
this.add(fontNameComboBox, BorderLayout.NORTH);
this.add(createPane(), BorderLayout.CENTER);
DefaultValues defaultValues = FRContext.getDefaultValues();
populateBean(defaultValues.getFRFont());
}
private void initAllNames() {
fontNameComboBox.setGlobalName(Inter.getLocText("FRFont-Family"));
fontSizeComboBox.setGlobalName(Inter.getLocText("FRFont-Size"));
colorSelectPane.setGlobalName(Inter.getLocText("FRFont-Foreground"));
italic.setGlobalName(Inter.getLocText("FRFont-italic"));
bold.setGlobalName(Inter.getLocText("FRFont-bold"));
underline.setGlobalName(Inter.getLocText("FRFont-Underline"));
underlineCombo.setGlobalName(Inter.getLocText("Line-Style"));
isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FRFont-Strikethrough"));
isShadowCheckBox.setGlobalName(Inter.getLocText("FRFont-Shadow"));
superPane.setGlobalName(Inter.getLocText("FRFont-Superscript"));
subPane.setGlobalName(Inter.getLocText("FRFont-Subscript"));
fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Style"));
fontNameComboBox.setGlobalName(Inter.getLocText("FR-Designer_Name"));
fontSizeComboBox.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Size"));
colorSelectPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Foreground"));
italic.setGlobalName(Inter.getLocText("FR-Designer_FRFont_italic"));
bold.setGlobalName(Inter.getLocText("FR-Designer_FRFont_bold"));
underline.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Underline"));
underlineCombo.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Line_Style"));
isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
isShadowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Shadow"));
superPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Superscript"));
subPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Subscript"));
}
private void setToolTips() {
colorSelectPane.setToolTipText(Inter.getLocText("FRFont-Foreground"));
italic.setToolTipText(Inter.getLocText("FRFont-italic"));
bold.setToolTipText(Inter.getLocText("FRFont-bold"));
underline.setToolTipText(Inter.getLocText("FRFont-Underline"));
isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FRFont-Strikethrough"));
isShadowCheckBox.setToolTipText(Inter.getLocText("FRFont-Shadow"));
superPane.setToolTipText(Inter.getLocText("FRFont-Superscript"));
subPane.setToolTipText(Inter.getLocText("FRFont-Subscript"));
colorSelectPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Foreground"));
italic.setToolTipText(Inter.getLocText("FR-Designer_FRFont_italic"));
bold.setToolTipText(Inter.getLocText("FR-Designer_FRFont_bold"));
underline.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Underline"));
isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
isShadowCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Shadow"));
superPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Superscript"));
subPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Subscript"));
}
@ -292,10 +304,11 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createLeftPane() {
double p = TableLayout.PREFERRED;
double[] columnSize = {p};
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{fontNameComboBox},
new Component[]{fontSizeStyleComboBox},
new Component[]{buttonPane},
new Component[]{createLinePane()}
};
@ -317,9 +330,10 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p};
double[] columnSize = {f, f};
double[] rowSize = {p,p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{createLeftPane(), createRightPane()},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -349,7 +363,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
public TwoButtonPane(UIToggleButton leftButton, UIToggleButton rightButton) {
this.leftButton = leftButton;
this.rightButton = rightButton;
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 0));
this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
initButton(leftButton);
initButton(rightButton);

171
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -7,27 +7,24 @@ import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.*;
import java.text.Format;
import java.text.SimpleDateFormat;
@ -37,7 +34,7 @@ import java.text.SimpleDateFormat;
* @author zhou
* @since 2012-5-24上午10:57:00
*/
public class FormatPane extends AbstractBasicStylePane {
public class FormatPane extends AbstractBasicStylePane{
private static final long serialVersionUID = 724330854437726751L;
private static final int LABLE_X = 4;
@ -54,13 +51,16 @@ public class FormatPane extends AbstractBasicStylePane {
private Format format;
private UIComboBox typeComboBox;
private UIComboBox textField;
private UILabel sampleLabel;
private FormatePaneNumField patternTextField = null;
private JList patternList = null;
private JPanel contentPane;
private JPanel txtCenterPane;
private JPanel centerPane;
private JPanel formatFontPane;
private FRFontPane frFontPane;
private boolean isRightFormate;
private boolean isDate = false;
private boolean isFormat = false;
/**
* Constructor.
*/
@ -68,41 +68,59 @@ public class FormatPane extends AbstractBasicStylePane {
this.initComponents(TYPES);
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FormatPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4));
iniSampleLable();
JPanel contentPane = new JPanel(new BorderLayout(0, 4)) {
contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 185);
return new Dimension(super.getPreferredSize().width, 70);
}
};
typeComboBox = new UIComboBox(types);
UIComboBoxRenderer render = createComBoxRender();
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener);
contentPane.add(sampleLabel, BorderLayout.NORTH);
this.add(typeComboBox, BorderLayout.NORTH);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0) );
centerPane.add(contentPane, "show");
this.add(centerPane, BorderLayout.CENTER);
// content pane.
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(centerPane, BorderLayout.CENTER);
patternTextField = new FormatePaneNumField();
centerPane.add(patternTextField, BorderLayout.NORTH);
patternTextField.getDocument().addDocumentListener(patternTextDocumentListener);
patternList = new JList(new DefaultListModel());
centerPane.add(new UIScrollPane(patternList), BorderLayout.CENTER);
patternList.addListSelectionListener(patternListSelectionListener);
patternList.setSelectionBackground(UIConstants.LIGHT_BLUE);
patternList.setSelectionForeground(Color.black);
// init values.
formatFontPane = new JPanel(new BorderLayout());
formatFontPane.add(centerPane, BorderLayout.NORTH);
formatFontPane.add(new FRFontPane(), BorderLayout.CENTER);
txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(txtCenterPane, BorderLayout.CENTER);
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents()));
textField.addItemListener(textFieldItemListener);
textField.setEditable(true);
txtCenterPane.add(textField, BorderLayout.NORTH);
frFontPane = new FRFontPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format")+" ", SwingConstants.LEFT), typeComboBox },
new Component[]{null,centerPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane},
new Component[]{null,null}
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel,BorderLayout.CENTER);
}
protected UIComboBoxRenderer createComBoxRender(){
@ -187,7 +205,6 @@ public class FormatPane extends AbstractBasicStylePane {
} else {
setPatternComboBoxAndList(FormatContents.NUMBER, pattern);
}
patternTextField.setText(pattern);
} else if (format instanceof SimpleDateFormat) { // date and time
String pattern = ((SimpleDateFormat) format).toPattern();
if (!isTimeType(pattern)) {
@ -195,7 +212,6 @@ public class FormatPane extends AbstractBasicStylePane {
} else {
setPatternComboBoxAndList(FormatContents.TIME, pattern);
}
patternTextField.setText(pattern);
} else if (format instanceof TextFormat) { // Text
this.typeComboBox.setSelectedItem(FormatContents.TEXT);
}
@ -224,9 +240,9 @@ public class FormatPane extends AbstractBasicStylePane {
this.typeComboBox.setSelectedItem(formatStyle);
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern);
if (i == -1) {
this.patternList.setSelectedIndices(ArrayUtils.EMPTY_INT_ARRAY);
this.textField.setSelectedIndex(0);
} else {
this.patternList.setSelectedIndex(i);
this.textField.setSelectedIndex(i);
}
}
@ -238,7 +254,7 @@ public class FormatPane extends AbstractBasicStylePane {
* update
*/
public Format update() {
String patternString = patternTextField.getText();
String patternString = String.valueOf(textField.getSelectedItem());
if (getFormatContents() == FormatContents.TEXT) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
}
@ -262,10 +278,10 @@ public class FormatPane extends AbstractBasicStylePane {
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground"));
try {
isRightFormate = true;
if (StringUtils.isEmpty(patternTextField.getText())) {
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return;
}
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), patternTextField.getText()));
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem())));
} catch (Exception e) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage());
@ -285,55 +301,34 @@ public class FormatPane extends AbstractBasicStylePane {
@Override
public void itemStateChanged(ItemEvent e) {
int contents = getFormatContents();
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (isTextOrNull()) {
cardLayout.show(centerPane, "hide");
patternTextField.setText("");
} else {
cardLayout.show(centerPane, "show");
}
String[] patternArray = FormatField.getInstance().getFormatArray(contents, false);
//
DefaultListModel patternModel = (DefaultListModel) patternList.getModel();
patternModel.removeAllElements();
for (int i = 0; i < patternArray.length; i++) {
patternModel.addElement(patternArray[i]);
if(e.getStateChange() == ItemEvent.SELECTED){
int contents = getFormatContents();
String[] items = FormatField.getInstance().getFormatArray(contents);
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (isTextOrNull()) {
centerPane.setPreferredSize(new Dimension(0, 0) );
cardLayout.show(centerPane, "hide");
} else {
textField.removeAllItems();
for (int i = 0; i < items.length; i++) {
textField.addItem(items[i]);
}
centerPane.setPreferredSize(new Dimension(270, 70) );
cardLayout.show(centerPane, "show");
}
isFormat = true;
}
if (patternModel.size() > 0) {
patternList.setSelectedIndex(0);
}
}
};
/**
* text pattern document listener.
*/
DocumentListener patternTextDocumentListener = new DocumentListener() {
public void insertUpdate(DocumentEvent evt) {
refreshPreviewLabel();
}
public void removeUpdate(DocumentEvent evt) {
refreshPreviewLabel();
}
public void changedUpdate(DocumentEvent evt) {
refreshPreviewLabel();
}
};
/**
* Pattern list selection listener.
*/
ListSelectionListener patternListSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
if (!evt.getValueIsAdjusting()) {
patternTextField.setText((String) patternList.getSelectedValue());
ItemListener textFieldItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){
isFormat = true;
refreshPreviewLabel();
}
}
};
@ -344,6 +339,8 @@ public class FormatPane extends AbstractBasicStylePane {
*/
public void populateBean(Style style) {
this.populateBean(style.getFormat());
isFormat = false;
this.frFontPane.populateBean(style.getFRFont());
}
@Override
@ -351,7 +348,12 @@ public class FormatPane extends AbstractBasicStylePane {
* update
*/
public Style update(Style style) {
return style.deriveFormat(this.update());
if (isFormat){
isFormat = false;
return style.deriveFormat(this.update());
} else {
return style.deriveFRFont(this.frFontPane.update(style.getFRFont()));
}
}
/**
@ -401,4 +403,5 @@ public class FormatPane extends AbstractBasicStylePane {
}
}
}
}

49
designer_base/src/com/fr/design/locale/designer.properties

@ -1999,10 +1999,55 @@ FR-Designer_Templates_Content=Templates Contents
FR-Designer_AlphaFine_ShowAll=show all
FR-Designer_AlphaFine_Latest=Latest
FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_Alphafine=AlphaFine
FR-Designer_AlphaFine=AlphaFine
FR-Designer-Alphafine_No_Remind=
<<<<<<< HEAD
FR-Designer_AlphaFine_NoResult=no results
FR-Designer_ConnectionFailed=connection failed
FR-Designer_NoResult=No results
FR-Designer-AlphaFine_SetShortcuts=
FR-Designer_Write_Enhance_Preview=Write Enhance PreviewFR-Designer_Double=Double
FR-Designer_Query=
FR-Designer_Font=Font
FR-Designer_Confirm=
FR-Designer_Parameter=
FR-Designer-Plugin_Plugin=Plugin
FR-Designer_Background=Background
Template=Template
FR-Designer_Parent_Marked_Field=Parent Marked Field
FR-Designer_Original_Marked_Filed=Original Marked Filed
FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=Build Tree according parent's marked filed
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=Build Tree according marked filed's length
FR-Product_Demo=Demo
FR-Designer_Tree_Data_Field=Tree Data Field
FR-Designer_Data_Filter=Data Filter
Default=Default
FR-Base-Load_Resource_File=Load resource file
FR-Designer_Cell_Element=Cell Element
FR-Designer_Cell_Attributes=Cell Attributes
FR-Designer_Float_Element=Float Element
FR-Designer_Widget_Library=Widget Library
FR-Designer_No_Settings_Available=No Settings Available!
FR-Designer_Configured_Roles=Configured role
FR-Designer_Scale_EnlargeOrReduce=Scale
FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
FR-Designer_Scale_customButton=custom
FR-Designer_FRFont_Subscript=Subscript
FR-Designer_FRFont_Superscript=Superscript
FR-Designer_FRFont_Shadow=Shadow
FR-Designer_FRFont_Strikethrough=Strikethrough
FR-Designer_FRFont_Underline=Underline
FR-Designer_FRFont_bold=bold
FR-Designer_FRFont_italic=italic
FR-Designer_FRFont_Foreground=Foreground
FR-Designer_FRFont_Style=Style
FR-Designer_FRFont_plain=plain
FR-Designer_FRFont_bolditalic=bolditalic
FR-Designer_outBorder=outBorder
FR-Designer_inBorder=inBorder
FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
FR-Designer_ExpandD_Expand_Direction=Expand_Direction
FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure

50
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -1997,8 +1997,7 @@ FR-Designer_Templates_Content=Files'contents
FR-Designer_AlphaFine_ShowAll=Show all
FR-Designer_AlphaFine_Latest=Recent
FR-Designer_AlphaFine_ShowLess=Show less
FR-Designer_Alphafine=AlphaFine
<<<<<<< HEAD
FR-Designer_AlphaFine=AlphaFine
FR-Designer-Alphafine_No_Remind=don't remind
FR-Designer_AlphaFine_NoResult=No results
FR-Designer_ConnectionFailed=Connection failed
@ -2006,3 +2005,50 @@ FR-Designer_AlphaFine_EnableAlphaFine=Enable AlphaFine
FR-Designer_AlphaFine_EnableInternet=Internet
FR-Designer_NoResult=No results
FR-Designer-AlphaFine_SetShortcuts=please press two key to set shortcut
FR-Designer_Write_Enhance_Preview=Write Enhance PreviewFR-Designer_Double=Decimal
FR-Designer_Query=Query
FR-Designer_Font=Font
FR-Designer_Confirm=OK
FR-Designer_Parameter=Parameter
FR-Designer-Plugin_Plugin=Plugin
FR-Designer_Background=BG
Template=Template
FR-Designer_Original_Marked_Filed=Original Tag Field
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=Build tree according to tag field's length
FR-Designer_Can_not_use_FormatBursh=Can't use format painter in multiple selections
FR-Designer_Tree_Data_Field=Tree Data Field
FR-Designer_Parent_Marked_Field=Parent Tag Field
FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=Build Tree according to the parent tag field of the selected data set
FR-Product_Demo=Demo
FR-Designer_Data_Filter=Data Filter
Default=Default
FR-Base-Load_Resource_File=Load Configuration File
FR-Designer_Cell_Element=Cell Element
FR-Designer_Cell_Attributes=Cell Attributes
FR-Designer_Float_Element=Float Element
FR-Designer_Widget_Library=Widget Library
FR-Designer_No_Settings_Available=No Settings Available!
FR-Designer_Configured_Roles=Configured role
FR-Designer_Scale_EnlargeOrReduce=Scale
FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
FR-Designer_Scale_customButton=custom
FR-Designer_FRFont_Subscript=Subscript
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=Shadow
FR-Designer_FRFont_Strikethrough=Strikethrough
FR-Designer_FRFont_Underline=Underline
FR-Designer_FRFont_bold=bold
FR-Designer_FRFont_italic=italic
FR-Designer_FRFont_Foreground=Foreground
FR-Designer_FRFont_Style=Style
FR-Designer_FRFont_plain=plain
FR-Designer_FRFont_bolditalic=bolditalic
FR-Designer_outBorder=outBorder
FR-Designer_inBorder=inBorder
FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
FR-Designer_ExpandD_Expand_Direction=Expand_Direction
FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure

177
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -641,8 +641,8 @@ FR-Server_Embedded_Server_Stop=\u5185\u8535\u30B5\u30FC\u30D0\u30FC-\u4E00\u6642
FR-Designer-Plugin_Detecting_Update=\u66F4\u65B0\u3092\u30C1\u30A7\u30C3\u30AF\u3057\u3066\u3044\u307E\u3059
HF-Whether_to_define_the_selected_type=\u9078\u629E\u3055\u308C\u305F\u30BF\u30A4\u30D7\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u304B
StyleAlignment-Right=\u53F3\u8A70\u3081
FR-Designer_Alignment-Style=\u30A2\u30E9\u30A4\u30F3\u30E1\u30F3\u30C8
PageSetup-Title_Start_Column=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217
FR-Designer_Alignment-Style=\u63C3\u3048\u65B9\u6CD5
PageSetup-Title_Start_Column=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u5217
Tree-Mutiple_Selection_Or_Not=\u8907\u6570\u9078\u629E
FR-Designer-Plugin_Search=\u691C\u7D22
Choose_Role=\u6A29\u9650\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB
@ -777,13 +777,13 @@ Cannot-Add_To_This_Area=\u5730\u57DF\u306B\u306F\u8FFD\u52A0\u3067\u304D\u307E\u
Run=\u904B\u884C
Set_Submit_Condition=\u6761\u4EF6\u3092\u8A2D\u7F6E\u306B\u63D0\u51FA\u3059\u308B\u3053\u3068\u306B\u3057\u305F
FR-Base_Value=\u5024
fileLocked_undeleted=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u308B\u3001\u3042\u306A\u305F\u304C\u524A\u9664\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\uFF01
Web_Apply=WEB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3
Refresh_Database=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5237\u65B0
Set_Row_Title_End=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u884C\u3092\u8A2D\u5B9A
FR-Utils-New_Folder=\u30D5\u30A1\u30A4\u30EB\u65B0\u898F\u4F5C\u6210
BiasD-From-upper_left_to_lower_right=\u5DE6\u4E0A\u5074\u304B\u3089\u53F3\u4E0B\u5074\u3078\u5E83\u304C\u308B
CapsLock=Caps Lock\u30AD\u30FC\u304C\u30AA\u30F3\u306B\u306A\u3063\u3066\u3044\u308B
fileLocked_undeleted=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002OK\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3001\u30EA\u30B9\u30C8\u3092\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u304F\u3060\u3055\u3044\u3002
Web_Apply=WEB\u30A2\u30D7\u30EA
Refresh_Database=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u66F4\u65B0
Set_Row_Title_End=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u884C\u8A2D\u5B9A
FR-Utils-New_Folder=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u30FC\u306E\u4F5C\u6210
BiasD-From-upper_left_to_lower_right=\u5DE6\u4E0A\u5074\u304B\u3089\u53F3\u4E0B\u5074\u3078\u5E83\u3052\u308B
CapsLock=Caps Lock\u304C\u30AA\u30F3\u306B\u306A\u3063\u3066\u3044\u308B
StyleFormat-Sample=\u4F8B
RWA-Smart_Add_Cell_Group=\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30C8\u6DFB\u52A0\u30EC\u30A4\u30E4\u30FC\u7D44
MConfig-CancelButton=\u30AD\u30E3\u30F3\u30BB\u30EB
@ -794,7 +794,7 @@ BackgroundTexture-GreenMarble=\u7DD1\u8272\u306E\u5927\u7406\u77F3
read_time_out=\u30ED\u30FC\u30C9\u306E\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8
JavaScript-Commit_to_Database=\u5165\u5EAB\u63D0\u51FA
DS-Relation_TableData=\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u95A2\u9023\u4ED8\u3051
CellWrite-Page_Before_Row=\u884C\u524D\u306E\u6539\u9801
CellWrite-Page_Before_Row=\u884C\u524D\u306E\u6539\u30DA\u30FC\u30B8
FR-Designer-Plugin_Load_Plugins_From_Server=\u30D7\u30E9\u30B0\u30A4\u30F3\u30DE\u30FC\u30B1\u30C3\u30C8\u304B\u3089\u30C7\u30FC\u30BF\u53D6\u5F97\u4E2D
D-Dispaly_Divide_Result_Set_into_Groups=resultset\u306E\u30B0\u30EB\u30FC\u30D7\u5206\u3051
Closed=\u9589\u9396\u6E08\u307F
@ -886,7 +886,7 @@ Device=\u8A2D\u5099
M_Insert-Cell=\u30BB\u30EB\u8981\u7D20
Present-Formula_Present=\u516C\u5F0F\u30D5\u30A9\u30EB\u30E0
FRFont-Superscript=\u4E0A\u4ED8\u304D
CellWrite-Page_Before_Column=\u5217\u524D\u306E\u6539\u9801
CellWrite-Page_Before_Column=\u5217\u524D\u306E\u6539\u30DA\u30FC\u30B8
Golden=\u30B4\u30FC\u30EB\u30C7\u30F3
Preference-Support_Cell_Editor_Definition=\u30BB\u30EB\u30A8\u30C7\u30A3\u30BF\u30FC\u3092\u30B5\u30DD\u30FC\u30C8\u3059\u308B
M-Page_Preview=\u30DA\u30FC\u30B8\u5225\u30D7\u30EC\u30D3\u30E5\u30FC
@ -997,8 +997,8 @@ Hyperlink-Web_link=\u30A6\u30A7\u30D6\u30EA\u30F3\u30AF
StyleAlignment-between_-90_and_90=-90\u304B\u308990\u307E\u3067\u306E\u7BC4\u56F2\u3067
FormulaD-Custom_Function=\u30E6\u30FC\u30B6\u5B9A\u7FA9\u95A2\u6570
FR-Designer_Integer=\u6574\u6570
PageSetup-Finis_Start_Row=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u884C
RWA-Remove_Field=\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30EA\u30E0\u30FC\u30D6
PageSetup-Finis_Start_Row=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u884C
RWA-Remove_Field=\u30D5\u30A3\u30FC\u30EB\u30C9\u524A\u9664
Form-Desin_Width=\u30C7\u30B6\u30A4\u30F3\u5E45
No-tableData=\u623B\u3057\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u304C\u3042\u308A\u307E\u305B\u3093
Page_Total=\u5408\u8A08
@ -1317,20 +1317,20 @@ FR-Base_Table=\u8868
Des-Remove_WorkSheet=\u9078\u629E\u3059\u308B\u5E33\u7968\u306B\u306F\u30C7\u30FC\u30BF\u304C\u3042\u308B\u304B\u3082\u3057\u308C\u307E\u305B\u3093\u304C\u3001\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\u5834\u5408\u3001
Rotation=\u56DE\u8EE2
Undefined=\u672A\u5B9A\u7FA9
Support-Auto_Complete_Shortcut=\u81EA\u52D5\u3067\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC\u3092\u88DC\u3046
Set_Column_Title_End=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u5217\u3092\u8A2D\u5B9A
Submit_Url=\u30A2\u30C9\u30EC\u30B9\u63D0\u51FA
ReportServerP-Are_you_sure_to_delete_the_selected_printer=\u9078\u629E\u3055\u308C\u305F\u30D7\u30EA\u30F3\u30BF\u30FC\u3092\u524A\u9664\u3057\u3066
long_data_can_not_show_fully=\u9577\u3044\u30C7\u30FC\u30BF\u304C\u5341\u5206\u306B\u767A\u63EE\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
Utils-Beyond_the_bottom_side_of_Border=\u4E0B\u9818\u57DF\u3092\u30AA\u30FC\u30D0\u30FC
FR-Import-Export_PDF=PDF\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8
Form-CheckBoxGroup=\u30D5\u30EC\u30FC\u30E0\u30BB\u30C3\u30C8\u3092\u8907\u6570\u9078\u629E
Click-Me=\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u30B5\u30D7\u30E9\u30A4\u30BA\u304C\u3042\u308A\u307E\u3059\u3088\uFF01
Hyperlink-Self=\u540C\u3058Frame(S)
Tree-Select_Leaf_Only_Tips=\u30C1\u30A7\u30C3\u30AF\u3057\u306A\u3044\u5834\u5408\u3001\u623B\u308A\u5024\u306F\u5F53\u30CE\u30FC\u30C9\u3060\u3051\u3002
StyleAlignment-Text_Rotation=\u30C6\u30AD\u30B9\u30C8\u65B9\u5411
Format-Error=\u5165\u529B\u3057\u305F\u5024\u306E\u66F8\u5F0F\u304C\u4E0D\u6B63\u78BA\u3067\u3059
Server-Stop=\u4E00\u6642\u505C\u6B62
Support-Auto_Complete_Shortcut=\u81EA\u52D5\u88DC\u5B8C\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC
Set_Column_Title_End=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u5217\u8A2D\u5B9A
Submit_Url=\u66F8\u304D\u8FBC\u307F\u30A2\u30C9\u30EC\u30B9
ReportServerP-Are_you_sure_to_delete_the_selected_printer=\u9078\u629E\u3055\u308C\u305F\u30D7\u30EA\u30F3\u30BF\u3092\u524A\u9664\u3057\u307E\u3059\u304B
long_data_can_not_show_fully=\u9577\u3044\u30C7\u30FC\u30BF\u306E\u8868\u793A\u306F\u4E0D\u5B8C\u5168
Utils-Beyond_the_bottom_side_of_Border=\u4E0B\u306E\u5883\u754C\u3092\u8D85\u904E\u3057\u3066\u3044\u307E\u3059\u3002
FR-Import-Export_PDF=PDF
Form-CheckBoxGroup=\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u30B0\u30EB\u30FC\u30D7
Click-Me=\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u30B5\u30D7\u30E9\u30A4\u30BA\u304C\u3042\u308A\u307E\u3059\u3088!
Hyperlink-Self=\u540C\u3058\u30D5\u30EC\u30FC\u30E0(S)
Tree-Select_Leaf_Only_Tips=(\u30C1\u30A7\u30C3\u30AF\u304C\u306A\u3044\u5834\u5408\u3001\u5B50\u30CE\u30FC\u30C9\u3092\u542B\u307E\u306A\u3044\u9078\u629E\u306E\u30CE\u30FC\u30C9\u3060\u3051\u3092\u623B\u3059)
StyleAlignment-Text_Rotation=\u6587\u5B57\u5217\u306E\u65B9\u5411
Format-Error=\u5165\u529B\u5024\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
Server-Stop=\u505C\u6B62
Preference-Setting_Grid=\u30B0\u30EA\u30C3\u30C9\u8A2D\u5B9A
ReportServerP-Add_Printer=\u30D7\u30EA\u30F3\u30BF\u30FC\u8FFD\u52A0
FR-Designer-Plugin_Active=\u4F7F\u7528\u958B\u59CB
@ -1374,10 +1374,10 @@ Formula_Tips=\u5F0F\u306F "\
FR-Action_Copy=\u30B3\u30D4\u30FC
Compile_Success=\u7DE8\u96C6\u7FFB\u8A33\u306B\u6210\u529F\u3057\u307E\u3057\u305F
BackgroundTexture-RecycledPaper=\u518D\u751F\u7D19
StyleAlignment-Single_Line=\u4E00\u884C\u3067\u8868\u793A
Utils-Move_Down=\u4E0B\u3078\u79FB\u52D5
Please_Set_Repeat_First=\u307E\u305A\u91CD\u8907\u3059\u308B\u6A19\u984C\u884C\u3068\u5217\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044
Writer-ShortCuts_Setting=\u5831\u544A\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC\u8A2D\u5B9A
StyleAlignment-Single_Line=1\u884C\u8868\u793A
Utils-Move_Down=\u4E0B\u3078
Please_Set_Repeat_First=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u884C\u3068\u5217\u3092\u4E8B\u524D\u306B\u5B9A\u7FA9\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
Writer-ShortCuts_Setting=\u66F8\u304D\u8FBC\u307F\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8\u30AD\u30FC\u8A2D\u5B9A
Verify-Data_Verify=\u30C7\u30FC\u30BF\u691C\u8A3C
FR-mobile_analysis_style=\u89E3\u6790\u65B9\u5F0F
Confirm-Delete-File=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F
@ -1405,13 +1405,13 @@ LayerData=\u5E95\u5C42\u6570\u636E
Rename=\u540D\u79F0\u306E\u5909\u66F4
Widget-Load_By_Async=\u975E\u540C\u671F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9
Shape=\u56F3\u5F62
BindColumn-This_Condition_has_been_existed=\u5F53\u8A72\u6761\u4EF6\u306F\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:11300005 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F
Set_Column_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217\u3092\u8A2D\u5B9A
Fri=\u91D1
M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC
REPORTLETS=\u8907\u6570\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30EB\u30FC\u30C8\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u306B\u30A2\u30AF\u30BB\u30B9
WLayout-Card-ToolTip=\u30AB\u30FC\u30C9\u306E\u30EC\u30A4\u30A2\u30A6\u30C8\u306F\u3001\u30EC\u30A4\u30A2\u30A6\u30C8\u30B3\u30F3\u30C6\u30CA\u5185\u306E\u4ED6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u6570
BindColumn-This_Condition_has_been_existed=\u3053\u306E\u6761\u4EF6\u306F\u65E2\u306B\u3042\u308A\u307E\u3059
NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:1305 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u30A8\u30E9\u30FC
Set_Column_Title_Start=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u5217\u8A2D\u5B9A
Fri=\u91D1\u66DC\u65E5
M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF
REPORTLETS=\u8907\u6570\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u30D1\u30B9\u306E\u30D1\u30E9\u30E1\u30FC\u30BF
WLayout-Card-ToolTip=\u30AB\u30FC\u30C9\u578B\u30EC\u30A4\u30A2\u30A6\u30C8\u3002\u3053\u306E\u30EC\u30A4\u30A2\u30A6\u30C8\u30B3\u30F3\u30C6\u30CA\u306B\u8907\u6570\u306E\u4ED6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u8FFD\u52A0\u3067\u304D\u307E\u3059\u3002
M-Popup_ChartType=\u30B0\u30E9\u30D5\u30BF\u30A4\u30D7
Please-Wait=\u5C11\u3005\u304A\u5F85\u3061\u304F\u3060\u3055\u3044
FR-Designer-Form-ToolBar_Widget=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB
@ -1530,7 +1530,7 @@ M_Insert-Barcode=\u30D0\u30FC\u30B3\u30FC\u30C9
Bounds=\u30DC\u30FC\u30C0\u30FC
FR-Designer-Undo_All_Authority_Operations=\u524D\u56DE\u306E\u6A29\u9650\u7DE8\u96C6\u6642\u306E\u5168\u3066\u306E\u30AA\u30DA\u30EC\u30FC\u30B7\u30E7\u30F3\u3092\u64A4\u56DE\u3059
Datasource-Context=\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8
CellWrite-Page_After_Column=\u5217\u5F8C\u306E\u6539\u9801
CellWrite-Page_After_Column=\u5217\u5F8C\u306E\u6539\u30DA\u30FC\u30B8
FR-Designer_Cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
Button-Group-Display-Columns=\u5217\u306E\u6570\u3092\u8868\u793A\u3059\u308B
Widget-Height=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u9AD8\u3055
@ -1736,11 +1736,11 @@ No_Editor_Property_Definition=\u5F53\u8A72\u30A8\u30C7\u30A3\u30BF\u306F\u5C5E\u
Env-Remote_Server=\u30EA\u30E2\u30FC\u30C8\u30B5\u30FC\u30D0\u30FC
FR-Utils_Background=\u80CC\u666F
FR-Designer-Plugin_Warning=\u8B66\u544A
Server-version-info=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u306F\u3001\u5F8C\u3067\u8A2D\u8A08\u3084\u5143\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5C5E\u6027\u3092\u5931\u3046\u30EA\u30B9\u30AF\u306B
CellWrite-Page_After_Row=\u884C\u5F8C\u306E\u6539\u9801
HF-Right_Section=\u53F3\u5074\u30BB\u30AF\u30B7\u30E7\u30F3
PageSetup-Title_Start_Row=\u91CD\u8907\u3059\u308B\u6A19\u984C\u884C
From=\u7B2C\u3000\u304B\u3089
Server-version-info=\u958B\u3044\u305F\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u306F\u3001\u4E0A\u4F4D\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u306E\u30C7\u30B6\u30A4\u30CA\u30FC\u3067\u4F5C\u6210\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4E0A\u4F4D\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u3067\u4F5C\u6210\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u3068\u30A8\u30E9\u30FC\u306E\u767A\u751F\u539F\u56E0\u3068\u306A\u308B\u307B\u304B\u3001\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u6A5F\u80FD\u3084\u5C5E\u6027\u306E\u4E00\u90E8\u3092\u5931\u3046\u6050\u308C\u304C\u3042\u308A\u307E\u3059\u3002\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4F5C\u6210\u7528\u306E\u30C7\u30B6\u30A4\u30CA\u30FC\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u3001\u914D\u5099\u3055\u308C\u308B\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u3088\u308A\u3082\u4E0B\u4F4D\u306E\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3\u3067\u3042\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
CellWrite-Page_After_Row=\u884C\u5F8C\u306E\u6539\u30DA\u30FC\u30B8
HF-Right_Section=\u53F3\u5074
PageSetup-Title_Start_Row=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u884C
From=From
Preference-Grid_Line_Color=\u30B0\u30EA\u30C3\u30C9\u7DDA\u306E\u8272
RowTo=\u884C\u304B\u3089\u7B2C\u307E\u3067
FR-Designer_ReportColumns-Repeat_Column=\u5217\u9806\u5E8F\u3092\u30B3\u30D4\u30FC
@ -1819,8 +1819,8 @@ FR-mobile_native_analysis=\u4E00\u6B21\u89E3\u6790
HighLight=\u30CF\u30A4\u30E9\u30A4\u30C8
FR-Designer_Dropdown-More-Preview=\u4E0B\u62C9\u83B7\u53D6\u66F4\u591A\u9884\u89C8\u65B9\u5F0F
local=\u30ED\u30FC\u30AB\u30EB
FR-Designer_Gradation=\u69CB\u6210
PageSetup-Finis_Start_Column=\u91CD\u8907\u3059\u308B\u7D42\u4E86\u5217
FR-Designer_Gradation=\u30EC\u30D9\u30EB
PageSetup-Finis_Start_Column=\u91CD\u8907\u30D5\u30C3\u30BF\u30FC\u5217
Env-Invalid_User_and_Password=\u7121\u52B9\u306A\u30E6\u30FC\u30B6\u30FC\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3059
FR-Designer-Plugin_All_Plugins=\u5168\u3066\u306E\u30D7\u30E9\u30B0\u30A4\u30F3
FR-Designer_Prepare_Export=\u5C0E\u51FA\u3092\u958B\u59CB\u3057\u3066\u3044\u307E\u3059\u3002\u304A\u5F85\u3061\u304F\u3060\u3055\u3044
@ -1933,16 +1933,16 @@ Sun=\u65E5
FR-Designer_ToolBar_Bottom=\u30D5\u30C3\u30BF\u30FC\u30C4\u30FC\u30EB\u30D0\u30FC
Widget-Width=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u5E45
Series_Name=\u7CFB\u5217\u540D
Set_Row_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u884C\u3092\u8A2D\u5B9A
HF-Default_Page=\u30C7\u30D5\u30A9\u30EB\u30C8\u30DA\u30FC\u30B8
Env_Des=\u30ED\u30B0\u30A4\u30F3\u74B0\u5883\u4E2D\u306E\u5E33\u7968\u5DE5\u7A0B\u306B\u6A29\u9650\u3092\u4ED8\u4E0E\u3059\u308B\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u8A18\u5165\u306F\u5FC5\u305A
Widget-User_Defined=\u30D7\u30EC\u5B9A\u7FA9
Url_location=\u7D76\u5BFE\u30EB\u30FC\u30C8
Disk_File=\u30CF\u30FC\u30C9\u30C7\u30A3\u30B9\u30AF\u30D5\u30A1\u30A4\u30EB
Inside=\u5185\u90E8
FR-Designer_filedChosen=
ServerM-Predefined_Styles=\u30D7\u30EC\u5B9A\u7FA9\u30B9\u30BF\u30A4\u30EB
is_need_word_adjust=\u884C\u306E\u9AD8\u3055\u3092\u56FA\u5B9A\u305B\u305A\u5C0E\u51FA
Set_Row_Title_Start=\u91CD\u8907\u30D8\u30C3\u30C0\u30FC\u884C\u8A2D\u5B9A
HF-Default_Page=\u65E2\u5B9A\u30DA\u30FC\u30B8
Env_Des=\u30ED\u30B0\u30A4\u30F3\u74B0\u5883\u4E2D\u306E\u5E33\u7968\u5DE5\u7A0B\u306B\u6A29\u9650\u3092\u4ED8\u4E0E\u3059\u308B\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u8A18\u5165\u306F\u5FC5\u305A\u5BFE\u5FDC\u3059\u308B\u30ED\u30B0\u30A4\u30F3\u74B0\u5883\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093\u3002
Widget-User_Defined=\u4E8B\u524D\u5B9A\u7FA9
Url_location=\u7D76\u5BFE\u30D1\u30B9
Disk_File=\u30D5\u30A1\u30A4\u30EB
Inside=\u5185\u5074
FR-Designer_filedChosen=\u4F9D\u5B58\u30D5\u30A3\u30FC\u30EB\u30C9
ServerM-Predefined_Styles=\u4E8B\u524D\u5B9A\u7FA9\u30B9\u30BF\u30A4\u30EB
is_need_word_adjust=\u884C\u306E\u9AD8\u3055\u3092\u56FA\u5B9A\u3057\u306A\u3044
Background-Null=\u80CC\u666F\u306A\u3057
PageSetup-Vertically=\u5782\u76F4\u4E2D\u592E\u63C3\u3048
FR-Designer_Root=\u30EB\u30FC\u30C8\u30CE\u30FC\u30C9
@ -1976,9 +1976,62 @@ ColumnSpan=\u5217\u7BC4\u56F2
StyleAlignment-Bottom=\u4E0B\u8A70\u3081
Read_failure=\u8AAD\u307F\u306B\u969C\u5BB3\u304C\u767A\u751F\u3059\u308B\u3068\u3001\u30BD\u30FC\u30B9\u00B7\u30D5\u30A1\u30A4\u30EB\u304C\u7834\u640D\u3057\u3066\u3044\u308B
Verify-Verify=\u30C7\u30FC\u30BF\u691C\u8A3C
FR-Designer-Widget-Style_Title_Format=\u6A19\u984C\u66F8\u5F0F
FR-Designer_Edit_String_To_Formula=\u30AD\u30E3\u30E9\u30AF\u30BF\u30FC\u6587\u5B57\u5217\u3092\u7DE8\u96C6\u3057\u3066\u516C\u5F0F\u3068\u3059\u308B\u304B\u5426\u304B
FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
Every=\u6BCF
CellWrite-Preview_Cell_Content=\u30BB\u30EB\u306E\u5185\u5BB9\u3092\u30D7\u30EC\u30D3\u30E5\u30FC\u3059\u308B
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer-Widget-Style_Title_Format=\u30BF\u30A4\u30C8\u30EB\u66F8\u5F0F
FR-Designer_Edit_String_To_Formula=\u6587\u5B57\u5217\u3092\u6570\u5F0F\u306B\u7DE8\u96C6\u3059\u308B\u304B
FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
Every=\u6BCE
CellWrite-Preview_Cell_Content=\u30BB\u30EB\u5185\u5BB9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Permissions=\u6A29\u9650
FR-Designer_Form_Button=\u30DC\u30BF\u30F3
FR-Designer_WF_Name=\u540D
FR-Designer_Role=\u5F79\u5272
FR-Designer_Double=\u5C0F\u6570
FR-Designer_Query=\u30AF\u30A8\u30EA
FR-Designer_Font=\u30D5\u30A9\u30F3\u30C8
FR-Designer_Confirm=OK
FR-Designer_Parameter=\u30D1\u30E9\u30E1\u30FC\u30BF
FR-Designer-Plugin_Plugin=\u30D7\u30E9\u30B0\u30A4\u30F3
FR-Designer_Background=\u80CC\u666F
Template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8
FR-Designer_Original_Marked_Filed=\u521D\u671F\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u9577\u3055\u3088\u308A\u30C4\u30EA\u30FC\u3092\u69CB\u7BC9\u3059\u308B
FR-Designer_Tree_Data_Field=\u30C4\u30EA\u30FC\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Parent_Marked_Field=\u89AA\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u89AA\u30DE\u30FC\u30AF\u30D5\u30A3\u30FC\u30EB\u30C9\u3088\u308A\u30C4\u30EA\u30FC\u3092\u69CB\u7BC9\u3059\u308B
FR-Product_Demo=\u88FD\u54C1\u30C7\u30E2
FR-Designer_Data_Filter=\u30C7\u30FC\u30BF\u30D5\u30A3\u30EB\u30BF
FR-Designer_Can_not_use_FormatBursh=\u9023\u7D9A\u3057\u306A\u3044\u8907\u6570\u9818\u57DF\u3067\u306F\u66F8\u5F0F\u30B3\u30D4\u30FC\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
Default=\u65E2\u5B9A
FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20
FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027
FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20
FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_Scale_customButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

54
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -446,7 +446,6 @@ FR-Designer_WLayout-Absolute-ToolTips=\uC790\uC720\uC2DD\uB808\uC774\uC544\uC6C3
FR-Designer_Add_all=\uBAA8\uB450\uCD94\uAC00
FR-Designer_Reset=
FR-Designer_Language_Change_Successful=
FR-Designer_Template_Web_Attributes=
FR-Designer_Basic=\uAE30\uBCF8
FR-Designer_Printers(Server)=\uD504\uB9B0\uD130(\uC11C\uBC84)
FR-Designer_Pagination_Setting=\uD398\uC774\uC9C0\uB098\uB204\uAE30\uBBF8\uB9AC\uBCF4\uAE30\uC124\uC815
@ -1982,4 +1981,55 @@ FR-Designer_Edit_String_To_Formula=\uBB38\uC790\uC5F4\uC744\uC218\uC2DD\uC73C\uB
FR-Base_UnSignIn=\uC544\uC9C1 \uB4F1\uB85D
Every=\uAC01
CellWrite-Preview_Cell_Content=\uC140\uB0B4\uC6A9\uBBF8\uB9AC\uBCF4\uAE30
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FR-Designer_Permissions=
FR-Designer_Form_Button=
FR-Designer_WF_Name=
FR-Designer_Role=
FR-Designer_Double=\uC18C\uC218
FR-Designer_Query=\uCC3E\uC544\uBCF4\uAE30
FR-Designer_Font=\uAE00\uAF34
FR-Designer_Confirm=\uD655\uC778
FR-Designer_Parameter=\uB9E4\uAC1C\uBCC0\uC218
FR-Designer-Plugin_Plugin=\uD50C\uB7EC\uADF8\uC778
FR-Designer_Background=\uBC30\uACBD
Template=\uD15C\uD50C\uB9BF
FR-Designer_Original_Marked_Filed=\uCD08\uAE30\uD0DC\uADF8\uD544\uB4DC
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\uC120\uD0DD\uD55C\uB370\uC774\uD130\uC138\uD2B8\uC758\uD0DC\uADF8\uD544\uB4DC\uAE38\uC774\uC5D0\uB530\uB77C\uD2B8\uB9AC\uC0DD\uC131
FR-Designer_Tree_Data_Field=\uD2B8\uB9AC\uB370\uC774\uD130\uD544\uB4DC
FR-Designer_Parent_Marked_Field=\uBD80\uBAA8\uD0DC\uADF8\uD544\uB4DC
FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\uC120\uD0DD\uD55C\uB370\uC774\uD130\uC138\uD2B8\uC758\uBD80\uBAA8\uD0DC\uADF8\uD544\uB4DC\uC5D0\uB530\uB77C\uD2B8\uB9AC\uC0DD\uC131
FR-Product_Demo=\uC81C\uD488\uC2DC\uC5F0
FR-Designer_Data_Filter=\uB370\uC774\uD130\uC120\uBCC4
Default=\uAE30\uBCF8
FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FR-Designer_Cell_Element=\uC140\uC694\uC18C
FR-Designer_Cell_Attributes=\uC140\uC18D\uC131
FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C
FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

50
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -1997,9 +1997,57 @@ FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8
FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981
FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer_AlphaFine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9
FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25
FR-Designer_NoResult=\u6682\u4E0D\u652F\u6301\u663E\u793A
FR-Designer-AlphaFine_SetShortcuts=\u8BF7\u76F4\u63A5\u5728\u952E\u76D8\u4E0A\u6309\u4E24\u4E2A\u7EC4\u5408\u952E
FR-Designer_Write_Enhance_Preview=\u65B0\u586B\u62A5\u9884\u89C8
FR-Designer_Double=\u5C0F\u6570
FR-Designer_Query=\u67E5\u8BE2
FR-Designer_Font=\u5B57\u4F53
FR-Designer_Confirm=\u786E\u8BA4
FR-Designer_Parameter=\u53C2\u6570
FR-Designer-Plugin_Plugin=\u63D2\u4EF6
FR-Designer_Background=\u80CC\u666F
Template=\u6A21\u7248
FR-Designer_Original_Marked_Filed=\u539F\u59CB\u6807\u8BB0\u5B57\u6BB5
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\u4F9D\u8D56\u6240\u9009\u6570\u636E\u96C6\u7684\u6807\u8BB0\u5B57\u6BB5\u7684\u957F\u5EA6\u6784\u5EFA\u6811
FR-Designer_Tree_Data_Field=\u6811\u6570\u636E\u5B57\u6BB5
FR-Designer_Parent_Marked_Field=\u7236\u6807\u8BB0\u5B57\u6BB5
FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u4F9D\u8D56\u6240\u9009\u6570\u636E\u96C6\u7684\u7236\u6807\u8BB0\u5B57\u6BB5\u6784\u5EFA\u6811
FR-Product_Demo=\u4EA7\u54C1\u6F14\u793A
FR-Designer_Data_Filter=\u6570\u636E\u7B5B\u9009
Default=\u9ED8\u8BA4
FR-Base-Load_Resource_File=\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6
FR-Designer_Cell_Element=\u5355\u5143\u683C\u5143\u7D20
FR-Designer_Cell_Attributes=\u5355\u5143\u683C\u5C5E\u6027
FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93
FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_EnlargeOrReduce=\u7F29\u653E
FR-Designer_Scale_selfAdaptButton=\u6070\u597D\u5BB9\u7EB3\u9009\u5B9A\u533A\u57DF
FR-Designer_Scale_customButton=\u81EA\u5B9A\u4E49
FR-Designer_FRFont_Subscript=\u4E0B\u6807
FR-Designer_FRFont_Superscript=\u4E0A\u6807
FR-Designer_FRFont_Shadow=\u9634\u5F71
FR-Designer_FRFont_Strikethrough=\u5220\u9664\u7EBF
FR-Designer_FRFont_Underline=\u4E0B\u5212\u7EBF
FR-Designer_FRFont_bold=\u52A0\u7C97
FR-Designer_FRFont_italic=\u659C\u4F53
FR-Designer_FRFont_Foreground=\u989C\u8272
FR-Designer_FRFont_Style=\u5B57\u5F62
FR-Designer_FRFont_plain=\u5E38\u89C4
FR-Designer_FRFont_bolditalic=\u52A0\u7C97\u503E\u659C
FR-Designer_outBorder=\u5916\u8FB9\u6846
FR-Designer_inBorder=\u5185\u8FB9\u6846
FR-Designer_ExpandD_Up_Father_Cell=\u4E0A\u7236\u683C
FR-Designer_ExpandD_Expand_Direction=\u6269\u5C55\u65B9\u5411
FR-Designer_Expand=\u6269\u5C55
FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F
FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027
FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F

50
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -1997,10 +1997,58 @@ FR-Designer_Templates=\u6A21\u677F
FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9
FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer_AlphaFine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A
FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9
FR-Designer_ConnectionFailed=\u93C8\u63A5\u5931\u6557
FR-Designer_NoResult=\u66AB\u4E0D\u652F\u6301\u986F\u793A
FR-Designer-AlphaFine_SetShortcuts=\u8ACB\u76F4\u63A5\u5728\u9375\u76E4\u4E0A\u6309\u5169\u500B\u7D44\u5408\u9375
FR-Designer_Write_Enhance_Preview=\u65B0\u586B\u5831\u9810\u89BD
FR-Designer_Double=\u5C0F\u6578
FR-Designer_Query=\u67E5\u8A62
FR-Designer_Font=\u5B57\u9AD4
FR-Designer_Confirm=\u78BA\u8A8D
FR-Designer_Parameter=\u53C3\u6578
FR-Designer-Plugin_Plugin=\u63D2\u4EF6
FR-Designer_Background=\u586B\u6EFF\u8272\u5F69
Template=\u7BC4\u672C
FR-Designer_Original_Marked_Filed=\u539F\u59CB\u6A19\u8A18\u6B04\u4F4D
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\u4F9D\u8CF4\u6240\u9078\u8CC7\u6599\u96C6\u7684\u6A19\u8A18\u6B04\u4F4D\u7684\u9577\u5EA6\u69CB\u5EFA\u6A39\u72C0
FR-Designer_Can_not_use_FormatBursh=\u7121\u6CD5\u4F7F\u7528\u8907\u88FD\u683C\u5F0F
FR-Designer_Tree_Data_Field=\u6A39\u72C0\u8CC7\u6599\u6B04\u4F4D
FR-Designer_Parent_Marked_Field=\u7236\u6A19\u8A18\u6B04\u4F4D
FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u4F9D\u8CF4\u6240\u9078\u8CC7\u6599\u96C6\u7684\u7236\u6A19\u8A18\u6B04\u4F4D\u69CB\u5EFA\u6A39
FR-Product_Demo=\u529F\u80FD\u5C55\u793A
FR-Designer_Data_Filter=\u8CC7\u6599\u7BE9\u9078
Default=\u9810\u8A2D
FR-Base-Load_Resource_File=\u52A0\u8F09\u914D\u7F6E\u6A94\u6848
FR-Designer_Cell_Element=\u5132\u5B58\u683C\u5143\u7D20
FR-Designer_Cell_Attributes=\u5132\u5B58\u683C\u5C6C\u6027
FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB
FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_Scale_customButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

10
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -255,6 +255,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.add(centerPane, BorderLayout.CENTER);
laoyoutWestPane();
// JPanel eastRegionPane = new JPanel(new BorderLayout());
// eastRegionPane.add(EastRegionContainerPane.getInstance(), BorderLayout.CENTER);
// eastRegionPane.add(JSliderPane.getInstance(), BorderLayout.SOUTH);
// basePane.add(eastRegionPane, BorderLayout.EAST);
basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST);
basePane.setBounds(0, 0, contentWidth, contentHeight);
@ -421,10 +426,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
EastRegionContainerPane.getInstance().replaceUpPane(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastUpPane());
EastRegionContainerPane.getInstance().replaceDownPane(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastDownPane());
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();

862
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1,11 +1,61 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.stable.Constants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.fr.pdf.kernel.utils.CompareTool;
public class EastRegionContainerPane extends UIResizableContainer {
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS;
private Map<String, PropertyItem> propertyItemMap;
private CardLayout propertyCard;
private JPanel leftPane;
private JPanel rightPane;
private static final int CONTAINER_WIDTH = 260;
private static final int TAB_WIDTH = 40;
private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH;
private static final int POPUP_TOOLPANE_HEIGHT = 25;
private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30;
private static final String KEY_CELL_ELEMENT = "cellElement";
private static final String KEY_CELL_ATTR = "cellAttr";
private static final String KEY_FLOAT_ELEMENT = "floatElement";
private static final String KEY_WIDGET_SETTINGS = "widgetSettings";
private static final String KEY_CONDITION_ATTR = "conditionAttr";
private static final String KEY_HYPERLINK = "hyperlink";
private static final String KEY_WIDGET_LIB = "widgetLib";
private static final String KEY_AUTHORITY_EDITION = "authorityEdition";
private static final String KEY_CONFIGURED_ROLES = "editedRoles";
private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板
public enum PropertyMode {
REPORT, // 报表
REPORT_PARA, // 报表参数面板
REPORT_FLOAT, // 报表悬浮元素
FORM, // 表单
FORM_REPORT, // 表单报表块
POLY, // 聚合报表
POLY_REPORT, // 聚合报表-报表块
POLY_CHART, // 聚合报表-图表块
AUTHORITY_EDITION // 权限编辑
}
private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板)
/**
* 得到实例
@ -15,24 +65,816 @@ public class EastRegionContainerPane extends UIResizableContainer {
public static final EastRegionContainerPane getInstance() {
if (THIS == null) {
THIS = new EastRegionContainerPane();
THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY());
// THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY());
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
}
return THIS;
}
public EastRegionContainerPane() {
super(Constants.LEFT);
setVerticalDragEnabled(false);
setContainerWidth(260);
super();
// setVerticalDragEnabled(false);
initPropertyItemList();
switchMode(PropertyMode.REPORT);
// initContentPane();
// super(leftPane, rightPane);
setContainerWidth(CONTAINER_WIDTH);
}
private void initPropertyItemList() {
propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 单元格属性
PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 悬浮元素
PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
// 条件属性
PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 超级链接
PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.FORM},
new PropertyMode[]{PropertyMode.FORM});
// 权限编辑
PropertyItem authorityEdition = new PropertyItem(KEY_AUTHORITY_EDITION, Inter.getLocText("FR-Designer_Permissions_Edition"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
// 已配置角色
PropertyItem configuredRoles = new PropertyItem(KEY_CONFIGURED_ROLES, Inter.getLocText("FR-Designer_Configured_Roles"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
propertyItemMap.put(KEY_CELL_ELEMENT, cellElement);
propertyItemMap.put(KEY_CELL_ATTR, cellAttr);
propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement);
propertyItemMap.put(KEY_WIDGET_SETTINGS, widgetSettings);
propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr);
propertyItemMap.put(KEY_HYPERLINK, hyperlink);
propertyItemMap.put(KEY_WIDGET_LIB, widgetLib);
propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition);
propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles);
}
// "无可用配置项"面板
private JPanel getDefaultPane() {
JPanel defaultPane = new JPanel();
UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available"));
defaultPane.setLayout(new BorderLayout());
defaultPane.add(label, BorderLayout.CENTER);
return defaultPane;
}
private void initContentPane() {
initRightPane();
initLeftPane();
}
// 右侧属性面板
private void initRightPane() {
rightPane = new JPanel();
propertyCard = new CardLayout();
rightPane.setBackground(Color.green);
rightPane.setLayout(propertyCard);
for (PropertyItem item : propertyItemMap.values()) {
if (item.isPoppedOut() || !item.isVisible()) {
continue;
}
rightPane.add(item.getName(), item.getPropertyPanel());
}
rightPane.add(DEFAULT_PANE, getDefaultPane());
replaceRightPane(rightPane);
refreshRightPane();
}
// 左侧按钮面板
private void initLeftPane() {
leftPane = new JPanel();
leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0));
for (PropertyItem item : propertyItemMap.values()) {
if (item.isPoppedOut() || !item.isVisible()) {
continue;
}
leftPane.add(item.getButton());
}
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
leftPane.setBackground(new Color(210, 210, 210));
replaceLeftPane(leftPane);
}
public void switchMode(PropertyMode mode) {
if (currentMode != null && currentMode.equals(mode)) {
return;
}
currentMode = mode;
updateAllPropertyPane();
}
public void updateAllPropertyPane() {
updatePropertyItemMap();
initContentPane();
}
private void updatePropertyItemMap() {
for (PropertyItem item : propertyItemMap.values()) {
item.updateStatus();
}
}
// 弹出面板时,更新框架内容
private void removeItem(PropertyItem propertyItem) {
leftPane.remove(propertyItem.getButton());
rightPane.remove(propertyItem.getPropertyPanel());
refreshRightPane();
refreshContainer();
}
@Override
public void onResize() {
for (PropertyItem item : propertyItemMap.values()) {
item.onResize();
}
}
public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) {
super(leftPane, rightPane);
// setVerticalDragEnabled(false);
// setContainerWidth(260);
}
public void replaceUpPane(JComponent pane) {
replaceCellElementPane(pane);
}
public void replaceDownPane(JComponent pane) {
replaceCellAttrPane(pane);
}
public JComponent getUpPane() {
return getCellElementPane();
}
public JComponent getDownPane() {
return getCellAttrPane();
}
public void replaceCellElementPane(JComponent pane) {
propertyItemMap.get(KEY_CELL_ELEMENT).replaceContentPane(pane);
}
public JComponent getCellElementPane() {
return propertyItemMap.get(KEY_CELL_ELEMENT).getContentPane();
}
public void replaceCellAttrPane(JComponent pane) {
propertyItemMap.get(KEY_CELL_ATTR).replaceContentPane(pane);
}
public JComponent getCellAttrPane() {
return propertyItemMap.get(KEY_CELL_ATTR).getContentPane();
}
public void replaceFloatElementPane(JComponent pane) {
propertyItemMap.get(KEY_FLOAT_ELEMENT).replaceContentPane(pane);
}
public JComponent getFloatElementPane() {
return propertyItemMap.get(KEY_FLOAT_ELEMENT).getContentPane();
}
public void replaceWidgetSettingsPane(JComponent pane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceContentPane(pane);
}
public JComponent getWidgetSettingsPane() {
return propertyItemMap.get(KEY_WIDGET_SETTINGS).getContentPane();
}
public void replaceHyperlinkPane(JComponent pane) {
propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(pane);
}
public JComponent getHyperlinkPane() {
return propertyItemMap.get(KEY_HYPERLINK).getContentPane();
}
public void replaceWidgetLibPane(JComponent pane) {
propertyItemMap.get(KEY_WIDGET_LIB).replaceContentPane(pane);
}
public JComponent getWidgetLibPane() {
return propertyItemMap.get(KEY_WIDGET_LIB).getContentPane();
}
public void replaceAuthorityEditionPane(JComponent pane) {
propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
}
public JComponent getAuthorityEditionPane() {
return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
}
public void replaceConfiguredRolesPane(JComponent pane) {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
}
public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
}
public void addParameterPane(JComponent paraPane) {
// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane);
}
public void setParameterHeight(int height) {
// stub
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
// jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel cc = new JPanel();
cc.setBackground(Color.white);
// JPanel leftPane = new JPanel();
// leftPane.setBackground(Color.yellow);
// JPanel rightPane = new JPanel();
// rightPane.setBackground(Color.green);
//
// JButton b1, b2;
// b1 = new JButton("b1");
// b2 = new JButton("b2");
// b1.setPreferredSize(new Dimension(40, 40));
// b2.setPreferredSize(new Dimension(40, 40));
// leftPane.add(b1);
// leftPane.add(b2);
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
JPanel content = (JPanel)jf.getContentPane();
// content.setLayout(null);
content.add(cc, BorderLayout.CENTER);
content.add(new EastRegionContainerPane(), BorderLayout.EAST);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
public void removeParameterPane() {
}
/**
* 刷新下面板
* 刷新面板
*/
public void refreshRightPane() {
boolean hasAvailableTab = false;
for (String name : propertyItemMap.keySet()) {
PropertyItem propertyItem = propertyItemMap.get(name);
if (propertyItem.isVisible() && !propertyItem.isPoppedOut() && propertyItem.isEnabled()) {
propertyCard.show(rightPane, name); // 显示第一个可用tab
hasAvailableTab = true;
break;
}
}
if (!hasAvailableTab) {
propertyCard.show(rightPane, DEFAULT_PANE);
}
// if (this.getRightPane() instanceof DockingView) {
// ((DockingView) this.getRightPane()).refreshDockingView();
// }
}
public void refreshDownPane() {
if (this.getDownPane() instanceof DockingView) {
((DockingView) this.getDownPane()).refreshDockingView();
// JComponent pane = propertyItemList.get(1).getContentPane();
// if (pane instanceof DockingView) {
// ((DockingView) pane).refreshDockingView();
// }
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
public int getToolPaneY() {
return 0;
}
class PropertyItem {
private UIButton button;
private String name; // 用于 card 切换
private String title; // 用于显示
private JComponent propertyPanel;
private JComponent contentPane;
private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框
private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.name = name;
this.title = title;
initButton(btnUrl);
initPropertyPanel();
// this.visibleModes = new ArrayList<PropertyMode>(visibleModes);
initModes(visibleModes, enableModes);
}
private void initModes(PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.enableModes = new HashSet<>();
this.visibleModes = new HashSet<>();
for (PropertyMode enableMode : enableModes) {
this.enableModes.add(enableMode);
}
for (PropertyMode visibleMode : visibleModes) {
this.visibleModes.add(visibleMode);
}
this.visibleModes.addAll(this.enableModes); // 可用必可见
}
public void updateStatus() {
setEnabled(enableModes.contains(currentMode));
setVisible(visibleModes.contains(currentMode));
}
public boolean isVisible() {
return isVisible;
}
public void setVisible(boolean isVisible) {
this.isVisible = isVisible;
}
public boolean isEnabled() {
return isEnabled;
}
// 选项不可用
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
button.setEnabled(isEnabled);
}
private void initPropertyPanel() {
propertyPanel = new JPanel();
propertyPanel.setBackground(Color.pink);
contentPane = generateContentPane();
popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON);
propertyPanel.setLayout(new BorderLayout());
propertyPanel.add(popupToolPane, BorderLayout.NORTH);
propertyPanel.add(contentPane, BorderLayout.CENTER);
}
public boolean isPoppedOut() {
return isPoppedOut;
}
public JComponent generateContentPane() {
JComponent contentPane = new JPanel();
UIButton testBtn = new UIButton(name);
testBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setEnabled(!button.isEnabled());
}
});
contentPane.add(testBtn);
return contentPane;
}
public void replaceContentPane(JComponent pane) {
propertyPanel.remove(this.contentPane);
propertyPanel.add(this.contentPane = pane);
if (popupDialog != null && isPoppedOut) {
popupDialog.replaceContentPane(contentPane);
}
if (popupPane != null && !isRightPaneVisible()) {
popupPane.replaceContentPane(contentPane);
}
refreshContainer();
}
public JComponent getContentPane() {
return contentPane;
}
public void onResize() {
if (isRightPaneVisible()) {
replaceContentPane(contentPane);
} else if(popupPane != null) {
popupPane.replaceContentPane(contentPane);
}
}
// private void refreshContainer() {
// propertyPanel.validate();
// propertyPanel.repaint();
// propertyPanel.revalidate();
// }
private void initButton(String btnUrl) {
button = new UIButton(BaseUtils.readIcon(btnUrl)) {
public Dimension getPreferredSize() {
return new Dimension(TAB_WIDTH, TAB_WIDTH);
}
};
button.set4LargeToolbarButton();
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isRightPaneVisible()) {
propertyCard.show(rightPane, name);
} else {
popupFixedPane();
}
}
});
}
public UIButton getButton() {
return button;
}
public String getName() {
return name;
}
public String getTitle() {
return title;
}
public JComponent getPropertyPanel() {
return propertyPanel;
}
// 固定弹窗
public void popupFixedPane() {
if (popupPane == null) {
popupPane = new FixedPopupPane(this);
}
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
}
// 弹出对话框
public void popupDialog() {
// setIsPoppedOut(true);
if (isPoppedOut) {
return;
}
isPoppedOut = true;
if (popupDialog == null) {
popupDialog = new PopupDialog(this);
} else {
popupDialog.replaceContentPane(contentPane);
popupDialog.setVisible(true);
}
// initContentPane();
// refreshContainer();
removeItem(this);
}
public void popToFrame() {
if (isPoppedOut) {
isPoppedOut = false;
// popupDialog.dispose();
popupDialog.setVisible(false);
initContentPane();
onResize();
refreshContainer();
}
}
}
private class FixedPopupPane extends JPopupMenu {
private JComponent contentPane;
// private PopupToolPane popupToolPane;
private int fixedHeight;
FixedPopupPane(PropertyItem propertyItem) {
contentPane = propertyItem.getContentPane();
this.setLayout(new BorderLayout());
// popupToolPane = ;
this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
this.setOpaque(false);
fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height;
updateSize();
}
private void updateSize() {
int newHeight = fixedHeight + contentPane.getPreferredSize().height;
this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
}
public JComponent getContentPane() {
return contentPane;
}
public void replaceContentPane(JComponent pane) {
// remove(pane);
this.remove(this.contentPane);
this.add(this.contentPane = pane);
updateSize();
refreshContainer();
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
}
// 弹出属性面板的工具条
private class PopupToolPane extends JPanel {
private int model = UIConstants.MODEL_NORMAL;
private String title;
private JComponent contentPane;
private PropertyItem propertyItem;
private String buttonType;
private JDialog parentDialog; // 如果不在对话框中,值为null
private Color originColor; // 初始背景
private boolean isMovable = false;
private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到
private static final int MIN_X = -150;
private static final int MAX_X_SHIFT = 50;
private static final int MAX_Y_SHIFT = 50;
private static final String NO_BUTTON = "NoButton";
private static final String UP_BUTTON = "UpButton";
private static final String DOWN_BUTTON = "DownButton";
private MouseListener mouseListener = new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
if (mouseDownCompCoords == null) {
setBackground(originColor);
}
model = UIConstants.MODEL_NORMAL;
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
if (!getBounds().contains(e.getPoint())) {
setBackground(originColor);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
mouseDownCompCoords = e.getPoint();
}
}
};
private MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
model = UIConstants.MODEL_PRESS;
} else if (isMovable) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
setBackground(Color.pink);
} else {
setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) {
Point currCoords = e.getLocationOnScreen();
int x = currCoords.x - mouseDownCompCoords.x;
int y = currCoords.y - mouseDownCompCoords.y;
//屏幕可用区域
Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
int minY = screen.y;
int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT;
int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT;
if (x < MIN_X) {
x = MIN_X;
} else if (x > maxX) {
x = maxX;
}
if (y < minY) {
y = minY;
} else if (y > maxY) {
y = maxY;
}
// 移动到屏幕边缘时,需要校正位置
parentDialog.setLocation(x, y);
}
}
};
public PopupToolPane(PropertyItem propertyItem) {
this(propertyItem, NO_BUTTON);
}
public PopupToolPane(PropertyItem propertyItem, String buttonType) {
super();
this.propertyItem = propertyItem;
this.title = propertyItem.getTitle();
this.contentPane = propertyItem.getContentPane();
originColor = getBackground();
setLayout(new BorderLayout());
UILabel label = new UILabel(title);
label.setForeground(new Color(69, 135, 255));
add(label, BorderLayout.WEST);
setBorder(new EmptyBorder(5, 10, 0, 0));
initToolButton(buttonType);
}
public void setParentDialog(JDialog parentDialog) {
this.parentDialog = parentDialog;
isMovable = true;
}
private void initToolButton(final String buttonType) {
this.buttonType = buttonType;
if (StringUtils.isEmpty(buttonType) || buttonType.equals(NO_BUTTON)) {
return;
}
// validate
if (!buttonType.equals(UP_BUTTON) && !buttonType.equals(DOWN_BUTTON)) {
throw new IllegalArgumentException("unknown button type: " + buttonType);
}
addMouseMotionListener(mouseMotionListener);
addMouseListener(mouseListener);
}
// 触发弹入、弹出
private void onPop() {
if (buttonType.equals(DOWN_BUTTON)) {
propertyItem.popupDialog();
} else if (buttonType.equals(UP_BUTTON)) {
propertyItem.popToFrame();
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, POPUP_TOOLPANE_HEIGHT);
}
@Override
public void paint(Graphics g) {
super.paint(g);
Image button;
g.setColor(new Color(69, 135, 255));
g.setFont(FRFont.getInstance().applySize(14));
// g.drawString(title, 5, 20);
// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null);
if (buttonType.equals(NO_BUTTON)) {
return;
}
if (buttonType.equals(DOWN_BUTTON)) {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_LEFT_NORMAL;
} else {
button = UIConstants.DRAG_LEFT_PRESS;
}
} else {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_RIGHT_NORMAL;
} else {
button = UIConstants.DRAG_RIGHT_PRESS;
}
}
// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null);
}
}
private class PopupDialog extends JDialog {
private Container container;
private static final int RESIZE_RANGE = 4;
private Cursor originCursor;
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
private Point mouseDownCompCoords;
private int minHeight; // 对话框最小高度
private JComponent contentPane;
public PopupDialog(PropertyItem propertyItem) {
super(DesignerContext.getDesignerFrame());
container = getContentPane();
setUndecorated(true);
PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON);
popupToolPane.setParentDialog(this);
contentPane = propertyItem.getContentPane();
container.add(popupToolPane, BorderLayout.NORTH);
container.add(contentPane, BorderLayout.CENTER);
minHeight = container.getPreferredSize().height;
setSize(CONTENT_WIDTH, minHeight);
// validate();
Point btnCoords = propertyItem.getButton().getLocationOnScreen();
this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y);
initListener();
this.setVisible(true);
}
public void replaceContentPane(JComponent contentPane) {
container.remove(this.contentPane);
container.add(this.contentPane = contentPane);
// pack();
if (getSize().height < container.getPreferredSize().height) {
setSize(CONTENT_WIDTH, container.getPreferredSize().height);
}
refreshContainer();
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
private void initListener() {
addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
if (mouseDownCompCoords != null) {
Rectangle bounds = getBounds();
Point currCoords = e.getLocationOnScreen();
bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height;
// 校正位置
if (bounds.height < minHeight) {
bounds.height = minHeight;
}
mouseDownCompCoords.y = currCoords.y;
setBounds(bounds);
}
}
@Override
public void mouseMoved(MouseEvent e) {
if (originCursor == null) { // 记录最初的光标
originCursor = getCursor();
}
if (e.getY() > getHeight() - RESIZE_RANGE) {
setCursor(southResizeCursor);
} else {
// 还原
if (mouseDownCompCoords == null && getCursor().equals(southResizeCursor)) {
setCursor(originCursor);
}
}
repaint();
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (getCursor().equals(southResizeCursor)) {
mouseDownCompCoords = e.getLocationOnScreen();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
}
});
}
}
}

370
designer_base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -0,0 +1,370 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.math.BigDecimal;
/**
* Created by MoMeak on 2017/7/13.
*/
public class JFormSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
private static final int TEN = 10;
private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 14;
private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50;
private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 240;
private static final int SHOWVALBUTTON_WIDTH = 70;
private static final int SHOWVALBUTTON_HEIGHTH = 25;
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JFormSliderPane THIS;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider;
private int times;
private int sliderValue;
private UIButton downButton;
private UIButton upButton;
private UIButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
public JFormSliderPane() {
this.setLayout(new BorderLayout());
slider = new UISlider(0, HUNDRED, HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener);
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
// showValSpinner.setEditor(editor);
// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
// textField.setEditable(true);
// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
// formatter.setAllowsInvalid(false);
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
downButton.setActionCommand("less");
upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener);
showValButton = new UIButton(showValSpinner.getValue() + "%");
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener);
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(1, 1, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
panel.add(showValButton);
this.add(panel, BorderLayout.NORTH);
this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT);
}
public static final JFormSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JFormSliderPane();
// }
THIS = new JFormSliderPane();
return THIS;
}
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
// selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
//TODO
// selfAdaptButton.addItemListener();
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
// bg.add(selfAdaptButton);
bg.add(customButton);
customButton.setSelected(true);
}
private void initPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
// new Component[]{selfAdaptButton,null},
new Component[]{customButton, createSpinnerPanel()}
};
dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
private JPanel createSpinnerPanel() {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent);
return spinnerPanel;
}
ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue, 100, 2);
if (val > FOUR_HUNDRED) {
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN) {
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val);
refreshBottun(val);
}
};
//定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() {
public void run() {
sliderValue = slider.getValue();
getTimes(sliderValue);
showValue = times;
showValSpinner.setValue(times);
}
});
} else {
isButtonOrIsTxt = false;
}
}
};
ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
}
}
};
private void refreshSlider(int val) {
showValue = val;
if (showValue > HUNDRED) {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) {
slider.setValue(HALF_HUNDRED);
}
}
private void refreshBottun(int val) {
showValButton.setText(val + "%");
}
public double getResolutionTimes() {
return this.resolutionTimes;
}
public int getshowValue() {
return this.showValue;
}
public static double divide(double v1, double v2, int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.divide(b2, scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true;
if (e.getActionCommand().equals("less")) {
int newDownVal = showValue - TEN;
if (newDownVal >= TEN) {
showValue = newDownVal;
showValSpinner.setValue(newDownVal);
} else {
showValue = newDownVal;
showValSpinner.setValue(TEN);
}
}
if (e.getActionCommand().equals("more")) {
int newUpVal = showValue + TEN;
if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal;
showValSpinner.setValue(newUpVal);
} else {
showValue = newUpVal;
showValSpinner.setValue(FOUR_HUNDRED);
}
}
isButtonOrIsTxt = true;
customButton.setSelected(true);
}
};
private void getTimes(int value) {
if (value == HALF_HUNDRED) {
times = HUNDRED;
} else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else {
times = (int) (SIX * value - TWO_HUNDRED);
}
}
public JSpinner getShowVal() {
return this.showValSpinner;
}
public UIRadioButton getSelfAdaptButton() {
return this.selfAdaptButton;
}
private void popupDialog() {
Point btnCoords = upButton.getLocationOnScreen();
if (dialog == null) {
dialog = new FormPopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
} else {
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
}
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(JFormSliderPane.getInstance(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 80);
jf.setVisible(true);
}
}
class FormPopupPane extends JPopupMenu {
private JComponent contentPane;
private static final int UPLABEL_HEIGHT = 25;
private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 220;
private static final int UPLABEL_WIDTH = 300;
private JComponent centerPane;
private UILabel upLabel;
FormPopupPane(UIButton b, JPanel dialogContentPanel) {
contentPane = new JPanel(new BorderLayout());
centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH, UPLABEL_HEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0, 0, 1, 0, Color.gray));
centerPane.add(dialogContentPanel, BorderLayout.NORTH);
contentPane.add(upLabel, BorderLayout.NORTH);
contentPane.add(centerPane, BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
this.add(contentPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setOpaque(false);
}
}

436
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -0,0 +1,436 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.math.BigDecimal;
/**
* Created by MoMeak on 2017/7/13.
*/
public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
private static final int TEN = 10;
private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 14;
private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50;
private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 240;
private static final int SHOWVALBUTTON_WIDTH = 70;
private static final int SHOWVALBUTTON_HEIGHTH = 25;
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider;
private int times;
private int sliderValue;
private UIButton downButton;
private UIButton upButton;
private UIButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true;
private PopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
public JSliderPane() {
this.setLayout(new BorderLayout());
slider = new UISlider(0, HUNDRED, HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener);
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
// showValSpinner.setEditor(editor);
// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
// textField.setEditable(true);
// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
// formatter.setAllowsInvalid(false);
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
downButton.setActionCommand("less");
upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener);
showValButton = new UIButton(showValSpinner.getValue() + "%");
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener);
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(1, 1, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
panel.add(showValButton);
this.add(panel, BorderLayout.NORTH);
this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT);
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
}
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
//TODO
// selfAdaptButton.addItemListener();
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
bg.add(customButton);
customButton.setSelected(true);
}
private void initPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{selfAdaptButton, null},
new Component[]{customButton, createSpinnerPanel()}
};
dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
private JPanel createSpinnerPanel() {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent);
return spinnerPanel;
}
ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue, 100, 2);
if (val > FOUR_HUNDRED) {
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN) {
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val);
refreshBottun(val);
}
};
//定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() {
public void run() {
sliderValue = slider.getValue();
getTimes(sliderValue);
showValue = times;
showValSpinner.setValue(times);
}
});
} else {
isButtonOrIsTxt = false;
}
}
};
ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
}
}
};
private void refreshSlider(int val) {
showValue = val;
if (showValue > HUNDRED) {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) {
slider.setValue(HALF_HUNDRED);
}
}
private void refreshBottun(int val) {
showValButton.setText(val + "%");
}
public double getResolutionTimes() {
return this.resolutionTimes;
}
public int getshowValue() {
return this.showValue;
}
public static double divide(double v1, double v2, int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.divide(b2, scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true;
if (e.getActionCommand().equals("less")) {
int newDownVal = showValue - TEN;
if (newDownVal >= TEN) {
showValue = newDownVal;
showValSpinner.setValue(newDownVal);
} else {
showValue = newDownVal;
showValSpinner.setValue(TEN);
}
}
if (e.getActionCommand().equals("more")) {
int newUpVal = showValue + TEN;
if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal;
showValSpinner.setValue(newUpVal);
} else {
showValue = newUpVal;
showValSpinner.setValue(FOUR_HUNDRED);
}
}
isButtonOrIsTxt = true;
customButton.setSelected(true);
}
};
private void getTimes(int value) {
if (value == HALF_HUNDRED) {
times = HUNDRED;
} else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else {
times = (int) (SIX * value - TWO_HUNDRED);
}
}
public JSpinner getShowVal() {
return this.showValSpinner;
}
public UIRadioButton getSelfAdaptButton() {
return this.selfAdaptButton;
}
private void popupDialog() {
Point btnCoords = upButton.getLocationOnScreen();
if (dialog == null) {
dialog = new PopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
} else {
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
}
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(JSliderPane.getInstance(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 80);
jf.setVisible(true);
}
}
class JSliderPaneUI extends BasicSliderUI {
private static final int VERTICAL_WIDTH = 11;
private static final int VERTICAL_HEIGHT = 16;
private static final int FOUR = 4;
private static final int FIVE = 5;
private static final int SIX = 6;
public JSliderPaneUI(UISlider b) {
super(b);
}
/** */
/**
* 绘制指示物
*/
public Dimension getThumbSize() {
Dimension size = new Dimension();
if (slider.getOrientation() == JSlider.VERTICAL) {
size.width = VERTICAL_WIDTH;
size.height = VERTICAL_HEIGHT;
} else {
size.width = VERTICAL_WIDTH;
size.height = VERTICAL_HEIGHT;
}
return size;
}
public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
int w = knobBounds.width;
int h = knobBounds.height;
g.translate(knobBounds.x, knobBounds.y);
if (slider.isEnabled()) {
g.setColor(slider.getBackground());
} else {
g.setColor(slider.getBackground().darker());
}
g.setColor(Color.darkGray);
g.fillRect(0, 1, w - SIX, h + 1);
}
/** */
/**
* 绘制刻度轨迹
*/
public void paintTrack(Graphics g) {
int cy, cw;
Rectangle trackBounds = trackRect;
if (slider.getOrientation() == UISlider.HORIZONTAL) {
Graphics2D g2 = (Graphics2D) g;
cy = (trackBounds.height / 2);
cw = trackBounds.width;
g.setColor(Color.lightGray);
g.drawLine(0, cy, cw + FIVE, cy);
g.drawLine(FIVE + cw / 2, cy - FOUR, FIVE + cw / 2, cy + FOUR);
} else {
super.paintTrack(g);
}
}
}
class PopupPane extends JPopupMenu {
private JComponent contentPane;
private static final int UPLABEL_HEIGHT = 25;
private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 240;
private static final int UPLABEL_WIDTH = 300;
private JComponent centerPane;
private UILabel upLabel;
PopupPane(UIButton b, JPanel dialogContentPanel) {
contentPane = new JPanel(new BorderLayout());
centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH, UPLABEL_HEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0, 0, 1, 0, Color.gray));
centerPane.add(dialogContentPanel, BorderLayout.NORTH);
contentPane.add(upLabel, BorderLayout.NORTH);
contentPane.add(centerPane, BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
this.add(contentPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setOpaque(false);
}
}

34
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -1,9 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.*;
import com.fr.base.io.IOFile;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
@ -51,6 +48,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.awt.*;
@ -82,6 +80,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
private long openTime = 0L; // 打开模板的时间点(包括新建模板)
private TemplateInfoCollector tic = TemplateInfoCollector.getInstance();
private StringBuilder process = new StringBuilder(""); // 制作模板的过程
public int resolution = ScreenResolution.getScreenResolution();
public JTemplate(T t, String defaultFileName) {
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true);
@ -109,6 +108,9 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
}
}
// 刷新右侧属性面板
public abstract void refreshEastPropertiesPane();
// 为收集模版信息作准备
private void initForCollect() {
template.initTemplateID(); // 为新模板设置 templateID 属性
@ -141,6 +143,14 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
return undoState;
}
/**
* set/get 模板屏幕分辨率
*/
public abstract void setJTemplateResolution(int resolution);
public abstract int getJTemplateResolution();
/**
* 初始化权限细粒度撤销状态
*/
@ -210,6 +220,18 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
*/
public abstract void removeParameterPaneSelection();
/**
* 缩放参数
*/
public abstract void setScale(int resolution);
public abstract int getScale();
/**
* 缩放参数自适应
*/
public abstract int selfAdaptUpdate();
protected abstract DesignModelAdapter<T, ?> createDesignModel();
/**
@ -860,9 +882,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
* 返回当前支持的超链界面pane
* @return 超链连接界面
*/
public HyperlinkGroupPane getHyperLinkPane() {
return new HyperlinkGroupPane();
}
public abstract HyperlinkGroupPane getHyperLinkPane();
/**
* 是否是图表

42
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java

@ -0,0 +1,42 @@
package com.fr.design.mainframe.loghandler;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import java.util.Date;
/**
* Created by Administrator on 2017/7/18 0018.
*/
public class DesignerLogAppender extends AppenderSkeleton {
public DesignerLogAppender() {
this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
}
protected void append(LoggingEvent event) {
this.subAppend(event);
}
public boolean requiresLayout() {
return true;
}
public synchronized void close() {
if (this.closed) {
return;
}
this.closed = true;
}
public void subAppend(LoggingEvent event) {
synchronized (DesignerLogHandler.getInstance()) {
Level level = event.getLevel();
String msg = this.layout.format(event);
DesignerLogHandler.getInstance().printRemoteLog(msg, level, new Date());
}
}
}

61
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -6,11 +6,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogLevel;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.*;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.LogRecordTimeProvider;
import org.apache.log4j.Level;
import javax.swing.*;
import javax.swing.text.*;
@ -18,20 +17,29 @@ import java.awt.*;
import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler {
protected static final int INFO_INT = FRLogLevel.INFO.intValue();
protected static final int ERRO_INT = FRLogLevel.ERROR.intValue();
protected static final int SERVER_INT = FRLogLevel.SEVERE.intValue();
protected static final int INFO_INT = FRLogLevel.INFO.toInt();
protected static final int ERRO_INT = FRLogLevel.ERROR.toInt();
protected static final int SERVER_INT = FRLogLevel.SEVERE.toInt();
private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40;
private static final int SERVER_GAP_Y = -20;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
// envchange后需要重新读取webinf里的log4j配置, 重新添加appender
FRLogger.getLogger().addLogAppender(new DesignerLogAppender());
}
});
}
public static DesignerLogHandler getInstance() {
return HOLDER.singleton;
}
@ -91,7 +99,7 @@ public class DesignerLogHandler {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu showsetPopup = new JPopupMenu();
int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().intValue();
int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().toInt();
if (logLevelvalue <= INFO_INT) {
showsetPopup.add(showInfo);
showsetPopup.add(showError);
@ -117,8 +125,8 @@ public class DesignerLogHandler {
return caption;
}
public void printRemoteLog(LogRecordTime logRecordTime) {
logHandlerArea.printStackTrace(logRecordTime);
public void printRemoteLog(String message, Level level, Date date) {
logHandlerArea.printStackTrace(message, level, date);
}
private class LogHandlerArea extends JPanel {
@ -169,21 +177,6 @@ public class DesignerLogHandler {
}
}
});
// 写到日志面板上面的Log和日志工具栏
FRContext.getLogger().addLogHandler(new Handler() {
public void publish(LogRecord logRecord) {
Date date = new Date();
LogRecordTime logRecordTime = new LogRecordTime(date, logRecord);
printStackTrace(logRecordTime);
}
public void flush() {
}
public void close() {
}
});
}
private JTextPane initLogJTextArea() {
@ -217,6 +210,22 @@ public class DesignerLogHandler {
}
public void printStackTrace(String message, Level level, Date date) {
int logLevelvalue = level.toInt();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == ERRO_INT && showError.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == SERVER_INT && showServer.isSelected()) {
printMessage(message, logLevelvalue, date);
}
}
private void printMessage(String message, int logLevelvalue, Date date) {
printMessage(message, logLevelvalue, date, null);
}
private void printMessage(String messange, int logLevelvalue, Date date, Throwable e) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.log(simpleDateFormat.format(date) + "\n", 0);

73
designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java

@ -1,23 +1,16 @@
package com.fr.design.mainframe.loghandler;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.ItemSelectable;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.Timer;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter;
import com.fr.stable.script.Atom;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.concurrent.atomic.AtomicBoolean;
public class LogHandlerBar extends JPanel implements ItemSelectable {
@ -33,8 +26,6 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
private int SERVERNUM = 0;
private boolean isWithSerious;
private int i;
private Timer timer;
public LogHandlerBar() {
this(null);
@ -48,17 +39,17 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
clear.setMargin(null);
clear.setOpaque(false);
clear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
clear.setToolTipText(Inter.getLocText("Clear_All"));
clear.setToolTipText(Inter.getLocText("FR-Designer_Clear_All"));
selectedall = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/selectedall.png"));
selectedall.setMargin(null);
selectedall.setOpaque(false);
selectedall.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
selectedall.setToolTipText(Inter.getLocText("Select_All"));
selectedall.setToolTipText(Inter.getLocText("FR-Designer_Select_All"));
set = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/setting.png"));
set.setMargin(null);
set.setOpaque(false);
set.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
set.setToolTipText(Inter.getLocText("Set"));
set.setToolTipText(Inter.getLocText("FR-Designer_Set"));
this.add(clear);
this.add(selectedall);
@ -94,29 +85,14 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
timerPaint();
}
public synchronized void timerPaint() {
isWithSerious = true;
timer = new Timer(500, null);
ActionListener taskAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (i < 5) {
isWithSerious = i % 2 == 0 ? true : false;
repaint();
} else if (i == 5) {
if (timer == null)
return;
timer.stop();
timer = null;
i = 0;
isWithSerious = true;
return;
}
i++;
}
};
if (timer != null) {
timer.addActionListener(taskAction);
timer.start();
private AtomicBoolean painting = new AtomicBoolean(false);
public void timerPaint() {
if(!painting.get()) {
painting.set(true);
repaint();
painting.set(false);
}
}
@ -197,11 +173,16 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
Insets insets = target.getInsets();
int top = insets.top;
int right = target.getWidth() - insets.right;
clear.setBounds(right - 130, top + 4, clear.getPreferredSize().width, clear.getPreferredSize().height);
selectedall.setBounds(right - 100, top + 4, selectedall.getPreferredSize().width, selectedall.getPreferredSize().height);
set.setBounds(right - 70, top + 4, set.getPreferredSize().width, set.getPreferredSize().height);
clear.setBounds(right - CLEAR_OFFSET, top + TOP_OFFSET, clear.getPreferredSize().width, clear.getPreferredSize().height);
selectedall.setBounds(right - SELECT_OFFSET, top + TOP_OFFSET, selectedall.getPreferredSize().width, selectedall.getPreferredSize().height);
set.setBounds(right - SET_OFFSET, top + TOP_OFFSET, set.getPreferredSize().width, set.getPreferredSize().height);
}
private static final int CLEAR_OFFSET = 130;
private static final int TOP_OFFSET = 4;
private static final int SELECT_OFFSET = 100;
private static final int SET_OFFSET = 70;
}
}

3
designer_base/src/com/fr/design/menu/MenuManager.java

@ -4,7 +4,6 @@ import com.fr.design.DesignState;
import com.fr.design.actions.MenuAction;
import com.fr.file.XMLFileManager;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
@ -140,7 +139,7 @@ public class MenuManager extends XMLFileManager {
return;
}
try {
MenuAction action = (MenuAction) GeneralUtils.classForName(name).newInstance();
MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance();
menu.addShortCut(action);
} catch (Exception exp) {
FRLogger.getLogger().error(exp.getMessage(), exp);

1
designer_base/src/com/fr/design/module/DesignModule.java

@ -16,7 +16,6 @@ import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.js.*;
import com.fr.module.TopModule;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;

40
designer_base/src/com/fr/design/preview/WriteEnhancePreview.java

@ -0,0 +1,40 @@
package com.fr.design.preview;
import com.fr.base.io.IOFile;
import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.general.Inter;
import java.util.HashMap;
import java.util.Map;
/**
* Created by loy on 2017/7/7.
*/
public class WriteEnhancePreview extends AbstractPreviewProvider {
@Override
public String nameForPopupItem() {
return Inter.getLocText("FR-Designer_Write_Enhance_Preview");
}
@Override
public String iconPathForPopupItem() {
return "com/fr/design/images/buttonicon/writes.png";
}
@Override
public String iconPathForLarge() {
return "com/fr/design/images/buttonicon/writeb24.png";
}
@Override
public int previewTypeCode() {
return IOFile.WRITE_PREVIEW_TYPE;
}
@Override
public Map<String, Object> parametersForPreview() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("op", "write_ex");
return map;
}
}

2
designer_base/src/com/fr/design/roleAuthority/RoleTree.java

File diff suppressed because one or more lines are too long

6
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -17,7 +17,6 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.file.CacheManager;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
@ -1788,8 +1787,7 @@ public class RemoteEnv extends AbstractEnv {
}
LogRecordTime[] records = DavXMLUtils.readXMLLogRecords(input);
for (LogRecordTime logRecordTime : records) {
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
//TODO
}
}
@ -2181,7 +2179,7 @@ public class RemoteEnv extends AbstractEnv {
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "plugin");
para.put("cmd", "get_states");
para.put("cmd", "get_status");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());

9
designer_base/src/com/fr/start/BaseDesigner.java

@ -17,13 +17,15 @@ import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.module.DesignModule;
import com.fr.design.utils.DesignUtils;
import com.fr.env.SignIn;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.general.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.plugin.PluginCollector;
import com.fr.plugin.manage.PluginManager;
import com.fr.stable.*;
@ -66,9 +68,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
//下面这两句的位置不能随便调换,因为会影响语言切换的问题
initLanguage();
// 先加载设计器的国际化文件
Inter.loadLocaleFile(GeneralContext.getLocale(), DesignModule.LOCALE_FILE_PATH);
SplashWindow splashWindow = new SplashWindow(createSplashPane());
if (args != null) {
for (String arg : args) {

13
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -13,6 +13,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeListener;
@ -41,7 +42,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private int chartWidth = -1;
private int chartHeight = -1;
private Point point;
private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph;
private boolean supportEdit = true;
@ -171,7 +172,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height);
g2d.setPaint(oldPaint);
g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2);
if (needRefreshChartGlyph()) {
@ -315,7 +316,13 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this, null);
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,resolution, this, null);
g2d.drawImage(chartImage, 0, 0, null);
}
}

6
designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java

@ -74,6 +74,12 @@ public class GisMapTableDataContentPane extends FurtherBasicBeanPane<GisMapTable
addressType = new UIButtonGroup<String>(new String[]{Inter.getLocText("Chart-Gis_Address"), Inter.getLocText("Chart-Gis_LatLng")});
lnglatOrder = new UIButtonGroup<String>(new String[]{Inter.getLocText("Chart-Lng_First"),Inter.getLocText("Chart-Lat_First")});
addressType.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
orderPane.setVisible(addressType.getSelectedIndex() == 1);
}
});
addressBox = new UIComboBox();
addressNameBox = new UIComboBox();
double p = TableLayout.PREFERRED;

6
designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java

@ -14,11 +14,11 @@ public abstract class ChartsConfigPane <T extends Charts> extends AbstractChartA
public final static String CHART_STYLE_TITLE = Inter.getLocText("Chart-Style_Name");
public abstract Class<? extends Charts> accptType();
public abstract Class<? extends Charts> acceptType();
@Override
public void populate(ChartCollection collection) {
if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),accptType())) {
if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(), acceptType())) {
populate(collection, (T)collection.getSelectedChart());
}
}
@ -27,7 +27,7 @@ public abstract class ChartsConfigPane <T extends Charts> extends AbstractChartA
@Override
public void update(ChartCollection collection) {
if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),accptType())) {
if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(), acceptType())) {
update(collection, (T)collection.getSelectedChart());
}
}

4
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java

@ -24,7 +24,7 @@ import java.awt.*;
public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane {
private static final String CATENAME = Inter.getLocText(new String[]{"ChartF-Meter", "StyleFormat-Category", "WF-Name"});
private static final String NVALUE = Inter.getLocText("Needle Value");
private static final String NVALUE = Inter.getLocText("Chart-Pointer_Value");
private TinyFormulaPane singCatePane;
private TinyFormulaPane singValuePane;
@ -59,7 +59,7 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
double[] cs = {p};
components = new Component[][]{
new Component[]{new JSeparator()},
new Component[]{new BoldFontTextLabel(Inter.getLocText("Data_Filter"))},
new Component[]{new BoldFontTextLabel(Inter.getLocText("FR-Designer_Data_Filter"))},
new Component[]{filterPane = new ChartDataFilterPane(new MeterPlot(), parent)},
};
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, cs);

5
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -109,12 +109,13 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/
public void initBeforeUpEdit() {
WidgetToolBarPane.getInstance(this);
EastRegionContainerPane.getInstance().replaceDownPane(
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height);
EastRegionContainerPane.getInstance().replaceUpPane(
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
WidgetPropertyPane.getInstance(this));
} else {
EastRegionContainerPane.getInstance().removeParameterPane();

16
designer_form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java

@ -8,8 +8,20 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.js.EmailJavaScript;
public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
private static FormHyperlinkGroupPane singleton;
private FormHyperlinkGroupPane() {
super();
}
public synchronized static FormHyperlinkGroupPane getInstance() {
if (singleton == null) {
singleton = new FormHyperlinkGroupPane();
}
return singleton;
}
/**
* 生成添加按钮的NameableCreator
* 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane这里调整下

37
designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java

@ -17,6 +17,12 @@ import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue;
import com.fr.general.Background;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
@ -27,12 +33,31 @@ import java.awt.event.MouseEvent;
import java.awt.geom.RoundRectangle2D;
public class ToolTipEditor extends JWindow {
private static ToolTipEditor editor = new ToolTipEditor();
public static ToolTipEditor getInstance() {
return editor;
}
private static volatile ToolTipEditor editor = new ToolTipEditor();
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
editor = new ToolTipEditor();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
}
public static ToolTipEditor getInstance() {
return editor;
}
private XEditorHolder holder;
private Border buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5);

1203
designer_form/src/com/fr/design/mainframe/FormArea.java

File diff suppressed because it is too large Load Diff

11
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.AdapterBus;
@ -47,6 +48,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.bridge.StableFactory;
import javax.swing.*;
@ -103,6 +105,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 存储被选择组件和剪切板的model
private transient SelectionModel selectionModel;
private int resolution = ScreenResolution.getScreenResolution();
// 编辑状态的事件表
private CreatorEventListenerTable edit;
protected Action[] designerActions;
@ -1416,4 +1419,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
}
}
public void setResolution(int resolution){
this.resolution = resolution;
}
public int getResolution(){
return this.resolution;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save