Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Classloader prototype #561

Draft
wants to merge 445 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
445 commits
Select commit Hold shift + click to select a range
2993147
move save certification functionality from UI to CertificateUtils
AndreasEhret Feb 12, 2020
fe883cd
add alwaysTrustCheckbox
AndreasEhret Feb 12, 2020
62488d1
extract main method for starting dialogs to test class
sclassen Feb 13, 2020
d3c535b
extract main method for starting dialogs to test class
sclassen Feb 13, 2020
bc04f31
code cleanup
sclassen Feb 13, 2020
3b0d848
make acces type final
sclassen Feb 13, 2020
da3bc5a
add AdvancedOptionsButton
AndreasEhret Feb 13, 2020
5a0602c
add result mapping
AndreasEhret Feb 13, 2020
eef5602
use TRANSLATOR instead of R
AndreasEhret Feb 13, 2020
8e56383
removed unused, moved getMessageFor
AndreasEhret Feb 13, 2020
c93f0d5
add moreInformationPanel
AndreasEhret Feb 13, 2020
521d62c
extract htmlWrap method to SwingUtils
AndreasEhret Feb 13, 2020
f97cb8e
add action listener to moreInfoButton
AndreasEhret Feb 13, 2020
611f2c5
change result to Allow/Deny
AndreasEhret Feb 13, 2020
ab62d9a
change result to Allow/Deny/Remember
AndreasEhret Feb 13, 2020
b37f51f
add javadoc
AndreasEhret Feb 13, 2020
66671ae
reorder enum values
sclassen Feb 13, 2020
94f9fc3
extract separate dialog for create desktop shortcut
sclassen Feb 13, 2020
612e9b3
made stream chain more readable
AndreasEhret Feb 14, 2020
c78c403
add desktop and menu checkbox
AndreasEhret Feb 14, 2020
1df0f7b
add buttons for CreateShortcutDialog
AndreasEhret Feb 14, 2020
0be55d8
add image of CreateShortcutDialog for javadoc
AndreasEhret Feb 14, 2020
e3b9e9c
move static class to upper level
AndreasEhret Feb 14, 2020
c021a38
remove unused code
AndreasEhret Feb 14, 2020
1874365
refactor ShortcutResult
AndreasEhret Feb 14, 2020
2d59313
add separator
AndreasEhret Feb 14, 2020
5be357f
add RememberPanel
AndreasEhret Feb 14, 2020
b3b327d
return RememberPanel result
AndreasEhret Feb 14, 2020
a3deb7e
moved layouting methods to super class
AndreasEhret Feb 14, 2020
c1a4efc
move main to the end
AndreasEhret Feb 14, 2020
a3fc6b4
fix copy paste
AndreasEhret Feb 17, 2020
7b476b0
move results and panels to own sub-packages
AndreasEhret Feb 17, 2020
6fe6fb0
make result public
AndreasEhret Feb 17, 2020
181f56a
rename packages
AndreasEhret Feb 17, 2020
c7b2cb7
move code
AndreasEhret Feb 17, 2020
c364e93
add UserDecision
AndreasEhret Feb 17, 2020
34f2f7b
add first UserDecisions implementation
AndreasEhret Feb 17, 2020
3a71d52
use remembered decission before opening dialog
sclassen Feb 17, 2020
d2dba40
create generic container RememberableResult
sclassen Feb 17, 2020
94b8a6d
restructure code to make it better readable
sclassen Feb 17, 2020
761fa18
extract abstract CertWarningDialog class
sclassen Feb 18, 2020
e5c4f05
extract certVerifier functionality to fields
AndreasEhret Feb 18, 2020
dd6617e
introduce CertWarningDetailsDialog
AndreasEhret Feb 18, 2020
662ce1a
ensure correct Dialog stacking
AndreasEhret Feb 19, 2020
0d1b56e
add collapsible panel for details to avoid third stack of dialog
AndreasEhret Feb 19, 2020
8a5ae33
add certificate details panel
AndreasEhret Feb 19, 2020
a3eb15c
add dialog factory calls
AndreasEhret Feb 19, 2020
5079f44
replace certVerifier argument by certPath and certIssues
AndreasEhret Feb 20, 2020
42dd0f6
Merge branch 'master' into small-fixes-hendrik
sclassen Feb 20, 2020
ac478c4
add GridBagPanelBuilder
sclassen Feb 20, 2020
30dfb6f
rename methods
sclassen Feb 20, 2020
a90244b
push createDetailPaneContent() from CertWarningDialog to JarCertWarni…
sclassen Feb 20, 2020
d0203a9
add UnsignedWarningDialog
AndreasEhret Feb 21, 2020
35672f5
Merge remote-tracking branch 'origin/small-fixes-hendrik' into gridBa…
sclassen Feb 21, 2020
05720bc
Merge pull request #592 from AdoptOpenJDK/gridBagBuilder
sclassen Feb 21, 2020
6dcc954
extract duplicated code
sclassen Feb 21, 2020
bf80570
improve cert warning layout
sclassen Feb 21, 2020
ab03c82
add missing constraints
AndreasEhret Feb 21, 2020
5a4d11d
minor factory fixes
AndreasEhret Feb 21, 2020
4bc681d
add translations
sclassen Feb 21, 2020
5eac140
add unverified lable to title
sclassen Feb 21, 2020
a3ceba8
return user result from dialog factory
sclassen Feb 21, 2020
82f7e97
implement PartiallySignedWarningDialog
sclassen Feb 21, 2020
dcac084
improve log message
sclassen Feb 21, 2020
e52fb99
ignore broken test
sclassen Feb 21, 2020
18f6145
refactor layouting, harmonize borders
AndreasEhret Feb 24, 2020
aaf695a
simplify CertificateDetailsPanel call parameter
AndreasEhret Feb 24, 2020
bb44a77
mark deprecated
AndreasEhret Feb 24, 2020
958ad54
add CertInfoDialog
AndreasEhret Feb 24, 2020
c137763
move main method to test
AndreasEhret Feb 24, 2020
8798eb4
add main to test for 511Dialog
AndreasEhret Feb 24, 2020
2531498
add main to test for ALAC dialog
AndreasEhret Feb 24, 2020
715143f
add main to test for missing permissions attribute
AndreasEhret Feb 24, 2020
cd7da1f
layout and icon image improvements
AndreasEhret Feb 24, 2020
a1a6186
add html util
AndreasEhret Feb 25, 2020
35eb4cd
optimize title font size
AndreasEhret Feb 25, 2020
0f3d257
add MissingAttributeDialog, MissingPermissionsAttributeDialog and Mis…
AndreasEhret Feb 25, 2020
e66e407
add MatchingALACAttributeDialog
AndreasEhret Feb 25, 2020
1217e01
textual improvements
AndreasEhret Feb 26, 2020
63e911e
improve wording and styling
AndreasEhret Feb 26, 2020
58d1efe
refactoring redundant subclass code
AndreasEhret Feb 26, 2020
030f8df
resolve todos
AndreasEhret Feb 26, 2020
3d1f8d8
remove getUserResponse() from the public API of the DialogFactory as …
AndreasEhret Feb 26, 2020
8371f86
mark deprecated
AndreasEhret Feb 26, 2020
10d8c8a
refactoring layout parts generation
AndreasEhret Feb 26, 2020
4f0c3ad
enhance grid bag builder by a KeyComponentRow
AndreasEhret Feb 26, 2020
7431fec
move colons to the UI to keep text cleaner
AndreasEhret Feb 26, 2020
60f53f6
add AuthenticationDialog
AndreasEhret Feb 26, 2020
b43a302
add AuthenticationDialog login image
AndreasEhret Feb 26, 2020
7d8da82
localize title
AndreasEhret Feb 27, 2020
1ee1af1
localize titles
AndreasEhret Feb 27, 2020
69319e1
layout cleanup
AndreasEhret Feb 27, 2020
d577808
resolved more todos
AndreasEhret Feb 27, 2020
d3374b8
remove unused method
AndreasEhret Feb 27, 2020
ae083d0
use DialogProvider, harmonize create() to construct dialogs
AndreasEhret Feb 28, 2020
4cd78ce
text improvement
AndreasEhret Feb 28, 2020
a5689c7
improve parameter type
AndreasEhret Feb 28, 2020
deb1d65
removed unused member
AndreasEhret Feb 28, 2020
b5fb59d
extract certVerifier
AndreasEhret Feb 28, 2020
df1893a
add missing info panel
AndreasEhret Feb 28, 2020
18ac017
add error image set
AndreasEhret Feb 28, 2020
baf9bd2
add missing override
AndreasEhret Mar 3, 2020
a198f99
move moreInformationText upwards
AndreasEhret Mar 3, 2020
e0fd3ad
remove AccessType dependency from JarCertWarningDialog
AndreasEhret Mar 3, 2020
64250fc
remove AccessType dependency from DialogProvider
AndreasEhret Mar 3, 2020
f4226ce
start introduction of SecurityUserInteractions
sclassen Mar 3, 2020
c44332d
remove unused method showUnsignedWarningDialog
AndreasEhret Mar 3, 2020
a7a847a
remove unused method showUnsignedWarningDialog on DialogFactory
AndreasEhret Mar 3, 2020
6afa3fb
introduce SecurityLevel enum
AndreasEhret Mar 3, 2020
ae9333e
change ValueValidator to only accept string
sclassen Mar 3, 2020
9941ee5
fix compiler issue because of removed method
sclassen Mar 3, 2020
e7afddf
remove SecurityLevel.MEDIUM as it is no longer valid in java 8
sclassen Mar 3, 2020
f40fb80
fix tests
AndreasEhret Mar 3, 2020
a2c1a97
fix more tests
AndreasEhret Mar 3, 2020
c7d2870
Merge branch 'master' into small-fixes-hendrik
sclassen Mar 4, 2020
0a86b92
add dialog images referenced in javadoc
AndreasEhret Mar 5, 2020
ef7764c
Merge remote-tracking branch 'origin/small-fixes-hendrik' into small-…
AndreasEhret Mar 5, 2020
795ffba
java doc
sclassen Mar 5, 2020
efdd54b
remove AppletPermissionLevel
sclassen Mar 5, 2020
fa1aeb8
remove type from SecurityDesc
AndreasEhret Mar 5, 2020
42755f5
enhance ApplicationManager
sclassen Mar 5, 2020
d4ae347
introduce PermissionManager
AndreasEhret Mar 6, 2020
86addeb
add JNLP is signed check
AndreasEhret Mar 6, 2020
1a534d0
remove no longer valid tests
sclassen Mar 6, 2020
6941187
ensure that main jar is signed before validating jnlp
sclassen Mar 6, 2020
8dd46c5
split method of ApplicationTrustValidator
sclassen Mar 6, 2020
b8bf44a
store signed state in JNLPFile
sclassen Mar 6, 2020
166ad40
add TODO
sclassen Mar 6, 2020
3d462e8
fix compiler issues
sclassen Mar 6, 2020
09e24ef
remove SecurityDelegate dependency and unused AdvancedOptionsButton
AndreasEhret Mar 9, 2020
2bc9a18
add askUserHowToRunApplicationWithCertIssues user interaction
AndreasEhret Mar 9, 2020
1d97b53
save certificate
AndreasEhret Mar 9, 2020
efff43a
refactor API of JNLPMatcher
sclassen Mar 9, 2020
b43733e
remove unused ApplicationPermissions and handle return value of cert …
sclassen Mar 9, 2020
3e7cb5a
throw exception instead of system.exit
sclassen Mar 9, 2020
ecbd2ca
extract common code for eager and lazy validation
sclassen Mar 9, 2020
43c7cd8
add todo
sclassen Mar 9, 2020
6ebf9a2
re-work the ManifestAttributesReader and -Checker
sclassen Mar 10, 2020
3d9094a
add attribute checks to application trust validator
sclassen Mar 10, 2020
8f33a1d
improve exception message
sclassen Mar 10, 2020
1dd83af
loop over certificates and ask user which one to take
AndreasEhret Mar 10, 2020
52b07fa
move weak windows list to AppletInstance
AndreasEhret Mar 10, 2020
784956e
refactor PermissionsManager and ApplicationPermissions
AndreasEhret Mar 10, 2020
1138ae5
refactor PermissionsManager
AndreasEhret Mar 10, 2020
63ef117
refactor PermissionsManager and ApplicationPermissions and add tests
AndreasEhret Mar 11, 2020
7dc37ed
refactor permission classes
AndreasEhret Mar 11, 2020
fd54eff
fix broken tests
AndreasEhret Mar 12, 2020
beff525
fix missing file cleanup on exit
AndreasEhret Mar 12, 2020
210ff22
compacted field of ApplicationInstance
sclassen Mar 12, 2020
21a5963
extract initializer in JNLPCLassloader
sclassen Mar 12, 2020
a837b3a
extract some methods
sclassen Mar 12, 2020
50d1f0d
remove unused field isSigned and throw exception when calling missing…
sclassen Mar 12, 2020
ce2d1b5
remove unused methods
sclassen Mar 12, 2020
1f5bd26
fix tests
AndreasEhret Mar 12, 2020
3e05333
fix remaining tests
sclassen Mar 12, 2020
a0ec0c0
fix failing tests where classloader initialization of eager jars missing
AndreasEhret Mar 16, 2020
a826af4
Merge remote-tracking branch 'origin/small-fixes-hendrik' into small-…
AndreasEhret Mar 16, 2020
db7e309
merge secure property changes
AndreasEhret Mar 16, 2020
da93ecd
check properties for permission and reference in java doc, log illega…
AndreasEhret Mar 16, 2020
b2cfcf2
remove unused property
AndreasEhret Mar 16, 2020
9e48d51
make ApplicationEnvironment public
AndreasEhret Mar 16, 2020
4460ee0
Merge branch 'master' into small-fixes-hendrik
sclassen Mar 16, 2020
0ecd5cd
add missing runnable and throw exception
AndreasEhret Mar 17, 2020
43c6cde
fix the initialization order
AndreasEhret Mar 17, 2020
f974008
fix index position
AndreasEhret Mar 17, 2020
9e11c4b
provide UUID name for anonymous parts and skip empty parts
AndreasEhret Mar 17, 2020
c3d2da4
Merge pull request #608 from AdoptOpenJDK/small-fixes-hendrik
sclassen Mar 17, 2020
260192e
add jar name to exception message
AndreasEhret Mar 19, 2020
4a4f205
add error dialog
AndreasEhret Mar 19, 2020
e326367
add system class loader in chain of plces to search for classes
sclassen Mar 19, 2020
d971a0d
improve log message
AndreasEhret Mar 20, 2020
d43d887
ensure error dialog always on top
AndreasEhret Mar 20, 2020
fc888bd
refactor XBasicService getCodebase() and improve Javadoc according to…
AndreasEhret Mar 20, 2020
8542d9b
add BasicService javadoc and
AndreasEhret Mar 20, 2020
243b844
implement DownloadService.isExtensionPartCached and add javadoc
AndreasEhret Mar 20, 2020
ce3f4e9
implement DownloadService.isExtensionPartCached for parts array and a…
AndreasEhret Mar 20, 2020
e8a94d1
implement DownloadService.isPartCached and add javadoc
AndreasEhret Mar 20, 2020
d3e38ed
implement DownloadService.isResourceCached and add javadoc
AndreasEhret Mar 20, 2020
d0ad7fb
java doc
sclassen Mar 20, 2020
7b9cf19
java doc
sclassen Mar 20, 2020
c54aa6c
java doc
sclassen Mar 20, 2020
9c5c709
java doc
sclassen Mar 20, 2020
72befef
java doc
sclassen Mar 20, 2020
7f5fbb9
java doc
sclassen Mar 20, 2020
b19d8c1
java doc
sclassen Mar 20, 2020
0746a18
java doc
sclassen Mar 20, 2020
922a6cf
java doc
sclassen Mar 20, 2020
8121e44
java doc
sclassen Mar 20, 2020
bb0338b
refactor showDocument, add javadoc
AndreasEhret Mar 23, 2020
d8f163c
implement loadExtensionPart
AndreasEhret Mar 23, 2020
2e15cbf
implement loadPart
AndreasEhret Mar 23, 2020
b64f066
implement removePart
AndreasEhret Mar 23, 2020
bc153fd
implement removeExtensionPart
AndreasEhret Mar 23, 2020
110b122
implement removePartContainingJar, improve naming
AndreasEhret Mar 23, 2020
f852986
do not allow to remove parts/resources from cache using JNLP API
sclassen Mar 23, 2020
101c60f
Make system classloader the parent of the JnlpApplicationClassloader
sclassen Mar 23, 2020
2bb67e0
handle case where jar cannot be downloaded
sclassen Mar 27, 2020
b55f239
set version to 3.0.0-alpha1
sclassen Mar 27, 2020
6bfe160
set version to 3.0.0-SNAPSHOT
sclassen Mar 27, 2020
aca6238
add gson dependency
AndreasEhret Apr 7, 2020
d0fc350
implement save of FileStoreEntries
AndreasEhret Apr 7, 2020
da23fd4
improve log statements
AndreasEhret Apr 8, 2020
1b02382
implement getUserDecisions
AndreasEhret Apr 8, 2020
7ad5a5a
changed list to set
AndreasEhret Apr 8, 2020
9277258
add first test for UserDecisionsFileStore
sclassen Apr 8, 2020
d572a18
cleanup test
sclassen Apr 8, 2020
4151cf8
add more tests
sclassen Apr 8, 2020
094d9e1
add more tests
sclassen Apr 8, 2020
649b20e
add more tests
sclassen Apr 8, 2020
42a3f53
Merge pull request #621 from AdoptOpenJDK/userDecisionsFileStore
sclassen Apr 17, 2020
20a6722
Merge branch 'master' into classloader-prototype
sclassen Apr 17, 2020
4ced749
change file store impl to make json more compact
sclassen Apr 17, 2020
ee98a05
Merge pull request #626 from AdoptOpenJDK/compactDecisionFileStore
AndreasEhret Apr 20, 2020
aaf6c93
Merge branch 'master' into classloader-prototype
sclassen Apr 20, 2020
36938fa
improve logging when main jar is not found
sclassen Apr 28, 2020
838533e
remove ErrorPartsHandler as its correct behavior cannot be tested
sclassen Apr 28, 2020
93f1d10
merge multiple eager parts before validating
sclassen Apr 28, 2020
7a9ee3e
improve error message
sclassen Apr 28, 2020
52df3a9
add logging
sclassen Apr 30, 2020
69e8b4a
add logging to class loader
sclassen Apr 30, 2020
3fa676b
only log when there is something to log
sclassen Apr 30, 2020
ba65e34
better logging
sclassen Apr 30, 2020
7b3edfb
do not lazy load parts in findResources()
sclassen May 4, 2020
6406cae
add logging when a class or resource was not found
sclassen May 4, 2020
4009b53
log when a jar is added to the classloader
sclassen May 4, 2020
44ea276
wip
sclassen May 5, 2020
1bf5b5d
do not load parts which most likely will not contain the missing clas…
sclassen May 5, 2020
06b4d67
fix test
sclassen May 5, 2020
da249ac
fix tests
sclassen May 5, 2020
e3ad438
Merge branch 'master' into classloader-prototype
sclassen May 12, 2020
428f5cd
Merge branch 'master' into classloader-prototype
sclassen May 25, 2020
a01b1f8
Merge branch 'master' into classloader-prototype
sclassen May 25, 2020
48b143a
cleanup warnings
sclassen May 25, 2020
8a077f4
Merge pull request #632 from AdoptOpenJDK/multipleEagerParts
sclassen Jun 22, 2020
13cf867
Merge branch 'master' into classloader-prototype
sclassen Jun 26, 2020
f79a113
Merge branch 'master' into classloader-prototype
sclassen Jul 31, 2020
e7572f7
Merge branch 'master' into classloader-prototype
sclassen Jul 31, 2020
e481e80
reduce visibility
sclassen Jul 31, 2020
0249863
move method
sclassen Jul 31, 2020
eb8b136
add comments
sclassen Jul 31, 2020
c1a879a
move enum to be inner class of only client
sclassen Jul 31, 2020
c9b72d3
move method
sclassen Jul 31, 2020
6d5d718
remove unused field
sclassen Jul 31, 2020
36f8a29
extract local var
sclassen Jul 31, 2020
69eaa1e
Merge commit '2a23344db2359611c191f841c506cbf06ae6ce64' into mergeMaster
sclassen Sep 15, 2020
3d4cd2b
Merge branch 'master' into mergeMaster
sclassen Sep 15, 2020
d9e8829
do not fail when no JRE can be found
sclassen Oct 30, 2020
ea7b28c
Merge branch 'master' into classloader-prototype
sclassen Dec 5, 2020
86af159
set version to 3.0.0-alpha2
sclassen Dec 11, 2020
59d0d83
set version to 3.0.0-SNAPSHOT
sclassen Dec 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion artifact-all-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>net.adoptopenjdk</groupId>
<artifactId>icedtea-web-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down Expand Up @@ -49,6 +49,11 @@
<pattern>inet.ipaddr</pattern>
<shadedPattern>net.adoptopenjdk.icedteaweb.shaded.inet.ipaddr</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.code.gson</pattern>
<shadedPattern>net.adoptopenjdk.icedteaweb.shaded.com.google.code.gson
</shadedPattern>
</relocation>
<relocation>
<pattern>org.ccil.cowan.tagsoup</pattern>
<shadedPattern>net.adoptopenjdk.icedteaweb.shaded.tagsoup</shadedPattern>
Expand Down
2 changes: 1 addition & 1 deletion artifact-no-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>net.adoptopenjdk</groupId>
<artifactId>icedtea-web-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion clients/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>net.adoptopenjdk</groupId>
<artifactId>icedtea-web-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>net.adoptopenjdk</groupId>
<artifactId>icedtea-web-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.adoptopenjdk.icedteaweb.image;

import net.adoptopenjdk.icedteaweb.jdk89access.SunMiscLauncher;

import javax.swing.ImageIcon;

public enum ImageGallery {
INFO("net/adoptopenjdk/icedteaweb/image/info64.png"),
QUESTION("net/adoptopenjdk/icedteaweb/image/question64.png"),
WARNING("net/adoptopenjdk/icedteaweb/image/warn64.png"),
ERROR("net/adoptopenjdk/icedteaweb/image/error64.png"),
INFO_SMALL("net/adoptopenjdk/icedteaweb/image/info32.png"),
QUESTION_SMALL("net/adoptopenjdk/icedteaweb/image/question32.png"),
WARNING_SMALL("net/adoptopenjdk/icedteaweb/image/warn32.png"),
ERROR_SMALL("net/adoptopenjdk/icedteaweb/image/error32.png"),
LOGIN("net/adoptopenjdk/icedteaweb/image/login64.png");

private String path;

ImageGallery(String path) {
this.path = path;
}

public String path() {
return path;
}

public ImageIcon asImageIcon() {
return SunMiscLauncher.getSecureImageIcon(path);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.adoptopenjdk.icedteaweb.ui;

import java.awt.Color;

public interface ApplicationStyleConstants {
/*
* primary = use for text message decoration
* secondary = use for background decoration
*/
public static final Color PRIMARY_WARNING_COLOR = new Color(255, 124, 0);
public static final Color SECONDARY_WARNING_COLOR = new Color(255, 152, 0);
public static final Color PRIMARY_ERROR_COLOR = new Color(211, 47, 47);
public static final Color SECONDARY_ERROR_COLOR = new Color(244, 67, 54);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package net.adoptopenjdk.icedteaweb.ui.dialogs;

import net.adoptopenjdk.icedteaweb.Assert;

import javax.swing.JButton;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import java.util.function.Supplier;

public class DialogButton<R> {

private final String text;

private final Supplier<R> onAction;

private final String description;

private boolean enabled = true;

private List<Consumer<Boolean>> enabledObservers = new CopyOnWriteArrayList<>();

public DialogButton(final String text, final Supplier<R> onAction) {
this(text, onAction, null);
}

public DialogButton(final String text, final Supplier<R> onAction, final String description) {
this.text = Assert.requireNonBlank(text, "text");
this.onAction = Assert.requireNonNull(onAction, "onAction");
this.description = description;
}

public String getDescription() {
return description;
}

public String getText() {
return text;
}

public Supplier<R> getOnAction() {
return onAction;
}

public void setEnabled(final boolean enabled) {
this.enabled = enabled;
enabledObservers.forEach(o -> o.accept(enabled));
}

public boolean isEnabled() {
return enabled;
}

public JButton createButton(Consumer<R> actionResultConsumer) {
final JButton button = new JButton(getText());
if (getDescription() != null) {
button.setToolTipText(getDescription());
}
button.addActionListener(e -> {
final R result = getOnAction().get();
Optional.ofNullable(actionResultConsumer).ifPresent(c -> c.accept(result));
});
enabledObservers.add(b -> button.setEnabled(b));
button.setEnabled(isEnabled());
return button;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package net.adoptopenjdk.icedteaweb.ui.dialogs;

import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.Dialog;
import java.awt.Dimension;
import java.util.concurrent.CompletableFuture;

public abstract class DialogWithResult<R> extends JDialog {

private R result;

public DialogWithResult() {
this((Dialog) null);
}

public DialogWithResult(final Dialog owner) {
super(owner, true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(true);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}

protected abstract String createTitle();

protected abstract JPanel createContentPane();

protected void close(final R result) {
this.result = result;
this.setVisible(false);
this.dispose();
}

public Dimension getPreferredSize() {
return new Dimension(800, super.getPreferredSize().height);
}

public R showAndWait() {
if (SwingUtilities.isEventDispatchThread()) {
setTitle(createTitle());
getContentPane().removeAll();
getContentPane().add(createContentPane());
pack();
setLocationRelativeTo(null);
setVisible(true);
return result;
} else {
final CompletableFuture<R> result = new CompletableFuture<>();
try {
SwingUtilities.invokeAndWait(() -> {
pack();
final R r = showAndWait();
result.complete(r);
});
return result.get();
} catch (Exception e) {
throw new RuntimeException("Error in handling dialog!", e);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import net.adoptopenjdk.icedteaweb.logging.Logger;
import net.adoptopenjdk.icedteaweb.logging.LoggerFactory;

import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import java.awt.Component;
Expand Down Expand Up @@ -179,4 +180,15 @@ public void run() {
}
return window;
}

/**
* Some Swing components such as {@link JLabel} needs their text to be wrapped as HTML to get word wrap working.
* This method allows to wrap a given text with an html tag.
*
* @param s string to be wrapped to html tag
* @return
*/
public static String htmlWrap(String s) {
return "<html>" + s + "</html>";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
package net.adoptopenjdk.icedteaweb.ui.swing.dialogresults;

import java.util.EnumSet;
import java.util.Objects;

public class AccessWarningPaneComplexReturn implements DialogResult {

Expand Down Expand Up @@ -82,97 +81,6 @@ public static String allValues() {
}
}

public static class ShortcutResult {

public static ShortcutResult readValue(String s) {
if (s.trim().isEmpty()) {
return null;
}
String[] sq = s.split(",");
ShortcutResult sr = new ShortcutResult(Boolean.valueOf(sq[3]));
sr.browser = sq[0];
sr.fixHref = Boolean.parseBoolean(sq[1]);
if (!sq[2].equalsIgnoreCase("null")) {
sr.shortcutType = Shortcut.valueOf(sq[2]);
}
return sr;
}

public String writeValue() {
StringBuilder sb = new StringBuilder();
sb.append(browser).append(",")
.append(fixHref).append(",")
.append(shortcutType).append(",")
.append(create).append(",");
return sb.toString();
}

@Override
public boolean equals(Object obj) {
if (!(obj instanceof ShortcutResult)) {
return false;
}
ShortcutResult sr = (ShortcutResult) obj;
return this.create == sr.create && this.fixHref == sr.fixHref
&& this.browser.equals(sr.browser) && this.shortcutType == sr.shortcutType;
}

@Override
public int hashCode() {
int hash = 3;
hash = 89 * hash + Objects.hashCode(this.browser);
hash = 89 * hash + (this.fixHref ? 1 : 0);
hash = 89 * hash + Objects.hashCode(this.shortcutType);
hash = 89 * hash + (this.create ? 1 : 0);
return hash;
}

private String browser = "not_found_browser";
private boolean fixHref = false;
private Shortcut shortcutType = null;
private final boolean create;

ShortcutResult(String browser, boolean fixHref, Shortcut shortcutType, boolean create) {
this.browser = browser;
this.fixHref = fixHref;
this.shortcutType = shortcutType;
this.create = create;
}

public ShortcutResult(boolean create) {
this.create = create;
}

public boolean isCreate() {
return create;
}

public String getBrowser() {
return browser;
}

public Shortcut getShortcutType() {
return shortcutType;
}

public boolean isFixHref() {
return fixHref;
}

public void setBrowser(String browser) {
this.browser = browser;
}

public void setFixHref(boolean fixHref) {
this.fixHref = fixHref;
}

public void setShortcutType(Shortcut shortcutType) {
this.shortcutType = shortcutType;
}

}

private final YesNo regularReturn;
private ShortcutResult desktop;
private ShortcutResult menu;
Expand Down
Loading