左良
5 years ago
commit
2a3dcca90a
4807 changed files with 583625 additions and 0 deletions
@ -0,0 +1,8 @@
|
||||
*.iml |
||||
.idea/ |
||||
.DS_Store |
||||
.classpath |
||||
.project |
||||
target/ |
||||
|
||||
|
@ -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>. |
@ -0,0 +1,75 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/fr-core-9.0.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/fr-third-9.0.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-9.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-9.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,86 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
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:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,86 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
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:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,86 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"${libDir}/tmp-${branchName}") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"${libDir}/tmp-${branchName}") |
||||
unjar(src:"${libDir}/branchName/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"${libDir}/tmp-${branchName}"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"${libDir}/tmp-${branchName}") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,75 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/core/build/classes/main") |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,76 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../" |
||||
def libDir="${basicDir}/lib" |
||||
|
||||
task appletJar<<{ |
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/main") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/core/build/classes/main") |
||||
fileset(dir:"${basicDir}/chart/build/classes/main") |
||||
fileset(dir:"${basicDir}/report/build/classes/main") |
||||
fileset(dir:"${basicDir}/platform/build/classes/main") |
||||
fileset(dir:"${basicDir}/performance/build/classes/main") |
||||
} |
||||
unjar(src:"${libDir}/3rd.jar",dest:"./tmp") |
||||
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,86 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
|
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"./tmp") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
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:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"./tmp"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"./tmp") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,85 @@
|
||||
apply plugin: "java" |
||||
tasks.withType(JavaCompile){ |
||||
options.encoding = "UTF-8" |
||||
} |
||||
def basicDir="../../" |
||||
def libDir="${basicDir}/finereport-lib-stable/master" |
||||
//获取什么分支名 |
||||
FileTree files =fileTree(dir:"./",include:"build.*.gradle") |
||||
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) |
||||
def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) |
||||
|
||||
task appletJar<<{ |
||||
|
||||
ant{ |
||||
mkdir(dir:"${libDir}/tmp-${branchName}") |
||||
mkdir(dir:"build/classes/") |
||||
copy(todir:"build/classes/"){ |
||||
fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") |
||||
|
||||
fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") |
||||
|
||||
} |
||||
unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") |
||||
unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") |
||||
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ |
||||
fileset(dir:"build/classes"){ |
||||
exclude(name:"*.*") |
||||
exclude(name:"bin/*.*") |
||||
exclude(name:"classes/**") |
||||
exclude(name:"com/fr/schedule/**") |
||||
exclude(name:"com/fr/cell/**") |
||||
exclude(name:"com/fr/dialog/**") |
||||
exclude(name:"com/fr/view/**") |
||||
exclude(name:"com/fr/web/**") |
||||
exclude(name:"com/fr/fs/**") |
||||
exclude(name:"com/fr/design/**") |
||||
exclude(name:"com/fr/start/**") |
||||
exclude(name:"com/fr/process/**") |
||||
} |
||||
fileset(dir:"${libDir}/tmp-${branchName}"){ |
||||
include(name:"javax/mail/**") |
||||
include(name:"javax/servlet/**") |
||||
include(name:"org/freehep/**") |
||||
include(name:"com/fr/third/JAI/**") |
||||
include(name:"com/fr/third/antlr/**") |
||||
include(name:"com/fr/third/javax/**") |
||||
include(name:"com/sun/xml/**") |
||||
include(name:"javax/xml/**") |
||||
|
||||
} |
||||
fileset(dir:"build/classes"){ |
||||
include(name:"com/fr/web/*.class") |
||||
include(name:"com/fr/web/attr/*.class") |
||||
} |
||||
} |
||||
delete(dir:"${libDir}/tmp-${branchName}") |
||||
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" |
||||
def keystore="frapplet.store" |
||||
def keycert="fr.cert" |
||||
def keypassword="123456" |
||||
def keyalias="fr" |
||||
|
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") |
||||
} |
||||
exec(executable:"${jdk6home}/bin/keytool"){ |
||||
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") |
||||
} |
||||
|
||||
exec(executable:"${jdk6home}/bin/jarsigner"){ |
||||
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") |
||||
} |
||||
delete(file:"${keystore}") |
||||
delete(file:"${keycert}") |
||||
delete(dir:"build/classes") |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,73 @@
|
||||
package com.fr.aspectj.designer; |
||||
|
||||
/** |
||||
* 记录模板过程 |
||||
* Created by plough on 2017/3/3. |
||||
*/ |
||||
|
||||
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; |
||||
import com.fr.grid.Grid; |
||||
import org.aspectj.lang.reflect.SourceLocation; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.Date; |
||||
|
||||
public aspect TemplateProcessTracker { |
||||
//声明一个pointcut,匹配你需要的方法 |
||||
pointcut onMouseClicked(MouseEvent e) : |
||||
execution(* mouseClicked(MouseEvent)) && args(e); |
||||
pointcut onMousePressed(MouseEvent e) : |
||||
execution(* mousePressed(MouseEvent)) && args(e); |
||||
pointcut onMouseReleased(MouseEvent e) : |
||||
execution(* mouseReleased(MouseEvent)) && args(e); |
||||
pointcut onActionPerformed(ActionEvent e) : |
||||
execution(* actionPerformed(ActionEvent)) && args(e); |
||||
pointcut onSetValueAt(Object v, int r, int c) : |
||||
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); |
||||
pointcut onSetValue4EditingElement(Grid g, Object v) : |
||||
call(* setValue4EditingElement(java.lang.Object)) && target(g) && args(v); |
||||
|
||||
//before表示之前的意思 |
||||
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 |
||||
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置 |
||||
|
||||
// String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
String log = ""; |
||||
//TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
//同上 |
||||
before(ActionEvent e) : onActionPerformed(e) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
// !within(LogHandlerBar) 没用, 手动过滤 |
||||
if (e != null && e.getSource().toString().contains("javax.swing.Timer")) { |
||||
return; |
||||
} |
||||
|
||||
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); |
||||
String log = ""; |
||||
//TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Object v, int r, int c) : onSetValueAt(v, r, c) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
|
||||
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); |
||||
String log = ""; |
||||
//TemplateInfoCollector.appendProcess(log); |
||||
|
||||
} |
||||
//同上 |
||||
before(Grid g, Object v) : onSetValue4EditingElement(g, v) { |
||||
SourceLocation sl = thisJoinPoint.getSourceLocation(); |
||||
|
||||
// String v = "test"; |
||||
//String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement()); |
||||
String log = ""; |
||||
//TemplateInfoCollector.appendProcess(log); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import javax.swing.Icon; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class ButtonGroupAction extends ElementCaseAction{ |
||||
protected Icon[][] iconArray; |
||||
protected Integer[] valueArray; |
||||
|
||||
private UIButtonGroup<Integer> group; |
||||
|
||||
protected ButtonGroupAction(ElementCasePane t, Icon[][] iconArray, Integer[] valueArray) { |
||||
super(t); |
||||
this.iconArray = iconArray; |
||||
this.valueArray = valueArray; |
||||
} |
||||
|
||||
protected Integer getSelectedValue() { |
||||
if(getSelectedIndex() < 0 || getSelectedIndex() >= valueArray.length) { |
||||
return valueArray[0]; |
||||
} |
||||
return valueArray[getSelectedIndex()]; |
||||
} |
||||
|
||||
private int getSelectedIndex() { |
||||
return createToolBarComponent().getSelectedIndex(); |
||||
} |
||||
|
||||
protected void setSelectedIndex(int value) { |
||||
int index = -1; |
||||
for(int i = 0; i < valueArray.length; i++) { |
||||
if(value == valueArray[i]) { |
||||
index = i; |
||||
break; |
||||
} |
||||
} |
||||
if(createToolBarComponent().hasClick()) { |
||||
index = getSelectedIndex(); |
||||
createToolBarComponent().setClickState(false); |
||||
} |
||||
createToolBarComponent().removeActionListener(this); |
||||
createToolBarComponent().setSelectedIndex(index); |
||||
createToolBarComponent().addActionListener(this); |
||||
} |
||||
|
||||
@Override |
||||
public UIButtonGroup<Integer> createToolBarComponent() { |
||||
if(group == null) { |
||||
group = new UIButtonGroup<Integer>(iconArray, valueArray); |
||||
group.addActionListener(this); |
||||
} |
||||
return group; |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
|
||||
public abstract class CellSelectionAction extends ElementCaseAction { |
||||
protected CellSelectionAction() { |
||||
} |
||||
|
||||
protected CellSelectionAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection s = ePane.getSelection(); |
||||
|
||||
// TODO ALEX_SEP instanceof i hate it
|
||||
if (s instanceof CellSelection) { |
||||
return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection) s); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs); |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
if (this.isEnabled()) { |
||||
this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
//ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情
|
||||
//
|
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class ElementCaseAction extends SelectionListenerAction { |
||||
protected ElementCaseAction() { |
||||
} |
||||
|
||||
protected ElementCaseAction(ElementCasePane t) { |
||||
super(t); |
||||
t.addSelectionChangeListener(createSelectionListener()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
|
||||
public abstract class FloatSelectionAction extends ElementCaseAction { |
||||
|
||||
protected FloatSelectionAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection s = ePane.getSelection(); |
||||
|
||||
// TODO ALEX_SEP instanceof i hate it
|
||||
if (s instanceof FloatSelection) { |
||||
return executeActionReturnUndoRecordNeededWithFloatSelection((FloatSelection)s); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
protected abstract boolean executeActionReturnUndoRecordNeededWithFloatSelection(FloatSelection fs); |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
|
||||
if (this.isEnabled()) { |
||||
this.setEnabled(this.getEditingComponent().getSelection() instanceof FloatSelection); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.JWorkBook; |
||||
|
||||
public abstract class JWorkBookAction extends JTemplateAction<JWorkBook> { |
||||
protected JWorkBookAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.gui.imenu.UICheckBoxMenuItem; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class PresentCheckBoxAction extends ElementCaseAction { |
||||
protected PresentCheckBoxAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public UICheckBoxMenuItem createMenuItem() { |
||||
Object object = this.getValue(UICheckBoxMenuItem.class.getName()); |
||||
if (object == null) { |
||||
object = createCheckBoxMenuItem(this); |
||||
this.putValue(UICheckBoxMenuItem.class.getName(), object); |
||||
} |
||||
|
||||
// isSelected.
|
||||
((UICheckBoxMenuItem) object).setSelected(this.isSelected()); |
||||
|
||||
return (UICheckBoxMenuItem) object; |
||||
} |
||||
|
||||
public abstract boolean isSelected(); |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.ReportComponent; |
||||
|
||||
public abstract class ReportComponentAction<T extends ReportComponent> extends TemplateComponentAction<T> { |
||||
protected ReportComponentAction(T tc) { |
||||
super(tc); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.selection.SelectionEvent; |
||||
import com.fr.design.selection.SelectionListener; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
|
||||
/** |
||||
* Created by daniel on 2016/10/10. |
||||
*/ |
||||
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> { |
||||
|
||||
protected SelectionListenerAction() { |
||||
} |
||||
|
||||
protected SelectionListenerAction(ElementCasePane elementCasePane) { |
||||
super(elementCasePane); |
||||
} |
||||
|
||||
protected SelectionListener createSelectionListener() { |
||||
return new SelectionListener() { |
||||
|
||||
@Override |
||||
public void selectionChanged(SelectionEvent e) { |
||||
update(); |
||||
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { |
||||
Selection selection = getEditingComponent().getSelection(); |
||||
if (selection instanceof CellSelection) { |
||||
CellSelection cellselection = (CellSelection) selection; |
||||
//样式处理
|
||||
getEditingComponent().setCellNeedTOFormat(cellselection); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,106 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.GridUtils; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.core.SheetUtils; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
import com.fr.report.stable.ReportConstants; |
||||
|
||||
/** |
||||
* TODO ALEX_SEP 这个类与AbstractCellAction有什么关系? |
||||
* |
||||
* @author null |
||||
*/ |
||||
public abstract class AbstractCellElementAction extends CellSelectionAction { |
||||
|
||||
protected AbstractCellElementAction() { |
||||
super(); |
||||
} |
||||
|
||||
protected AbstractCellElementAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
final ElementCasePane ePane = this.getEditingComponent(); |
||||
final TemplateElementCase tplEC = ePane.getEditingElementCase(); |
||||
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
if (editCellElement == null) { |
||||
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
tplEC.addCellElement(editCellElement); |
||||
} |
||||
SheetUtils.calculateDefaultParent(tplEC); |
||||
final CellSelection finalCS = cs; |
||||
final BasicPane bp = populateBasicPane(editCellElement); |
||||
BasicDialog dialog = bp.showWindow(DesignerContext.getDesignerFrame()); |
||||
dialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
// 需要先行后列地增加新元素。
|
||||
for (int j = 0; j < finalCS.getRowSpan(); j++) { |
||||
for (int i = 0; i < finalCS.getColumnSpan(); i++) { |
||||
int column = i + finalCS.getColumn(); |
||||
int row = j + finalCS.getRow(); |
||||
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(column, row); |
||||
if (editCellElement == null) { |
||||
editCellElement = new DefaultTemplateCellElement(column, row); |
||||
tplEC.addCellElement(editCellElement); |
||||
} |
||||
// alex:不加这一句话会导致跨行跨列的格子被多次update
|
||||
if (editCellElement.getColumn() != column || editCellElement.getRow() != row) { |
||||
continue; |
||||
} |
||||
updateBasicPane(bp, editCellElement); |
||||
// update cell attributes
|
||||
if (isNeedShinkToFit()) { |
||||
// shink to fit.(如果value是String)
|
||||
Object editElementValue = editCellElement.getValue(); |
||||
if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) { |
||||
// TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面
|
||||
GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
ePane.fireTargetModified(); |
||||
} |
||||
}); |
||||
//控件设置记住dlg,提交入库智能添加单元格后可以show出来
|
||||
DesignerContext.setReportWritePane(dialog); |
||||
dialog.setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 初始化对话框 |
||||
* |
||||
* @param cellElement 单元格 |
||||
* @return 对话框 |
||||
*/ |
||||
protected abstract BasicPane populateBasicPane(TemplateCellElement cellElement); |
||||
|
||||
/** |
||||
* 更新对话框之后,改变值 |
||||
* |
||||
* @param cellElement 单元格 |
||||
*/ |
||||
protected abstract void updateBasicPane(BasicPane basicPane, TemplateCellElement cellElement); |
||||
|
||||
/** |
||||
* if isNeedShinkToFit,please override this method |
||||
* |
||||
* @return isNeedShinkToFit |
||||
*/ |
||||
protected boolean isNeedShinkToFit() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,85 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.core.ActionFactory; |
||||
import com.fr.design.style.BorderUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Border. |
||||
*/ |
||||
public class BorderAction extends ElementCaseAction implements ChangeListener { |
||||
|
||||
private CellBorderStyle oldCellBorderStyle; |
||||
|
||||
public BorderAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Format_A-Border")); |
||||
} |
||||
|
||||
public void stateChanged(ChangeEvent e) { |
||||
this.actionPerformedUndoable(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
Object object = this.getValue(UIToolbarBorderButton.class.getName()); |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
if (object != null && object instanceof UIToolbarBorderButton) { |
||||
oldCellBorderStyle = ((UIToolbarBorderButton) object).getCellBorderStyle(); |
||||
|
||||
return this.update(reportPane); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIToolbarBorderButton.class.getName()); |
||||
if (object == null || !(object instanceof UIToolbarBorderButton)) { |
||||
UIToolbarBorderButton borderStylePane = new UIToolbarBorderButton(BaseUtils.readIcon("/com/fr/design/images/m_format/noboder.png"), this.getEditingComponent()); |
||||
this.putValue(UIToolbarBorderButton.class.getName(), borderStylePane); |
||||
borderStylePane.setEnabled(this.isEnabled()); |
||||
borderStylePane.set4Toolbar(); |
||||
// peter:产生tooltip
|
||||
borderStylePane.setToolTipText(ActionFactory.createButtonToolTipText(this)); |
||||
borderStylePane.setCellBorderStyle(new CellBorderStyle()); |
||||
borderStylePane.addStyleChangeListener(this); |
||||
return borderStylePane; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
|
||||
public boolean update(ElementCasePane elementCasePane) { |
||||
if (oldCellBorderStyle.isNoneBorderStyle()) { |
||||
//无边框格式
|
||||
return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); |
||||
} |
||||
return BorderUtils.update(elementCasePane, oldCellBorderStyle); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
this.setEnabled(true); |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Cell Attribute. |
||||
*/ |
||||
public class CellAttributeAction extends CellAttributeTableAction { |
||||
public CellAttributeAction() { |
||||
this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellAttr.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getID() { |
||||
return Inter.getLocText("Datasource-Other_Attributes"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.mainframe.EastRegionContainerPane; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* 所有的CellAttributeTableAction都是指向单元格属性表的,点了就自动跳转到单元格属性表 |
||||
* |
||||
* @author zhou |
||||
* @since 2012-5-23下午4:19:48 |
||||
*/ |
||||
public abstract class CellAttributeTableAction extends UpdateAction { |
||||
|
||||
protected abstract String getID(); |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
CellElementPropertyPane.getInstance().GoToPane(getID()); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
this.setEnabled(EastRegionContainerPane.getInstance().isCellAttrPaneEnabled()); |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
public class CellExpandAttrAction extends CellAttributeTableAction{ |
||||
|
||||
public CellExpandAttrAction() { |
||||
super(); |
||||
this.setMenuKeySet(KeySetUtils.CELL_EXPAND_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public String getID() { |
||||
return Inter.getLocText("ExpandD-Expand_Attribute"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.EastRegionContainerPane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Cell Widget Attribute. |
||||
*/ |
||||
public class CellWidgetAttrAction extends UpdateAction { |
||||
|
||||
public CellWidgetAttrAction() { |
||||
this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/modified.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); |
||||
EastRegionContainerPane.getInstance().setWindow2PreferWidth(); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
this.setEnabled(EastRegionContainerPane.getInstance().isWidgetSettingsPaneEnabled()); |
||||
} |
||||
} |
@ -0,0 +1,141 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.mainframe.AuthorityPropertyPane; |
||||
import com.fr.design.mainframe.EastRegionContainerPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.roleAuthority.ReportAndFSManagePane; |
||||
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Author : daisy |
||||
* Date: 13-9-23 |
||||
* Time: 下午2:41 |
||||
*/ |
||||
public class CleanAuthorityAction extends ElementCaseAction { |
||||
|
||||
public CleanAuthorityAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setName(Inter.getLocText(new String[]{"Clear", "DashBoard-Potence"})); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 清楚权限动作 |
||||
* |
||||
* @param evt 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent evt) { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
Selection selection = reportPane.getSelection(); |
||||
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); |
||||
if (selection instanceof FloatSelection) { |
||||
String name = ((FloatSelection) selection).getSelectedFloatName(); |
||||
TemplateElementCase ec = reportPane.getEditingElementCase(); |
||||
FloatElement fe = ec.getFloatElement(name); |
||||
if (fe.isDoneAuthority(selectedRoles)) { |
||||
fe.cleanAuthority(selectedRoles); |
||||
} |
||||
doAfterAuthority(reportPane); |
||||
return; |
||||
} |
||||
CellSelection cellSelection = (CellSelection) selection; |
||||
boolean isChooseColumnRow = cellSelection.getSelectedType() == CellSelection.CHOOSE_COLUMN |
||||
|| cellSelection.getSelectedType() == CellSelection.CHOOSE_ROW; |
||||
if (isChooseColumnRow && cellSelection.getCellRectangleCount() == 1) { |
||||
cleanColumnRow(cellSelection, reportPane, selectedRoles); |
||||
} else { |
||||
cleanCell(cellSelection, reportPane, selectedRoles); |
||||
} |
||||
doAfterAuthority(reportPane); |
||||
} |
||||
|
||||
|
||||
private void doAfterAuthority(ElementCasePane reportPane) { |
||||
reportPane.repaint(); |
||||
reportPane.fireTargetModified(); |
||||
RolesAlreadyEditedPane.getInstance().refreshDockingView(); |
||||
RolesAlreadyEditedPane.getInstance().repaint(); |
||||
if (EastRegionContainerPane.getInstance().getUpPane() instanceof AuthorityPropertyPane) { |
||||
AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getUpPane(); |
||||
authorityPropertyPane.populate(); |
||||
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); |
||||
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 清除单元格对应的角色的权限 |
||||
* |
||||
* @param cellSelection |
||||
* @param reportPane |
||||
*/ |
||||
private void cleanCell(CellSelection cellSelection, ElementCasePane reportPane, String selectedRoles) { |
||||
if (selectedRoles == null) { |
||||
return; |
||||
} |
||||
TemplateElementCase elementCase = reportPane.getEditingElementCase(); |
||||
int cellRectangleCount = cellSelection.getCellRectangleCount(); |
||||
for (int rect = 0; rect < cellRectangleCount; rect++) { |
||||
Rectangle cellRectangle = cellSelection.getCellRectangle(rect); |
||||
for (int j = 0; j < cellRectangle.height; j++) { |
||||
for (int i = 0; i < cellRectangle.width; i++) { |
||||
int column = i + cellRectangle.x; |
||||
int row = j + cellRectangle.y; |
||||
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); |
||||
if (cellElement == null) { |
||||
continue; |
||||
} |
||||
//清除权限
|
||||
if (cellElement.isDoneAuthority(selectedRoles) || cellElement.isDoneNewValueAuthority(selectedRoles)) { |
||||
cellElement.cleanAuthority(selectedRoles); |
||||
} |
||||
if (cellElement.getWidget() == null) { |
||||
continue; |
||||
} |
||||
boolean isDoneAuthority = cellElement.getWidget().isDoneVisibleAuthority(selectedRoles) || |
||||
cellElement.getWidget().isDoneUsableAuthority(selectedRoles); |
||||
|
||||
if (isDoneAuthority) { |
||||
cellElement.getWidget().cleanAuthority(selectedRoles); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void cleanColumnRow(CellSelection cellSelection, ElementCasePane reportPane, String selectedRoles) { |
||||
if (selectedRoles == null) { |
||||
return; |
||||
} |
||||
TemplateElementCase elementCase = reportPane.getEditingElementCase(); |
||||
if (cellSelection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { |
||||
for (int col = cellSelection.getColumn(); col < cellSelection.getColumn() + cellSelection.getColumnSpan(); col++) { |
||||
elementCase.removeColumnPrivilegeControl(col, selectedRoles); |
||||
} |
||||
} else { |
||||
for (int row = cellSelection.getRow(); row < cellSelection.getRow() + cellSelection.getRowSpan(); row++) { |
||||
elementCase.removeRowPrivilegeControl(row, selectedRoles); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 是否需要撤销动作 |
||||
* |
||||
* @return 不需要 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.EastRegionContainerPane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Condition Attributes. |
||||
*/ |
||||
public class ConditionAttributesAction extends UpdateAction { |
||||
public ConditionAttributesAction() { |
||||
this.setMenuKeySet(KeySetUtils.CONDITION_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/highlight.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CONDITION_ATTR); |
||||
EastRegionContainerPane.getInstance().setWindow2PreferWidth(); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
this.setEnabled(EastRegionContainerPane.getInstance().isConditionAttrPaneEnabled()); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import java.awt.Toolkit; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* EditCellAction. |
||||
*/ |
||||
public class EditCellAction extends ElementCaseAction { |
||||
public EditCellAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Edit")); |
||||
this.setMnemonic('I'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/edit.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if(reportPane.isSelectedOneCell()){ |
||||
reportPane.getGrid().startEditing(); |
||||
}else{ |
||||
Toolkit.getDefaultToolkit().beep(); |
||||
} |
||||
} |
||||
|
||||
// TODO ALEX_SEP 这里的undo redo又是怎么回事呢?
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,52 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.ReportStylePane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Cell Style. |
||||
*/ |
||||
public class FloatStyleAction extends ElementCaseAction { |
||||
boolean okreturn = false; |
||||
|
||||
public FloatStyleAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 成功返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
final ReportStylePane reportStylePane = new ReportStylePane(); |
||||
final BasicDialog styleDialog = reportStylePane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
reportStylePane.populate(reportPane); |
||||
styleDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
reportStylePane.update(reportPane); |
||||
FloatStyleAction.this.okreturn = true; |
||||
} |
||||
}); |
||||
styleDialog.setVisible(true); |
||||
return okreturn; |
||||
} |
||||
} |
@ -0,0 +1,202 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
/** |
||||
* richer:global style menu |
||||
*/ |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.ConfigManager; |
||||
import com.fr.base.NameStyle; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.SelectionListenerAction; |
||||
import com.fr.design.actions.TemplateComponentAction; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.gui.imenu.UIMenu; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.menu.MenuDef; |
||||
import com.fr.design.selection.SelectionEvent; |
||||
import com.fr.design.selection.SelectionListener; |
||||
import com.fr.design.style.StylePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.base.ConfigManagerProvider; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.pinyin.PinyinHelper; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.*; |
||||
import java.util.Iterator; |
||||
|
||||
public class GlobalStyleMenuDef extends MenuDef { |
||||
private static final int MAX_LENTH = 12; |
||||
private ElementCasePane ePane; |
||||
|
||||
public GlobalStyleMenuDef(ElementCasePane ePane) { |
||||
this.ePane = ePane; |
||||
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setIconPath("/com/fr/design/images/m_web/style.png"); |
||||
} |
||||
|
||||
protected ContainerListener getContainerListener() { |
||||
return containerListener; |
||||
} |
||||
|
||||
private ContainerListener containerListener = new ContainerListener() { |
||||
@Override |
||||
public void componentAdded(ContainerEvent e) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void componentRemoved(ContainerEvent e) { |
||||
Component c = e.getChild(); |
||||
c.dispatchEvent(new MenuDeleteEvent(c)); |
||||
} |
||||
}; |
||||
|
||||
private class MenuDeleteEvent extends UpdateAction.ComponentRemoveEvent { |
||||
|
||||
public MenuDeleteEvent(Component source) { |
||||
super(source); |
||||
} |
||||
|
||||
@Override |
||||
public void release(SelectionListener listener) { |
||||
ePane.removeSelectionChangeListener(listener); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 更新菜单项 |
||||
*/ |
||||
public void updateMenu() { |
||||
UIMenu createdMenu = this.createJMenu(); |
||||
createdMenu.removeAll(); |
||||
ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); |
||||
Iterator iterator = configManager.getStyleNameIterator(); |
||||
while (iterator.hasNext()) { |
||||
String name = (String) iterator.next(); |
||||
NameStyle nameStyle = NameStyle.getInstance(name); |
||||
UpdateAction.UseMenuItem useMenuItem =new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); |
||||
useMenuItem.setNameStyle(nameStyle); |
||||
createdMenu.add(useMenuItem); |
||||
} |
||||
createdMenu.addSeparator(); |
||||
createdMenu.add(new CustomStyleAction(Inter.getLocText("FR-Engine_Custom"))); |
||||
} |
||||
|
||||
/** |
||||
* 控制自定义样式名称的长度 |
||||
* |
||||
* @param longName 名字 |
||||
* @return 控制之后的名字 |
||||
*/ |
||||
public static String judgeChina(String longName) { |
||||
|
||||
//neil:bug 1623 控制自定义样式名称的长度,只显示前12个字符,每个英文算1个字符,每个汉字算2个字符
|
||||
Integer index = 0; |
||||
StringBuffer sBuffer = new StringBuffer(); |
||||
for (int i = 0; i < longName.length(); i++) { |
||||
String bb = longName.substring(i, i + 1); //生成一个Pattern,同时编译一个正则表达式
|
||||
boolean cc = PinyinHelper.isChinese(bb.charAt(0)); |
||||
if (index == MAX_LENTH) { |
||||
sBuffer.append(".."); |
||||
break; |
||||
} |
||||
if ((index == MAX_LENTH - 1 && cc)) { |
||||
continue; |
||||
} |
||||
if (cc) { |
||||
index = index + 2; |
||||
} else { |
||||
index = index + 1; |
||||
} |
||||
|
||||
sBuffer.append(bb); |
||||
if (index > MAX_LENTH) { |
||||
sBuffer.append(".."); |
||||
break; |
||||
} |
||||
|
||||
} |
||||
|
||||
return sBuffer.toString(); |
||||
|
||||
} |
||||
|
||||
public static class CustomStyleAction extends UpdateAction { |
||||
|
||||
public CustomStyleAction(String name) { |
||||
|
||||
this.setName(name); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
CellElementPropertyPane.getInstance().GoToPane(new String[]{Inter.getLocText("FR-Engine_Style"), Inter.getLocText("FR-Engine_Custom")}); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
public static class GlobalStyleSelection extends SelectionListenerAction { |
||||
|
||||
private NameStyle nameStyle; |
||||
|
||||
public GlobalStyleSelection(ElementCasePane t, NameStyle nameStyle) { |
||||
super(t); |
||||
setName(StringUtils.EMPTY); |
||||
//重复画了一次,不需要icon
|
||||
// this.setName(nameStyle == null ? "" : nameStyle.getName());
|
||||
// this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png"));
|
||||
this.setNameStyle(nameStyle); |
||||
} |
||||
|
||||
public NameStyle getNameStyle() { |
||||
return this.nameStyle; |
||||
} |
||||
|
||||
public void setNameStyle(NameStyle nameStyle) { |
||||
this.nameStyle = nameStyle; |
||||
} |
||||
|
||||
/** |
||||
* 执行动作返回 |
||||
* @return 是返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
StylePane stylePane = new StylePane(); |
||||
if (StringUtils.isEmpty(this.getName())) { |
||||
stylePane.setGlobalStyle(this.getNameStyle()); |
||||
} else { |
||||
stylePane.setGlobalStyle(NameStyle.getInstance(this.getName())); |
||||
} |
||||
|
||||
stylePane.updateGlobalStyle(getEditingComponent()); |
||||
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("FR-Designer-Widget_Style")); |
||||
return true; |
||||
} |
||||
|
||||
public UseMenuItem createUseMenuItem() { |
||||
UseMenuItem useMenuItem = super.createUseMenuItem(); |
||||
SelectionListener listener = createSelectionListener(); |
||||
getEditingComponent().addSelectionChangeListener(listener); |
||||
useMenuItem.setSelectionListener(listener); |
||||
return useMenuItem; |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,84 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.present.Present; |
||||
import com.fr.design.actions.PresentCheckBoxAction; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.stable.StableUtils; |
||||
|
||||
public class NewPresentAction extends PresentCheckBoxAction { |
||||
|
||||
private String itemName = null; |
||||
|
||||
public NewPresentAction(ElementCasePane t, String title, String name) { |
||||
super(t); |
||||
|
||||
this.setName(title); |
||||
this.itemName = name; |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) { |
||||
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("FR-Designer_Present"), this.itemName); |
||||
} else { |
||||
TemplateCellElement ce = getSelectedCellElement(); |
||||
// 只有原来ce设置了形态的情况下才有undo操作
|
||||
if (ce != null && ce.getPresent() != null) { |
||||
ce.setPresent(null); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isSelected() { |
||||
return hasCurrentPresentSet(); |
||||
} |
||||
|
||||
// TODO ALEX_SEP enable有没有可能也通过这个方法来解决呢?
|
||||
private TemplateCellElement getSelectedCellElement() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection sel = ePane.getSelection(); |
||||
if (sel instanceof CellSelection) { |
||||
return (TemplateCellElement) ePane.getEditingElementCase().getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow()); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection sel = ePane.getSelection(); |
||||
if (sel instanceof CellSelection) { |
||||
this.setEnabled(true); |
||||
} else { |
||||
this.setEnabled(false); |
||||
} |
||||
} |
||||
|
||||
public boolean hasCurrentPresentSet() { |
||||
TemplateCellElement ce = getSelectedCellElement(); |
||||
if (ce != null) { |
||||
Present currentPresent = ce.getPresent(); |
||||
try { |
||||
Class clazz = GeneralUtils.classForName(itemName); |
||||
if (itemName.equals(currentPresent.getClass().getName())) { |
||||
return StableUtils.objectInstanceOf(currentPresent, clazz); |
||||
} |
||||
} catch (Exception e) { |
||||
return "NOPRESENT".equals(itemName) && currentPresent == null; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
public class StyleAction extends UpdateAction { |
||||
|
||||
public StyleAction() { |
||||
|
||||
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
CellElementPropertyPane.getInstance().GoToPane(new String[] { Inter.getLocText("Style"), Inter.getLocText("Custom") }); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,308 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.GridLayout; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.Box; |
||||
import javax.swing.Icon; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JPopupMenu; |
||||
import javax.swing.JSeparator; |
||||
import javax.swing.SwingUtilities; |
||||
import javax.swing.UIManager; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import javax.swing.event.EventListenerList; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UICombinationButton; |
||||
import com.fr.design.gui.ipoppane.PopupHider; |
||||
import com.fr.design.icon.BorderIcon; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.style.BorderUtils; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.design.style.BorderPane; |
||||
import com.fr.design.style.color.TransparentPane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
/** |
||||
* 这个Pane用来显示常用边框和设置自定义边框 |
||||
* |
||||
* @author richer |
||||
* |
||||
*/ |
||||
public class UIToolbarBorderButton extends UICombinationButton implements PopupHider { |
||||
private EventListenerList styleChangeListenerList = new EventListenerList(); |
||||
private boolean isCanBeNull = false; |
||||
private ElementCasePane reportPane; |
||||
private JPopupMenu popupWin; |
||||
|
||||
public UIToolbarBorderButton(Icon icon, ElementCasePane reportPane) { |
||||
super(new UIButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); |
||||
this.reportPane = reportPane; |
||||
} |
||||
|
||||
public CellBorderStyle getCellBorderStyle() { |
||||
return this.cellBorderStyle; |
||||
} |
||||
|
||||
public void setCellBorderStyle(CellBorderStyle cellBorderStyle) { |
||||
this.cellBorderStyle = cellBorderStyle; |
||||
this.leftButton.setIcon(new BorderIcon(cellBorderStyle)); |
||||
fireStyleStateChanged(); |
||||
} |
||||
|
||||
@Override |
||||
public void setEnabled(boolean enabled) { |
||||
super.setEnabled(enabled); |
||||
|
||||
if (!enabled) { |
||||
cellBorderStyle = null; |
||||
} |
||||
|
||||
leftButton.setEnabled(enabled); |
||||
rightButton.setEnabled(enabled); |
||||
} |
||||
|
||||
@Override |
||||
public void setToolTipText(String tooltipText) { |
||||
super.setToolTipText(tooltipText); |
||||
|
||||
leftButton.setToolTipText(tooltipText); |
||||
rightButton.setToolTipText(tooltipText); |
||||
} |
||||
|
||||
|
||||
private void showPopupMenu() { |
||||
if (popupWin != null && popupWin.isVisible()) { |
||||
hidePopupMenu(); |
||||
return; |
||||
} |
||||
|
||||
if (!this.isEnabled()) { |
||||
return; |
||||
} |
||||
|
||||
popupWin = this.getActionPopupMenu(); |
||||
GUICoreUtils.showPopupMenu(popupWin, this, 0, this.getSize().height); |
||||
} |
||||
|
||||
protected JPopupMenu getActionPopupMenu() { |
||||
if (this.popupWin == null) { |
||||
this.popupWin = new BorderStyleControlWindow(this.isCanBeNull()); |
||||
} |
||||
|
||||
return popupWin; |
||||
} |
||||
|
||||
protected void leftButtonClickEvent() { |
||||
UIToolbarBorderButton.this.cellBorderStyle = ((BorderIcon)getLeftButton().getIcon()).cellBorderStyle; |
||||
UIToolbarBorderButton.this.fireStyleStateChanged(); |
||||
} |
||||
|
||||
@Override |
||||
protected void rightButtonClickEvent() { |
||||
showPopupMenu(); |
||||
} |
||||
|
||||
class BorderStyleControlWindow extends JPopupMenu { |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public BorderStyleControlWindow(boolean isSupportTransparent) { |
||||
this.initComponents(isSupportTransparent); |
||||
} |
||||
|
||||
public void initComponents(boolean isSupportTransparent) { |
||||
setLightWeightPopupEnabled(JPopupMenu.getDefaultLightWeightPopupEnabled()); |
||||
|
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
setBorderPainted(true); |
||||
setBorder(UIManager.getBorder("PopupMenu.border")); |
||||
setOpaque(false); |
||||
setDoubleBuffered(true); |
||||
setFocusable(false); |
||||
|
||||
this.add(new NormalBorderPane(isSupportTransparent, UIToolbarBorderButton.this), BorderLayout.CENTER); |
||||
this.pack(); |
||||
} |
||||
} |
||||
|
||||
// richer:常用边框线类型展现面板
|
||||
class NormalBorderPane extends TransparentPane { |
||||
PopupHider popupHider; |
||||
|
||||
public NormalBorderPane(boolean isSupportTransparent, PopupHider popupHider) { |
||||
super(isSupportTransparent); |
||||
this.popupHider = popupHider; |
||||
} |
||||
|
||||
@Override |
||||
public void initCenterPaneChildren(JPanel centerPane) { |
||||
JPanel menuColorPane = new /**/JPanel(); |
||||
centerPane.add(menuColorPane); |
||||
|
||||
menuColorPane.setLayout(new /**/GridLayout(3, 4, 2, 2)); |
||||
for (int i = 0; i < borderStyleArray.length; i++) { |
||||
final UIButton borderStyleCell = new UIButton(new BorderIcon(borderStyleArray[i])); |
||||
borderStyleCell.set4ToolbarButton(); |
||||
borderStyleCell.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mousePressed(MouseEvent e) { |
||||
UIButton toolBarButton = (UIButton) e.getSource(); |
||||
if (toolBarButton.getIcon() instanceof BorderIcon) { |
||||
BorderIcon borderIcon = (BorderIcon) toolBarButton.getIcon(); |
||||
UIToolbarBorderButton.this.setCellBorderStyle(borderIcon.cellBorderStyle); |
||||
hidePopupMenu(); |
||||
} else { |
||||
UIToolbarBorderButton.this.setCellBorderStyle(borderStyleArray[0]); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
borderStyleCell.addMouseListener(new MouseAdapter() { |
||||
|
||||
@Override |
||||
public void mouseEntered(MouseEvent e) { |
||||
borderStyleCell.setBorder(BorderFactory.createEtchedBorder()); |
||||
} |
||||
|
||||
@Override |
||||
public void mouseExited(MouseEvent e) { |
||||
borderStyleCell.setBorder(null); |
||||
} |
||||
}); |
||||
borderStyleCell.setToolTipText(BorderStyleTooltips[i]); |
||||
menuColorPane.add(borderStyleCell); |
||||
} |
||||
|
||||
centerPane.add(Box.createVerticalStrut(5)); |
||||
centerPane.add(new JSeparator()); |
||||
centerPane.add(Box.createVerticalStrut(5)); |
||||
} |
||||
|
||||
@Override |
||||
public void doTransparent() { |
||||
UIToolbarBorderButton.this.setCellBorderStyle(null); |
||||
popupHider.hidePopupMenu(); |
||||
} |
||||
|
||||
@Override |
||||
public void customButtonPressed() { |
||||
popupHider.hidePopupMenu(); |
||||
final BorderPane borderPane = new BorderPane(); |
||||
BasicDialog borderDialog = borderPane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); |
||||
if (fourObjectArray != null && fourObjectArray.length == 4) { |
||||
borderPane.populate((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), |
||||
((Integer) fourObjectArray[2]).intValue(), (Color) fourObjectArray[3]); |
||||
} |
||||
borderDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
CellBorderStyle cellBorderStyle = borderPane.update(); |
||||
UIToolbarBorderButton.this.setCellBorderStyle(cellBorderStyle); |
||||
} |
||||
}); |
||||
borderDialog.setVisible(true); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Border"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Adds a new StyleChangeListener |
||||
*/ |
||||
public void addStyleChangeListener(ChangeListener changeListener) { |
||||
styleChangeListenerList.add(ChangeListener.class, changeListener); |
||||
} |
||||
|
||||
/** |
||||
* Removes an old StyleChangeListener. |
||||
*/ |
||||
public void removeColorChangeListener(ChangeListener changeListener) { |
||||
styleChangeListenerList.remove(ChangeListener.class, changeListener); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public void fireStyleStateChanged() { |
||||
Object[] listeners = styleChangeListenerList.getListenerList(); |
||||
ChangeEvent e = null; |
||||
|
||||
for (int i = listeners.length - 2; i >= 0; i -= 2) { |
||||
if (listeners[i] == ChangeListener.class) { |
||||
if (e == null) { |
||||
e = new ChangeEvent(this); |
||||
} |
||||
((ChangeListener) listeners[i + 1]).stateChanged(e); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public boolean isCanBeNull() { |
||||
return this.isCanBeNull; |
||||
} |
||||
|
||||
public void setCanBeNull(boolean isCanBeNull) { |
||||
this.isCanBeNull = isCanBeNull; |
||||
} |
||||
|
||||
private CellBorderStyle cellBorderStyle = new CellBorderStyle(); |
||||
|
||||
private static final CellBorderStyle[] borderStyleArray = { |
||||
new CellBorderStyle(), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, |
||||
Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_DOUBLE, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THICK, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_DOUBLE, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THICK, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THICK, Color.black, Constants.LINE_THICK, Color.black, Constants.LINE_THICK, Color.black, |
||||
Constants.LINE_THICK, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE) }; |
||||
private static final String[] BorderStyleTooltips = { Inter.getLocText("NO_Border_Line"), Inter.getLocText("Bottom_Border_Line"), |
||||
Inter.getLocText("Left_Border_Line"), Inter.getLocText("Right_Border_Line"), Inter.getLocText("Double_Bottom_BorderLine"), |
||||
Inter.getLocText("Thick_Bottom_Border_Line"), Inter.getLocText("Top_Bottom_Border_Line"), |
||||
Inter.getLocText("Top_And_Double_Bottom_Border_Line"), Inter.getLocText("Top_And_Thick_Bottom_Border_Line"), |
||||
Inter.getLocText("All_Border_Line"), Inter.getLocText("Out_Border_Line"), Inter.getLocText("Out_Thick_Border_Line") }; |
||||
|
||||
@Override |
||||
public void hidePopupMenu() { |
||||
if (popupWin != null) { |
||||
popupWin.setVisible(false); |
||||
} |
||||
|
||||
popupWin = null; |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.chart.BaseChartCollection; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.utils.ReportActionUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
/** |
||||
* Abstract cellstyle. |
||||
*/ |
||||
public abstract class AbstractStyleAction extends ElementCaseAction implements StyleActionInterface { |
||||
protected AbstractStyleAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public abstract Style executeStyle(Style style, Style defStyle); |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
|
||||
return ReportActionUtils.executeAction(this, reportPane); |
||||
} |
||||
|
||||
/** |
||||
* Update Style. |
||||
* |
||||
* @param style the updated style. |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
// peter:这个方法默认情况下什么都不做.
|
||||
} |
||||
|
||||
public boolean isFontStye() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
// james:应该从Action中的ReportPane拿Style,而不是从reportFrame中拿
|
||||
this.setEnabled(true); |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
if (isFontStye()) { |
||||
Selection cs = reportPane.getSelection(); |
||||
TemplateElementCase tplEC = reportPane.getEditingElementCase(); |
||||
|
||||
if (tplEC != null && cs instanceof FloatSelection) { |
||||
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); |
||||
if (selectedFloat == null) { |
||||
//有情况是撤销worksheet里面的元素撤消了,但是reportpane里面的selection没有变
|
||||
reportPane.setSelection(new CellSelection()); |
||||
return; |
||||
} |
||||
Object value = selectedFloat.getValue(); |
||||
if (value instanceof BaseChartCollection) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
// 更新Style
|
||||
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
||||
} |
||||
} |
@ -0,0 +1,120 @@
|
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.chart.BaseChartCollection; |
||||
import com.fr.design.actions.ButtonGroupAction; |
||||
import com.fr.design.actions.utils.ReportActionUtils; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
|
||||
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { |
||||
|
||||
private static final Icon[][] ICONS = new Icon[][]{ |
||||
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")}, |
||||
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")}, |
||||
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}}; |
||||
|
||||
|
||||
private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||
|
||||
public AlignmentAction(ElementCasePane t) { |
||||
super(t, ICONS, valueArray); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* executeStyle |
||||
* |
||||
* @param style |
||||
* @param selectedStyle |
||||
* @return style |
||||
*/ |
||||
public Style executeStyle(Style style, Style selectedStyle) { |
||||
return style.deriveHorizontalAlignment(getSelectedValue()); |
||||
} |
||||
|
||||
/** |
||||
* 更新Style |
||||
* |
||||
* @param style style |
||||
*/ |
||||
public void updateStyle(Style style) { |
||||
setSelectedIndex(BaseUtils.getAlignment4Horizontal(style)); |
||||
} |
||||
|
||||
/** |
||||
* executeActionReturnUndoRecordNeeded |
||||
* |
||||
* @return |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
|
||||
return ReportActionUtils.executeAction(this, reportPane); |
||||
} |
||||
|
||||
/** |
||||
* update |
||||
*/ |
||||
public void update() { |
||||
super.update(); |
||||
|
||||
//peter:如果当前没有ReportFrame,不需要继续.
|
||||
if (!this.isEnabled()) { |
||||
return; |
||||
} |
||||
|
||||
//got simple cell element from row and column
|
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
Selection cs = reportPane.getSelection(); |
||||
TemplateElementCase tplEC = reportPane.getEditingElementCase(); |
||||
|
||||
if (tplEC != null && cs instanceof FloatSelection) { |
||||
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); |
||||
Object value = selectedFloat.getValue(); |
||||
if (value instanceof BaseChartCollection) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
} |
||||
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
||||
} |
||||
|
||||
/** |
||||
* 创建工具条,且有提示 |
||||
* |
||||
* @return |
||||
*/ |
||||
public UIButtonGroup<Integer> createToolBarComponent() { |
||||
UIButtonGroup<Integer> group = super.createToolBarComponent(); |
||||
if (group != null) { |
||||
group.setForToolBarButtonGroup(true); |
||||
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")}); |
||||
} |
||||
for (int i = 0; i < 3; i++) { |
||||
group.getButton(i).setRoundBorder(true, UIConstants.ARC); |
||||
group.getButton(i).setBorderPainted(true); |
||||
} |
||||
return group; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,95 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.actions.ToggleButtonUpdateAction; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Bold. |
||||
*/ |
||||
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { |
||||
private UIToggleButton button; |
||||
protected Style style; |
||||
private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; |
||||
|
||||
public ReportFontBoldAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-bold")); |
||||
this.setSmallIcon(ICONS, true); |
||||
} |
||||
|
||||
/** |
||||
* 根据按钮状态获取格式 |
||||
* |
||||
* @param style |
||||
* @param defStyle |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
createToolBarComponent().setSelected(!createToolBarComponent().isSelected()); |
||||
if (createToolBarComponent().isSelected()) { |
||||
setSelectedFont(style); |
||||
createToolBarComponent().setSelected(false); |
||||
} else { |
||||
setUnselectedFont(style); |
||||
createToolBarComponent().setSelected(true); |
||||
} |
||||
|
||||
return this.style; |
||||
} |
||||
|
||||
|
||||
protected void setSelectedFont(Style style) { |
||||
this.style = StyleUtils.boldReportFont(style); |
||||
} |
||||
|
||||
protected void setUnselectedFont(Style style) { |
||||
this.style = StyleUtils.unBoldReportFont(style); |
||||
} |
||||
|
||||
/** |
||||
* Update Style. |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
FRFont frFont = style.getFRFont(); |
||||
if (frFont == null) { |
||||
return; |
||||
} |
||||
createToolBarComponent().setSelected(isStyle(frFont)); |
||||
} |
||||
|
||||
protected boolean isStyle(FRFont frFont) { |
||||
return frFont.isBold(); |
||||
} |
||||
|
||||
/** |
||||
* Gets component on toolbar. |
||||
* |
||||
* @return the created components on toolbar. |
||||
*/ |
||||
@Override |
||||
public UIToggleButton createToolBarComponent() { |
||||
if (button == null) { |
||||
button = GUICoreUtils.createToolBarComponentWhiteIcon(this); |
||||
button.setEventBannded(true); |
||||
} |
||||
return button; |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.actions.core.ActionFactory; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.style.color.UIToolbarColorButton; |
||||
|
||||
/** |
||||
* Foreground. |
||||
*/ |
||||
public class ReportFontForegroundAction extends AbstractStyleAction implements ChangeListener { |
||||
public ReportFontForegroundAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Foreground")); |
||||
} |
||||
|
||||
public void stateChanged(ChangeEvent evt) { |
||||
this.actionPerformedUndoable(); |
||||
} |
||||
|
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object != null && object instanceof UIToolbarColorButton) { |
||||
Color selectedColor = ((UIToolbarColorButton) object).getColor(); |
||||
if (style.getFRFont() != null && |
||||
ComparatorUtils.equals(selectedColor, style.getFRFont())) { |
||||
return style; |
||||
} |
||||
|
||||
style = StyleUtils.setReportFontForeground(style, selectedColor); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object == null || !(object instanceof UIToolbarColorButton)) { |
||||
UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); |
||||
this.putValue(UIToolbarColorButton.class.getName(), tbButton); |
||||
tbButton.set4Toolbar(); |
||||
tbButton.setEnabled(this.isEnabled()); |
||||
tbButton.addColorChangeListener(this); |
||||
|
||||
//peter:产生tooltip
|
||||
tbButton.setToolTipText(ActionFactory.createButtonToolTipText(this)); |
||||
return tbButton; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Bold. |
||||
*/ |
||||
public class ReportFontItalicAction extends ReportFontBoldAction { |
||||
|
||||
private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")}; |
||||
|
||||
public ReportFontItalicAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FR-Designer-FRFont_Italic")); |
||||
this.setSmallIcon(ICONS, true); |
||||
} |
||||
|
||||
|
||||
protected void setSelectedFont (Style style) { |
||||
this.style = StyleUtils.italicReportFont(style); |
||||
} |
||||
|
||||
protected void setUnselectedFont (Style style) { |
||||
this.style = StyleUtils.unItalicReportFont(style); |
||||
} |
||||
|
||||
protected boolean isStyle(FRFont frFont) { |
||||
return frFont.isItalic(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,104 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Dimension; |
||||
|
||||
import javax.swing.ComboBoxModel; |
||||
import javax.swing.JComponent; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.Utils; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Font name.. |
||||
*/ |
||||
public class ReportFontNameAction extends AbstractStyleAction { |
||||
public ReportFontNameAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-Family")); |
||||
} |
||||
|
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
String selectedFontName = (String) ((UIComboBox) object).getSelectedItem(); |
||||
//这两个if 语句的意思是:如果传过来的cellStyle.getFRFont() 即不为空也和原来的被选择的相同。则不改变。
|
||||
// 首先判断是否为空,如果空出错。
|
||||
//然后将它们的类型均转化为delCellStyle相同。然后再将之判断是否与选择的相同否。如不同则转化为相同。
|
||||
if (ComparatorUtils.equals(style.getFRFont().getName(), defStyle.getFRFont().getName())) { |
||||
style = StyleUtils.setReportFontName(style, defStyle.getFRFont().getName()); |
||||
} |
||||
if (ComparatorUtils.equals(selectedFontName, style.getFRFont().getName())) { |
||||
return style; |
||||
} |
||||
style = StyleUtils.setReportFontName(style, selectedFontName); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
public void setFontName(String fontName) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
UIComboBox comboBox = (UIComboBox) object; |
||||
ComboBoxModel comboBoxModel = comboBox.getModel(); |
||||
for (int i = 0; i < comboBoxModel.getSize(); i++) { |
||||
Object item = comboBoxModel.getElementAt(i); |
||||
|
||||
if (ComparatorUtils.equals(item, fontName)) { |
||||
//设置新Font Name
|
||||
comboBox.removeActionListener(this); |
||||
comboBox.setSelectedIndex(i); |
||||
comboBox.addActionListener(this); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object == null || !(object instanceof UIComboBox)) { |
||||
UIComboBox itemComponent = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
this.putValue(UIComboBox.class.getName(), itemComponent); |
||||
//设置最佳宽度.
|
||||
itemComponent.setPreferredSize(new Dimension( |
||||
Math.min(140, itemComponent.getPreferredSize().width), |
||||
itemComponent.getPreferredSize().height)); |
||||
|
||||
itemComponent.setEnabled(this.isEnabled()); |
||||
itemComponent.addActionListener(this); |
||||
|
||||
return itemComponent; |
||||
} |
||||
|
||||
return (UIComboBox) object; |
||||
} |
||||
|
||||
/** |
||||
* Update Style. |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
FRFont frFont = style.getFRFont(); |
||||
if (frFont == null) { |
||||
return; |
||||
} |
||||
|
||||
this.setFontName(frFont.getFamily()); |
||||
} |
||||
} |
@ -0,0 +1,127 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Dimension; |
||||
import java.util.Vector; |
||||
|
||||
import javax.swing.JComponent; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.Utils; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Font size. |
||||
*/ |
||||
public class ReportFontSizeAction extends AbstractStyleAction { |
||||
|
||||
private static final int MAX_FONT_SIZE = 100; |
||||
|
||||
public ReportFontSizeAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-Size")); |
||||
} |
||||
|
||||
/** |
||||
* 应用选中的样式 |
||||
* |
||||
* @param style 之前的样式 |
||||
* @param defStyle 选中的样式 |
||||
* |
||||
* @return 更改后的样式 |
||||
* |
||||
* @date 2015-1-22-下午4:54:00 |
||||
* |
||||
*/ |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
Object value = ((UIComboBox) object).getSelectedItem(); |
||||
float selectedFontSize; |
||||
selectedFontSize = Utils.round5(Float.parseFloat(value.toString())); |
||||
|
||||
if (style.getFRFont().getSize() == defStyle.getFRFont().getSize()) { |
||||
style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize()); |
||||
} |
||||
if (selectedFontSize == style.getFRFont().getSize()) { |
||||
return style; |
||||
} |
||||
style = StyleUtils.setReportFontSize(style, selectedFontSize); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
public void setFontSize(float size) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
UIComboBox comboBox = (UIComboBox) object; |
||||
//先和以前的Font Size比较.
|
||||
if (ComparatorUtils.equals(comboBox.getSelectedItem(), size)) { |
||||
return; |
||||
} |
||||
|
||||
//设置新Font Size
|
||||
comboBox.removeActionListener(this); |
||||
comboBox.setSelectedItem(size + ""); |
||||
comboBox.addActionListener(this); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 创建工具栏组件 |
||||
* |
||||
* @return 组件 |
||||
* |
||||
* @date 2015-1-22-下午4:53:29 |
||||
* |
||||
*/ |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object == null || !(object instanceof UIComboBox)) { |
||||
Vector<Integer> integerList = new Vector<Integer>(); |
||||
for (int i = 1; i < MAX_FONT_SIZE; i++) { |
||||
integerList.add(i); |
||||
} |
||||
|
||||
UIComboBox itemComponent = new UIComboBox(integerList); |
||||
this.putValue(UIComboBox.class.getName(), itemComponent); |
||||
itemComponent.setMinimumSize(new Dimension(50, 20)); |
||||
itemComponent.setPreferredSize(new Dimension(50, 20)); |
||||
itemComponent.setEnabled(this.isEnabled()); |
||||
itemComponent.addActionListener(this); |
||||
//需求字体大小可编辑
|
||||
itemComponent.setEditable(true); |
||||
|
||||
return itemComponent; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
|
||||
/** |
||||
* 更新样式 |
||||
* |
||||
* @param style 样式 |
||||
* |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
FRFont frFont = style.getFRFont(); |
||||
if (frFont == null) { |
||||
return; |
||||
} |
||||
setFontSize(Utils.round5(frFont.getSize2D())); |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Bold. |
||||
*/ |
||||
public class ReportFontUnderlineAction extends ReportFontBoldAction { |
||||
|
||||
private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_white.png")}; |
||||
|
||||
public ReportFontUnderlineAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-Underline")); |
||||
this.setSmallIcon(ICONS, true); |
||||
} |
||||
|
||||
protected void setSelectedFont (Style style) { |
||||
this.style = StyleUtils.setReportFontUnderline(style, true); |
||||
} |
||||
|
||||
protected void setUnselectedFont (Style style) { |
||||
this.style = StyleUtils.setReportFontUnderline(style, false); |
||||
} |
||||
|
||||
|
||||
protected boolean isStyle(FRFont frFont) { |
||||
return frFont.getUnderline() != Constants.LINE_NONE; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.Style; |
||||
|
||||
/** |
||||
* peter:这个方法只是在编辑Style的时候使用. |
||||
*/ |
||||
public interface StyleActionInterface { |
||||
public Style executeStyle(Style style2Mod, Style selectedStyle); |
||||
|
||||
/** |
||||
* Update Style. |
||||
* |
||||
* @param style style |
||||
*/ |
||||
public void updateStyle(Style style); |
||||
} |
@ -0,0 +1,77 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.design.actions.core.ActionFactory; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.style.color.UIToolbarColorButton; |
||||
|
||||
/** |
||||
* Background. |
||||
*/ |
||||
public class StyleBackgroundAction extends AbstractStyleAction implements ChangeListener { |
||||
public StyleBackgroundAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Background")); |
||||
} |
||||
|
||||
public void stateChanged(ChangeEvent evt) { |
||||
this.actionPerformedUndoable(); |
||||
} |
||||
|
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object != null && object instanceof UIToolbarColorButton) { |
||||
Color selectedColor = ((UIToolbarColorButton) object).getColor(); |
||||
if (style.getBackground() != null && |
||||
style.getBackground() instanceof ColorBackground && |
||||
ComparatorUtils.equals(selectedColor, |
||||
((ColorBackground) style.getBackground()).getColor())) { |
||||
return style; |
||||
} |
||||
|
||||
style = style.deriveBackground(ColorBackground.getInstance(selectedColor)); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isFontStye() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object == null || !(object instanceof UIToolbarColorButton)) { |
||||
UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); |
||||
tbButton.set4Toolbar(); |
||||
this.putValue(UIToolbarColorButton.class.getName(), tbButton); |
||||
|
||||
tbButton.setEnabled(this.isEnabled()); |
||||
tbButton.setColor(Color.WHITE); |
||||
tbButton.addColorChangeListener(this); |
||||
|
||||
//peter:产生tooltip
|
||||
tbButton.setToolTipText(ActionFactory.createButtonToolTipText(this)); |
||||
return tbButton; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class AbstractColumnRowIndexAction extends CellSelectionAction { |
||||
private int index = 0; |
||||
|
||||
protected AbstractColumnRowIndexAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t); |
||||
this.index = indexOfColumnOrRow; |
||||
} |
||||
|
||||
/** |
||||
* Return index. |
||||
*/ |
||||
public int getIndex() { |
||||
return this.index; |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.page.ReportPageAttrProvider; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
public class CancelColumnAction extends CellSelectionAction{ |
||||
public CancelColumnAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Cancel_Repeat_Attributes")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
if (report.getReportPageAttr() == null) { |
||||
return false; |
||||
} |
||||
int[] columns = cs.getSelectedColumns(); |
||||
ReportPageAttrProvider pageAttr = report.getReportPageAttr(); |
||||
int i = columns[0]; |
||||
if (i == pageAttr.getRepeatHeaderColumnFrom() || i == pageAttr.getRepeatHeaderColumnTo()) { |
||||
pageAttr.setRepeatHeaderColumnFrom(-1); |
||||
pageAttr.setRepeatHeaderColumnTo(-1); |
||||
} |
||||
if (i == pageAttr.getRepeatFooterColumnFrom() || i == pageAttr.getRepeatFooterColumnTo()) { |
||||
pageAttr.setRepeatFooterColumnFrom(-1); |
||||
pageAttr.setRepeatFooterColumnTo(-1); |
||||
} |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.page.ReportPageAttrProvider; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
public class CancelRowAction extends CellSelectionAction { |
||||
|
||||
public CancelRowAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Cancel_Repeat_Attributes")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] rows = cs.getSelectedRows(); |
||||
if (report.getReportPageAttr() == null) { |
||||
return false; |
||||
} |
||||
ReportPageAttrProvider pageAttr = report.getReportPageAttr(); |
||||
int i = rows[0]; |
||||
if (i == pageAttr.getRepeatHeaderRowFrom() || i == pageAttr.getRepeatHeaderRowTo()) { |
||||
pageAttr.setRepeatHeaderRowFrom(-1); |
||||
pageAttr.setRepeatHeaderRowTo(-1); |
||||
} |
||||
if (i == pageAttr.getRepeatFooterRowFrom() || i == pageAttr.getRepeatFooterRowTo()) { |
||||
pageAttr.setRepeatFooterRowFrom(-1); |
||||
pageAttr.setRepeatFooterRowTo(-1); |
||||
} |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
public class ColumnHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public ColumnHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText("Hide")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
int[] cols = cs.getSelectedColumns(); |
||||
for (int i = 0; i < cols.length; i++) { |
||||
report.setColumnWidth(cols[i], UNIT.ZERO); |
||||
} |
||||
ePane.fireTargetModified(); |
||||
ePane.repaint(); |
||||
return false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.page.ReportPageAttrProvider; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
public abstract class ColumnRowRepeatAction extends CellSelectionAction { |
||||
|
||||
public ColumnRowRepeatAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] indices; |
||||
if (isColumn()) { |
||||
indices = cs.getSelectedColumns(); |
||||
} else { |
||||
indices = cs.getSelectedRows(); |
||||
} |
||||
|
||||
doReportPageAttrSet(isColumn(), isFoot(), report, indices[0], indices[indices.length - 1]); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
protected abstract boolean isColumn(); |
||||
protected abstract boolean isFoot(); |
||||
|
||||
private void doReportPageAttrSet(boolean isColumn, boolean isFoot, ElementCase elementCase, int from, int to) { |
||||
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); |
||||
if (reportPageAttr == null) { |
||||
reportPageAttr = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG); |
||||
elementCase.setReportPageAttr(reportPageAttr); |
||||
} |
||||
|
||||
reportPageAttr.setRepeatFromTo(isFoot, isColumn, from, to); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,120 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.gui.frpane.UnitInputPane; |
||||
import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.unit.CM; |
||||
import com.fr.stable.unit.INCH; |
||||
import com.fr.stable.unit.MM; |
||||
import com.fr.stable.unit.PT; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* @author richer |
||||
* @since 6.5.3 |
||||
*/ |
||||
public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction { |
||||
protected ColumnRowSizingAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
final ElementCasePane ePane = this.getEditingComponent(); |
||||
final ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
final UnitInputPane uPane = new UnitInputPane(3,title4UnitInputPane()) { |
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return ColumnRowSizingAction.this.title4UnitInputPane(); |
||||
} |
||||
}; |
||||
UNIT len = getShowLen(report, cs); |
||||
populateNumberDialog(uPane, len); |
||||
|
||||
final CellSelection finalCS = cs; |
||||
uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
try { |
||||
float newHeight = (float) uPane.update(); |
||||
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); |
||||
UNIT len; |
||||
if (unitType == Constants.UNIT_CM) { |
||||
len = new CM(newHeight); |
||||
} else if (unitType == Constants.UNIT_INCH) { |
||||
len = new INCH(newHeight); |
||||
} else if (unitType == Constants.UNIT_PT) { |
||||
len = new PT(newHeight); |
||||
} else { |
||||
len = new MM(newHeight); |
||||
} |
||||
updateAction(report, len, finalCS); |
||||
} catch (ValueNotChangeException e) { |
||||
// nothing
|
||||
} |
||||
|
||||
ePane.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { |
||||
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); |
||||
float va; |
||||
if (unitType == Constants.UNIT_CM) { |
||||
va = unit.toCMValue4Scale2(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_CM")); |
||||
} else if (unitType == Constants.UNIT_INCH) { |
||||
va = unit.toINCHValue4Scale3(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_INCH")); |
||||
} else if (unitType == Constants.UNIT_PT) { |
||||
va = unit.toPTValue4Scale2(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_PT")); |
||||
} else { |
||||
va = unit.toMMValue4Scale2(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_MM")); |
||||
} |
||||
|
||||
uPane.populate(va); |
||||
} |
||||
|
||||
protected abstract String title4UnitInputPane(); |
||||
|
||||
protected abstract void updateAction(ElementCase report, UNIT len, CellSelection cs); |
||||
|
||||
protected abstract UNIT getShowLen(ElementCase report, CellSelection cs); |
||||
|
||||
protected abstract UNIT getIndexLen(int index, ElementCase report); |
||||
|
||||
protected UNIT getSelectedCellsLen(int[] cells, ElementCase report){ |
||||
int length = ArrayUtils.getLength(cells); |
||||
UNIT temp = null; |
||||
for (int i = 0; i < length; i++) { |
||||
UNIT current = getIndexLen(cells[i], report); |
||||
if (temp == null) { |
||||
temp = current; |
||||
continue; |
||||
} |
||||
if (temp.subtract(current).not_equal_zero()){ |
||||
return UNIT.ZERO; |
||||
} |
||||
} |
||||
|
||||
return getIndexLen(this.getIndex(), report); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* Column width. |
||||
*/ |
||||
public class ColumnWidthAction extends ColumnRowSizingAction { |
||||
|
||||
public ColumnWidthAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
|
||||
this.setName(Inter.getLocText("Utils-Column_Width") + "..."); |
||||
this.setMnemonic('C'); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4UnitInputPane() { |
||||
return Inter.getLocText("Utils-Column_Width"); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateAction(ElementCase report, UNIT len, CellSelection cs) { |
||||
int[] columns = cs.getSelectedColumns(); |
||||
for (int i = 0; i < columns.length; i++) { |
||||
report.setColumnWidth(columns[i], len); |
||||
} |
||||
} |
||||
|
||||
protected UNIT getIndexLen(int index, ElementCase report){ |
||||
return report.getColumnWidth(index); |
||||
} |
||||
|
||||
@Override |
||||
protected UNIT getShowLen(ElementCase report, CellSelection cs) { |
||||
int[] columns = cs.getSelectedColumns(); |
||||
return getSelectedCellsLen(columns, report); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.cell.AbstractCellElementAction; |
||||
import com.fr.design.dscolumn.DSColumnAdvancedPane; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
public class DSColumnAdvancedAction extends AbstractCellElementAction { |
||||
private boolean returnValue=false; |
||||
private TemplateCellElement editCellElement; |
||||
public DSColumnAdvancedAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Advanced")); |
||||
this.setMnemonic('A'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
this.editCellElement = cellElement; |
||||
DSColumnAdvancedPane dSColumnAdvancedPane = new DSColumnAdvancedPane(); |
||||
dSColumnAdvancedPane.populate(cellElement); |
||||
return dSColumnAdvancedPane; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane basicPane, |
||||
TemplateCellElement cellElement) { |
||||
((DSColumnAdvancedPane)basicPane).update(editCellElement); |
||||
} |
||||
} |
@ -0,0 +1,88 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.dscolumn.DSColumnBasicPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.core.SheetUtils; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
public class DSColumnBasicAction extends CellSelectionAction { |
||||
|
||||
public DSColumnBasicAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Basic")); |
||||
// this.setMnemonic('B');
|
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
final ElementCasePane reportPane = this.getEditingComponent(); |
||||
final DSColumnBasicPane dsColumnBasicPane = new DSColumnBasicPane(); |
||||
|
||||
BasicDialog dSColumnBasicDialog = dsColumnBasicPane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
|
||||
// Got editCellElement.
|
||||
TemplateCellElement editCellElement = null; |
||||
|
||||
// got simple cell element from column and row.
|
||||
final TemplateElementCase report = reportPane.getEditingElementCase(); |
||||
editCellElement = report.getTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
|
||||
dsColumnBasicPane.putElementcase(getEditingComponent()); |
||||
dsColumnBasicPane.putCellElement(editCellElement); |
||||
|
||||
// alex:如果是线性报表,这时还要计算一下默认父格是什么z
|
||||
if (report != null) { |
||||
SheetUtils.calculateDefaultParent(report); |
||||
} |
||||
dsColumnBasicPane.populate(null, editCellElement); |
||||
final CellSelection finalCS = cs; |
||||
dSColumnBasicDialog.addDialogActionListener(new CellElementDialogActionListenr(editCellElement) { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
// 需要先行后列地增加新元素。
|
||||
for (int j = 0; j < finalCS.getRowSpan(); j++) { |
||||
for (int i = 0; i < finalCS.getColumnSpan(); i++) { |
||||
int column = i + finalCS.getColumn(); |
||||
int row = j + finalCS.getRow(); |
||||
|
||||
editCellElement = report.getTemplateCellElement(column, row); |
||||
if (editCellElement == null) { |
||||
editCellElement = new DefaultTemplateCellElement(column, row); |
||||
report.addCellElement(editCellElement); |
||||
} |
||||
// update cell attributes
|
||||
dsColumnBasicPane.update(editCellElement); |
||||
} |
||||
} |
||||
|
||||
reportPane.fireTargetModified(); |
||||
} |
||||
}); |
||||
|
||||
dSColumnBasicDialog.setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
public static class CellElementDialogActionListenr extends DialogActionAdapter { |
||||
|
||||
TemplateCellElement editCellElement; |
||||
|
||||
public CellElementDialogActionListenr(TemplateCellElement editCellElement) { |
||||
this.editCellElement = editCellElement; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.cell.AbstractCellElementAction; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dscolumn.DSColumnConditionsPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
/** |
||||
* 数据列过滤条件Action |
||||
* |
||||
* @author null |
||||
* @version 2017年11月17日15点11分 |
||||
* @since 8.0 |
||||
*/ |
||||
public class DSColumnConditionAction extends AbstractCellElementAction { |
||||
|
||||
public DSColumnConditionAction() { |
||||
super(); |
||||
this.setName(Inter.getLocText("Filter")); |
||||
this.setMnemonic('E'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
public DSColumnConditionAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setName(Inter.getLocText("Filter")); |
||||
this.setMnemonic('E'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
public void setEditingComponent(ElementCasePane casePane) { |
||||
super.setEditingComponent(casePane); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); |
||||
dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); |
||||
return dSColumnConditionsPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||
((DSColumnConditionsPane) bp).update(cellElement); |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Delete Column |
||||
*/ |
||||
public class DeleteColumnAction extends CellSelectionAction { |
||||
|
||||
public DeleteColumnAction(ElementCasePane t) { |
||||
this(t, DELETE_COLUMN.getMenuName()); |
||||
} |
||||
|
||||
public DeleteColumnAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
this.setName(name); |
||||
this.setMnemonic(DELETE_COLUMN.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/deleteColumn.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
// 删掉多行
|
||||
int[] columns = cs.getSelectedColumns(); |
||||
for (int i = 0; i < columns.length; i++) { |
||||
report.removeColumn(columns[i] - i); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static final MenuKeySet DELETE_COLUMN= new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'D'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Column"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,63 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Delete Row |
||||
*/ |
||||
public class DeleteRowAction extends CellSelectionAction { |
||||
|
||||
public DeleteRowAction(ElementCasePane t) { |
||||
this(t, DELETE_ROW.getMenuName()); |
||||
} |
||||
|
||||
public DeleteRowAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
|
||||
this.setName(name); |
||||
this.setMnemonic(DELETE_ROW.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/deleteRow.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
// 删掉多行
|
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.removeRow(rows[i] - i); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static final MenuKeySet DELETE_ROW = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'D'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Row"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class FootColumnAction extends ColumnRowRepeatAction { |
||||
|
||||
public FootColumnAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Column_Title_End")); |
||||
// this.setMnemonic('F');
|
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class FootRowAction extends ColumnRowRepeatAction { |
||||
public FootRowAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Row_Title_End")); |
||||
// this.setMnemonic('F');
|
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class HeadColumnAction extends ColumnRowRepeatAction { |
||||
|
||||
public HeadColumnAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Column_Title_Start")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class HeadRowAction extends ColumnRowRepeatAction { |
||||
|
||||
public HeadRowAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Row_Title_Start")); |
||||
// this.setMnemonic('H');
|
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Insert Column |
||||
*/ |
||||
public class InsertColumnAction extends CellSelectionAction { |
||||
|
||||
public InsertColumnAction(ElementCasePane t) { |
||||
this(t, INSERT_COLUMN.getMenuName()); |
||||
} |
||||
|
||||
public InsertColumnAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
|
||||
this.setName(name); |
||||
this.setMnemonic(INSERT_COLUMN.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/insertColumn.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_COLUMN = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'I'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Column"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] columns = cs.getSelectedColumns(); |
||||
for (int i = 0; i < columns.length; i++) { |
||||
report.insertColumn(columns[i]); |
||||
} |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Insert Row |
||||
*/ |
||||
public class InsertRowAction extends CellSelectionAction { |
||||
|
||||
public InsertRowAction(ElementCasePane t) { |
||||
this(t,INSERT_ROW.getMenuName()); |
||||
} |
||||
|
||||
public InsertRowAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
this.setName(name); |
||||
this.setMnemonic(INSERT_ROW.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/insertRow.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_ROW = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'I'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Row"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
|
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.insertRow(rows[i]); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNITConstants; |
||||
|
||||
public class ResetColumnHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public ResetColumnHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText(new String[]{"MConfig-CancelButton", "Hide"})); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] columns = cs.getSelectedColumns(); |
||||
boolean ischanged = false; |
||||
for (int column : columns) { |
||||
if (report.getColumnWidth(column).equal_zero()) { |
||||
report.setColumnWidth(column, UNITConstants.DEFAULT_COL_WIDTH); |
||||
ischanged = true; |
||||
} |
||||
} |
||||
if (ischanged) { |
||||
ePane.repaint(); |
||||
ePane.fireTargetModified(); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
Selection s = ePane.getSelection(); |
||||
if (s instanceof CellSelection) { |
||||
CellSelection cs = (CellSelection)s; |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
if (report.getColumnWidth(i).equal_zero()) { |
||||
this.setEnabled(true); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
this.setEnabled(false); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNITConstants; |
||||
|
||||
public class ResetRowHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public ResetRowHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText(new String[]{"MConfig-CancelButton", "Hide"})); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] rows = cs.getSelectedRows(); |
||||
boolean ischanged = false; |
||||
for (int row : rows) { |
||||
if (report.getRowHeight(row).equal_zero()) { |
||||
report.setRowHeight(row, UNITConstants.DEFAULT_ROW_HEIGHT); |
||||
ischanged = true; |
||||
} |
||||
} |
||||
if (ischanged) { |
||||
ePane.repaint(); |
||||
ePane.fireTargetModified(); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
Selection s = ePane.getSelection(); |
||||
if (s instanceof CellSelection) { |
||||
CellSelection cs = (CellSelection)s; |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
if (report.getRowHeight(i).equal_zero()) { |
||||
this.setEnabled(true); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
this.setEnabled(false); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* Row height |
||||
*/ |
||||
public class RowHeightAction extends ColumnRowSizingAction { |
||||
|
||||
public RowHeightAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
|
||||
this.setName(Inter.getLocText("Utils-Row_Height") + "..."); |
||||
this.setMnemonic('R'); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4UnitInputPane() { |
||||
return Inter.getLocText("Utils-Row_Height"); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateAction(ElementCase report, UNIT len, CellSelection cs) { |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.setRowHeight(rows[i], len); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected UNIT getShowLen(ElementCase report, CellSelection cs) { |
||||
int[] rows = cs.getSelectedRows(); |
||||
return getSelectedCellsLen(rows, report); |
||||
} |
||||
|
||||
protected UNIT getIndexLen(int index, ElementCase report){ |
||||
return report.getRowHeight(index); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
public class RowHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public RowHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText("Hide")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.setRowHeight(rows[i], UNIT.ZERO); |
||||
} |
||||
ePane.fireTargetModified(); |
||||
ePane.repaint(); |
||||
return false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
/** |
||||
* Delete Row, Column or FloatElement.. |
||||
*/ |
||||
public class DeleteAction extends ElementCaseAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public DeleteAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Delete")); |
||||
this.setMnemonic('D'); |
||||
//Richie:删除菜单图标
|
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); |
||||
// this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
|
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane ePane = getEditingComponent(); |
||||
|
||||
return ePane.getSelection().triggerDeleteAction(ePane); |
||||
} |
||||
} |
@ -0,0 +1,70 @@
|
||||
package com.fr.design.actions.edit; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.design.actions.FloatSelectionAction; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
public class EditFloatElementNameAction extends FloatSelectionAction { |
||||
|
||||
public EditFloatElementNameAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText(new String[]{"Set", "Float_Element_Name"})); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithFloatSelection( |
||||
FloatSelection fs) { |
||||
final ElementCasePane reportPane = getEditingComponent(); |
||||
final ElementCase report = reportPane.getEditingElementCase(); |
||||
|
||||
//p:获得最后一个选中的悬浮元素.
|
||||
final FloatElement selectedFloatElement = report.getFloatElement(fs.getSelectedFloatName()); |
||||
|
||||
final NamePane pane = new NamePane(); |
||||
pane.populate(selectedFloatElement.getName()); |
||||
BasicDialog nameDialog = pane.showSmallWindow(SwingUtilities.getWindowAncestor(reportPane),new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
String name = pane.update(); |
||||
if (report.getFloatElement(name) == null) { |
||||
selectedFloatElement.setName(name); |
||||
} |
||||
((FloatSelection) reportPane.getSelection()).setFloatName(name); |
||||
} |
||||
}); |
||||
nameDialog.setVisible(true); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
class NamePane extends BasicPane{ |
||||
private UITextField jtext; |
||||
public NamePane() { |
||||
jtext = new UITextField(15); |
||||
this.add(jtext); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText(new String[]{"Set", "Float_Element_Name"}); |
||||
} |
||||
|
||||
public void populate(String name) { |
||||
jtext.setText(name); |
||||
} |
||||
|
||||
public String update() { |
||||
return jtext.getText(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.EastRegionContainerPane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* HyperlinkAction. |
||||
*/ |
||||
public class HyperlinkAction extends UpdateAction { |
||||
|
||||
public HyperlinkAction() { |
||||
this.setMenuKeySet(KeySetUtils.HYPER_LINK); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_HYPERLINK); |
||||
EastRegionContainerPane.getInstance().setWindow2PreferWidth(); |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* @author richer |
||||
* @since 6.5.3 |
||||
*/ |
||||
public abstract class ClearAction extends ElementCaseAction { |
||||
protected ClearAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Clear all. |
||||
*/ |
||||
public class ClearAllAction extends ClearAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearAllAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Clear_All")); |
||||
this.setMnemonic('A'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearAll(); |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Clear contents. |
||||
*/ |
||||
public class ClearContentsAction extends ClearAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearContentsAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Clear_Contents")); |
||||
this.setMnemonic('C'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearContents(); |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Clear formats. |
||||
*/ |
||||
public class ClearFormatsAction extends ClearAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearFormatsAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Clear_Formats")); |
||||
this.setMnemonic('F'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearFormats(); |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
//:jackie 用于清除控件
|
||||
public class ClearWidgetAction extends ClearAction { |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearWidgetAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Widget")); |
||||
this.setMnemonic('W'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearWidget(); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.merge; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* merge cell.. |
||||
*/ |
||||
public class MergeCellAction extends ElementCaseAction { |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public MergeCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.MERGE_CELL); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/merge.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是则返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.mergeCell(); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
this.setEnabled(reportPane.canMergeCell()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.merge; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* unmerge cell.. |
||||
*/ |
||||
public class UnmergeCellAction extends ElementCaseAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public UnmergeCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.UNMERGE_CELL); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/unmerge.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
this.setEnabled(reportPane.canUnMergeCell()); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是则返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.unMergeCell(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.design.actions.FloatSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
/** |
||||
* FloatElement order. |
||||
*/ |
||||
public abstract class AbstractFloatElementOrderAction extends FloatSelectionAction { |
||||
protected AbstractFloatElementOrderAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeededWithFloatSelection(FloatSelection fs) { |
||||
ElementCasePane ePane = getEditingComponent(); |
||||
|
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
//p:获得最后一个选中的悬浮元素.
|
||||
FloatElement selectedFloatElement = report.getFloatElement(fs.getSelectedFloatName()); |
||||
orderWithSelectedFloatElement(report, selectedFloatElement); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
public abstract void orderWithSelectedFloatElement(ElementCase report, FloatElement floatElement); |
||||
} |
@ -0,0 +1,38 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
/** |
||||
* Bring FloatElement forward. |
||||
*/ |
||||
public class BringFloatElementForwardAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor. |
||||
*/ |
||||
public BringFloatElementForwardAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Bring_Forward")); |
||||
this.setMnemonic('F'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); |
||||
// this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER));
|
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.bringFloatElementForward(floatElement); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.InputEvent; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
/** |
||||
* Bring FloatElement to front. |
||||
*/ |
||||
public class BringFloatElementToFrontAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor. |
||||
*/ |
||||
public BringFloatElementToFrontAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Bring_to_Front")); |
||||
this.setMnemonic('T'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png")); |
||||
// this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK));
|
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.bringFloatElementToFront(floatElement); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
/** |
||||
* Send FloatElement backward. |
||||
*/ |
||||
public class SendFloatElementBackwardAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public SendFloatElementBackwardAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Send_Backward")); |
||||
this.setMnemonic('B'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); |
||||
// this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER));
|
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.sendFloatElementBackward(floatElement); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.InputEvent; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
/** |
||||
* Send FloatElement to back. |
||||
*/ |
||||
public class SendFloatElementToBackAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public SendFloatElementToBackAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Send_to_Back")); |
||||
this.setMnemonic('K'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png")); |
||||
// this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK));
|
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.sendFloatElementToBack(floatElement); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.ExcelUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
|
||||
/** |
||||
* Export excel. |
||||
*/ |
||||
public abstract class AbstractExcelExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
protected AbstractExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new ChooseFileFilter(new String[]{"zip"}, "ZIP"); |
||||
} else { |
||||
return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Inter.getLocText("Export-Excel")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return "zip"; |
||||
} else { |
||||
return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,184 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.Parameter; |
||||
import com.fr.page.PageSetProvider; |
||||
import com.fr.design.actions.JWorkBookAction; |
||||
import com.fr.design.gui.iprogressbar.FRProgressBar; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.parameter.ParameterInputPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.file.FILE; |
||||
import com.fr.file.FILEChooserPane; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.*; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.main.impl.WorkBook; |
||||
import com.fr.report.ReportHelper; |
||||
import com.fr.report.core.ReportUtils; |
||||
import com.fr.report.report.Report; |
||||
import com.fr.report.worksheet.WorkSheet; |
||||
import com.fr.stable.ActorConstants; |
||||
import com.fr.stable.ActorFactory; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.io.FileOutputStream; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Abstract export action. |
||||
*/ |
||||
public abstract class AbstractExportAction extends JWorkBookAction { |
||||
protected AbstractExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
} |
||||
|
||||
private FRProgressBar progressbar; |
||||
|
||||
protected WorkBook getTemplateWorkBook() { |
||||
return this.getEditingComponent().getTarget(); |
||||
} |
||||
|
||||
/** |
||||
* 执行方法 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
JWorkBook jwb = this.getEditingComponent(); |
||||
FILE editingFILE = jwb.getEditingFILE(); |
||||
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
|
||||
// 弹出参数
|
||||
final java.util.Map parameterMap = new java.util.HashMap(); |
||||
final TemplateWorkBook tpl = getTemplateWorkBook(); |
||||
Parameter[] parameters = tpl.getParameters(); |
||||
if (parameters != null && parameters.length > 0) {// 检查Parameter.
|
||||
final ParameterInputPane pPane = new ParameterInputPane( |
||||
parameters); |
||||
pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
parameterMap.putAll(pPane.update()); |
||||
} |
||||
}).setVisible(true); |
||||
} |
||||
|
||||
// Choose a file name....
|
||||
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); |
||||
fileChooserPane.setFILEFilter(this.getChooseFileFilter()); |
||||
|
||||
// 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc
|
||||
String filenName = editingFILE.getName(); |
||||
if (filenName.indexOf('.') != -1) { |
||||
filenName = filenName.substring(0, editingFILE.getName().lastIndexOf('.')); |
||||
} |
||||
fileChooserPane.setFileNameTextField(filenName, "." + this.getDefaultExtension()); |
||||
int saveValue = fileChooserPane.showSaveDialog(designerFrame, "." + this.getDefaultExtension()); |
||||
if (saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION) { |
||||
fileChooserPane = null; |
||||
return; |
||||
} else if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { |
||||
FILE file = fileChooserPane.getSelectedFILE(); |
||||
try { |
||||
file.mkfile(); |
||||
} catch (Exception e1) { |
||||
FRLogger.getLogger().error("Error In Make New File"); |
||||
} |
||||
fileChooserPane = null; |
||||
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("FR-Designer_Prepare_Export") + "!"); |
||||
|
||||
(progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, |
||||
Inter.getLocText("FR-Designer_Exporting"), "", 0, 100)).start(); |
||||
} |
||||
} |
||||
|
||||
private SwingWorker createExportWork(FILE file, final TemplateWorkBook tpl, final Map parameterMap) { |
||||
final String filePath = file.getPath(); |
||||
final String fileGetName = file.getName(); |
||||
|
||||
SwingWorker exportWorker = new SwingWorker<Void, Void>() { |
||||
protected Void doInBackground() throws Exception { |
||||
Thread.sleep(100); //bug 10516
|
||||
try { |
||||
final FileOutputStream fileOutputStream = new FileOutputStream(filePath); |
||||
|
||||
this.setProgress(10); |
||||
dealExporter(fileOutputStream, tpl, parameterMap); |
||||
this.setProgress(80); |
||||
fileOutputStream.close(); |
||||
this.setProgress(100); |
||||
|
||||
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!"); |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
||||
Inter.getLocText("FR-Designer_Exported_successfully") + "\n" + filePath); |
||||
} catch (Exception exp) { |
||||
this.setProgress(100); |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public void done() { |
||||
progressbar.close(); |
||||
} |
||||
}; |
||||
return exportWorker; |
||||
} |
||||
|
||||
private void dealExporter(FileOutputStream fileOutputStream, final TemplateWorkBook tpl, final Map parameterMap) throws Exception { |
||||
final Exporter exporter = AbstractExportAction.this.getExporter(); |
||||
if (exporter instanceof AppExporter) { |
||||
AppExporter appExporter = (AppExporter) exporter; |
||||
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter |
||||
|| exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) { |
||||
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
|
||||
|
||||
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) |
||||
)); |
||||
} else { |
||||
ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果
|
||||
|
||||
PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet( |
||||
ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export(); |
||||
appExporter.export(fileOutputStream, pageSet); |
||||
pageSet.release(); |
||||
} |
||||
} else if (exporter instanceof EmbeddedTableDataExporter) { |
||||
((EmbeddedTableDataExporter) exporter).export(fileOutputStream, (WorkBook) tpl, parameterMap); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* 这边判断是否有层式报表,有层式需要使用大数据量导出 |
||||
*/ |
||||
protected boolean hasLayerReport(TemplateWorkBook tpl) { |
||||
if (tpl == null) { |
||||
return false; |
||||
} |
||||
for (int i = 0; i < tpl.getReportCount(); i++) { |
||||
Report r = tpl.getReport(i); |
||||
if (r instanceof WorkSheet) { |
||||
if (((WorkSheet) r).getLayerReportAttr() != null) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
protected abstract ChooseFileFilter getChooseFileFilter(); |
||||
|
||||
protected abstract String getDefaultExtension(); |
||||
|
||||
protected abstract Exporter getExporter(); |
||||
} |
@ -0,0 +1,55 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.CSVExporter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.LargeDataPageCSVExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
|
||||
/** |
||||
* Export CSV. |
||||
*/ |
||||
public class CSVExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public CSVExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.CSV_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/csv.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new LargeDataPageCSVExporter(); |
||||
} else { |
||||
return new CSVExporter(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"csv"}, Inter.getLocText("Export-CSV")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return "zip"; |
||||
} else { |
||||
return "csv"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.EmbeddedTableDataExporter; |
||||
import com.fr.io.exporter.Exporter; |
||||
|
||||
/** |
||||
* Export Embedded. |
||||
*/ |
||||
public class EmbeddedExportExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public EmbeddedExportExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.EMBEDDED_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new EmbeddedTableDataExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"cpt"}, |
||||
Inter.getLocText("Export-Template(embedded_data)")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "cpt"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.io.exporter.ExcelExporter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.LargeDataPageExcelExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
public class ExcelExportAction extends AbstractExcelExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), false); |
||||
} else { |
||||
return new ExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.web.core.reserve.PDFExporterFactory; |
||||
|
||||
/** |
||||
* Export pdf |
||||
*/ |
||||
public class PDFExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public PDFExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.PDF_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
|
||||
return PDFExporterFactory.getPDFExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("FR-Designer_Export-PDF")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "pdf"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.LargeDataPageExcelExporter; |
||||
import com.fr.io.exporter.PageExcelExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
public class PageExcelExportAction extends AbstractExcelExportAction { |
||||
|
||||
public PageExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.PAGE_EXCEL_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), true); |
||||
} else { |
||||
return new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.PageToSheetExcelExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
public class PageToSheetExcelExportAction extends AbstractExcelExportAction { |
||||
|
||||
public PageToSheetExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
|
||||
this.setMenuKeySet(KeySetUtils.PAGETOSHEET_EXCEL_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
return new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"xls"}, Inter.getLocText("Export-Excel")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "xls"; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.SVGExporter; |
||||
|
||||
/** |
||||
* Export SVG |
||||
*/ |
||||
public class SVGExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public SVGExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
|
||||
this.setMenuKeySet(KeySetUtils.SVG_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/svg.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new SVGExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"svg"}, Inter.getLocText("Export-SVG")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "svg"; |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.TextExporter; |
||||
|
||||
/** |
||||
* Export Text. |
||||
*/ |
||||
public class TextExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public TextExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.TEXT_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new TextExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"txt"}, Inter.getLocText("Export-Text")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "txt"; |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
/* |
||||
* * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.WordExporter; |
||||
|
||||
/** |
||||
* Export excel. |
||||
*/ |
||||
public class WordExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public WordExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.WORD_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/word.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new WordExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"doc"}, Inter.getLocText("Export-Word")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "doc"; |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.actions.file.newReport; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @date 2015-06-16 |
||||
* @since 8.0 |
||||
*/ |
||||
public class NewOEMWorkBookAction extends NewWorkBookAction { |
||||
|
||||
@Override |
||||
protected Icon icon() { |
||||
return BaseUtils.readIcon("/com/fr/plugin/oem/images/newoemcpt.png"); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.actions.file.newReport; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JPolyWorkBook; |
||||
import com.fr.general.Inter; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
public class NewPolyReportAction extends UpdateAction { |
||||
|
||||
public NewPolyReportAction() { |
||||
this.setName(Inter.getLocText("M-New_Multi_Report")); |
||||
this.setMnemonic('F'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/formExport.png")); |
||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, DEFAULT_MODIFIER)); |
||||
} |
||||
|
||||
/** |
||||
* Action触发后 |
||||
* |
||||
* @param e 触发的事件 |
||||
* |
||||
* @date 2015-2-5-上午11:43:13 |
||||
* |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JPolyWorkBook()); |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.actions.file.newReport; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.InputEvent; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
||||
|
||||
public class NewWorkBookAction extends UpdateAction { |
||||
|
||||
public NewWorkBookAction() { |
||||
this.setMenuKeySet(NEW_WORK_BOOK); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(icon()); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
protected Icon icon() { |
||||
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png"); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook()); |
||||
} |
||||
|
||||
public static final MenuKeySet NEW_WORK_BOOK = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'N'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M-New_WorkBook"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return KeyStroke.getKeyStroke(KeyEvent.VK_N, DEFAULT_MODIFIER); |
||||
} |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.actions.form; |
||||
|
||||
import com.fr.design.actions.TemplateComponentAction; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
|
||||
public class AbastractFormECAction <T extends FormElementCasePaneDelegate> extends TemplateComponentAction<T>{ |
||||
|
||||
protected AbastractFormECAction(T t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
return false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.form; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.ReportBackgroundPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
|
||||
/** |
||||
* Background action. |
||||
*/ |
||||
public class FormECBackgroundAction extends AbastractFormECAction<FormElementCasePaneDelegate>{ |
||||
|
||||
public FormECBackgroundAction(FormElementCasePaneDelegate rc) { |
||||
super(rc); |
||||
this.setMenuKeySet(KeySetUtils.REPORT_BACKGROUND); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/background.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final FormElementCasePaneDelegate elementCasePane = this.getEditingComponent(); |
||||
if (elementCasePane == null) { |
||||
return false; |
||||
} |
||||
final ReportBackgroundPane bPane = new ReportBackgroundPane(); |
||||
bPane.populate(elementCasePane.getReportSettings()); |
||||
bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
bPane.update(elementCasePane.getReportSettings()); |
||||
elementCasePane.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,52 @@
|
||||
package com.fr.design.actions.form; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.ReportColumnsPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.report.stable.WorkSheetAttr; |
||||
import com.fr.report.worksheet.FormElementCase; |
||||
|
||||
public class FormECColumnsAction extends AbastractFormECAction<FormElementCasePaneDelegate>{ |
||||
|
||||
public FormECColumnsAction(FormElementCasePaneDelegate t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.EC_COLUMNS); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/form/toolbar/ec_columns.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final FormElementCasePaneDelegate jws = this.getEditingComponent(); |
||||
if (jws == null) { |
||||
return false; |
||||
} |
||||
final FormElementCase elementCase = jws.getTarget(); |
||||
|
||||
final ReportColumnsPane cPane = new ReportColumnsPane(); |
||||
WorkSheetAttr attr = elementCase.getWorkSheetAttr(); |
||||
int rowCount = elementCase.getRowCount(); |
||||
int colCount = elementCase.getColumnCount(); |
||||
cPane.populate(attr, rowCount, colCount); |
||||
cPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
// bug:64173 重新生成一个workSheetAttr,否则会受到之前属性的干扰
|
||||
WorkSheetAttr attr = new WorkSheetAttr(); |
||||
elementCase.setWorkSheetAttr(attr); |
||||
cPane.update(attr); |
||||
jws.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.form; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.freeze.FormECRepeatAndFreezeSettingPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.report.worksheet.FormElementCase; |
||||
|
||||
/** |
||||
* 表单报表块冻结 |
||||
*/ |
||||
public class FormECFrozenAction extends AbastractFormECAction<FormElementCasePaneDelegate>{ |
||||
private boolean returnValue; |
||||
|
||||
public FormECFrozenAction(FormElementCasePaneDelegate t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.EC_FROZEN); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/form/toolbar/ec_frozen.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
FormElementCasePaneDelegate jws = getEditingComponent(); |
||||
if (jws == null) { |
||||
return false; |
||||
} |
||||
final FormElementCase fc = jws.getTarget(); |
||||
final FormECRepeatAndFreezeSettingPane attrPane = new FormECRepeatAndFreezeSettingPane(); |
||||
attrPane.populate(fc.getReportPageAttr()); |
||||
BasicDialog dlg = attrPane.showWindow(SwingUtilities.getWindowAncestor(jws)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
fc.setReportPageAttr(attrPane.update()); |
||||
returnValue = true; |
||||
} |
||||
}); |
||||
dlg.setVisible(true); |
||||
return returnValue; |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.core.SheetUtils; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
/** |
||||
* Cell. |
||||
*/ |
||||
public abstract class AbstractCellAction extends CellSelectionAction { |
||||
protected AbstractCellAction() { |
||||
} |
||||
|
||||
protected AbstractCellAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
public abstract Class getCellValueClass(); |
||||
|
||||
/* |
||||
* TODO ALEX_SEP 这里的返回boolean量表示模板是否改变,导致很多很多的方法的boolean返回值都是这个意思 |
||||
* |
||||
* 感觉有点浪费 |
||||
*/ |
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
//got simple cell element from column and row.
|
||||
TemplateElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
//alex:如果是线性报表,这时还要计算一下默认父格是什么
|
||||
if (report != null && this instanceof DSColumnCellAction) { |
||||
SheetUtils.calculateDefaultParent(report); |
||||
} |
||||
|
||||
return ePane.getGrid().startCellEditingAt_DEC( |
||||
cs.getColumn(), |
||||
cs.getRow(), |
||||
this.getCellValueClass(), false |
||||
); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
this.setEnabled(ePane.isSelectedOneCell()); |
||||
} |
||||
} |
@ -0,0 +1,58 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.core.WorkBookSupportable; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.cell.painter.BiasTextPainter; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
/** |
||||
* Bias |
||||
*/ |
||||
public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable { |
||||
|
||||
public BiasCellAction() { |
||||
initAction(); |
||||
} |
||||
|
||||
public BiasCellAction(ElementCasePane t) { |
||||
super(t); |
||||
initAction(); |
||||
} |
||||
|
||||
private void initAction() { |
||||
this.setMenuKeySet(INSERT_SLOPE_LINE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_SLOPE_LINE = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
//之前是S, 跟子报表subreport重复了
|
||||
return 'X'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Slope_Line"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return BiasTextPainter.class; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue