@@ -28,6 +28,12 @@ public final class UITool {
28
28
* Size ratio of the pop-up window and its parent.
29
29
*/
30
30
public static final float POPUP_RATIO = 0.8f ;
31
+ /**
32
+ * Max length for tree node string.
33
+ *
34
+ * @see #left(String)
35
+ */
36
+ public static final int TREENODE_STRING_MAXLEN = 30 ;
31
37
32
38
private UITool () {
33
39
}
@@ -59,7 +65,8 @@ public static void generateTreeNodeDiff(
59
65
diffStr )));
60
66
}
61
67
62
- private static final Map <String , Icon > iconCache = new HashMap <>();
68
+ private static final Map <String , Icon > iconCache = new HashMap <>();
69
+
63
70
private static Icon icon (String url ) {
64
71
return iconCache .computeIfAbsent (url , k -> new ImageIcon (UITool .class .getResource (url )));
65
72
}
@@ -68,27 +75,19 @@ private static Icon icon(String url) {
68
75
* Icon for binary file.
69
76
*
70
77
* @return Icon for binary file
71
- * @see <a href="https://icons8.com/icon/38992/binary-file">Binary File</a> icon by <a href="https://icons8.com">Icons8</a>
78
+ * @see <a href="https://icons8.com/icon/38992/binary-file">Binary File</a>
79
+ * icon by <a href="https://icons8.com">Icons8</a>
72
80
*/
73
81
public static Icon icon4BinaryFile () {
74
82
return icon ("/image/icons8-binary-file-20.png" );
75
83
}
76
84
77
- /**
78
- * Icon for bytes.
79
- *
80
- * @return Icon for bytes
81
- * @see <a href="https://icons8.com/icon/62371/scart">Scart</a> icon by <a href="https://icons8.com">Icons8</a>
82
- */
83
- public static Icon icon4Bytes () {
84
- return icon ("/image/icons8-scart-16.png" );
85
- }
86
-
87
85
/**
88
86
* Icon for checksum.
89
87
*
90
88
* @return Icon for checksum
91
- * @see <a href="https://icons8.com/icon/sz8cPVwzLrMP/check-mark">Check Mark</a> icon by <a href="https://icons8.com">Icons8</a>
89
+ * @see <a href="https://icons8.com/icon/sz8cPVwzLrMP/check-mark">Check
90
+ * Mark</a> icon by <a href="https://icons8.com">Icons8</a>
92
91
*/
93
92
public static Icon icon4Checksum () {
94
93
return icon ("/image/icons8-check-mark-16.png" );
@@ -98,27 +97,40 @@ public static Icon icon4Checksum() {
98
97
* Icon for counter.
99
98
*
100
99
* @return Icon for counter
101
- * @see <a href="https://icons8.com/icon/2U6ROkjIrXIA/abacus">Abacus</a> icon by <a href="https://icons8.com">Icons8</a>
100
+ * @see <a href="https://icons8.com/icon/2U6ROkjIrXIA/abacus">Abacus</a>
101
+ * icon by <a href="https://icons8.com">Icons8</a>
102
102
*/
103
103
public static Icon icon4Counter () {
104
104
return icon ("/image/icons8-abacus-16.png" );
105
105
}
106
+
107
+ /**
108
+ * Icon for raw Data.
109
+ *
110
+ * @return Icon for raw data
111
+ * @see <a href="https://icons8.com/icon/84736/blockchain-technology">Blockchain Technology</a> icon by <a href="https://icons8.com">Icons8</a>
112
+ */
113
+ public static Icon icon4Data () {
114
+ return icon ("/image/icons8-blockchain-technology-16.png" );
115
+ }
106
116
107
117
/**
108
118
* Icon for DEX file.
109
119
*
110
120
* @return Icon for dex file
111
- * @see <a href="https://icons8.com/icon/38933/apk">APK</a> icon by <a href="https://icons8.com">Icons8</a>
121
+ * @see <a href="https://icons8.com/icon/38933/apk">APK</a> icon by
122
+ * <a href="https://icons8.com">Icons8</a>
112
123
*/
113
124
public static Icon icon4Dex () {
114
125
return icon ("/image/icons8-apk-20.png" );
115
126
}
116
-
127
+
117
128
/**
118
129
* Icon for endian.
119
130
*
120
131
* @return Icon for endian
121
- * @see <a href="https://icons8.com/icon/Xf1Gx1HbxVsm/up-down-arrow">Up Down Arrow</a> icon by <a href="https://icons8.com">Icons8</a>
132
+ * @see <a href="https://icons8.com/icon/Xf1Gx1HbxVsm/up-down-arrow">Up Down
133
+ * Arrow</a> icon by <a href="https://icons8.com">Icons8</a>
122
134
*/
123
135
public static Icon icon4Endian () {
124
136
return icon ("/image/icons8-up-down-arrow-16.png" );
@@ -128,12 +140,23 @@ public static Icon icon4Endian() {
128
140
* Icon for length.
129
141
*
130
142
* @return Icon for length
131
- * @see <a href="https://icons8.com/icon/44699/length">Length</a> icon by <a href="https://icons8.com">Icons8</a>
143
+ * @see <a href="https://icons8.com/icon/44699/length">Length</a> icon by
144
+ * <a href="https://icons8.com">Icons8</a>
132
145
*/
133
146
public static Icon icon4Length () {
134
147
return icon ("/image/icons8-length-16.png" );
135
148
}
136
149
150
+ /**
151
+ * Icon for Index.
152
+ *
153
+ * @return Icon for Index
154
+ * @see <a href="https://icons8.com/icon/79485/one-finger">One Finger</a> icon by <a href="https://icons8.com">Icons8</a>
155
+ */
156
+ public static Icon icon4Index () {
157
+ return icon ("/image/icons8-one-finger-16.png" );
158
+ }
159
+
137
160
/**
138
161
* Icon for Java.
139
162
*
@@ -142,34 +165,56 @@ public static Icon icon4Length() {
142
165
public static Icon icon4Java () {
143
166
return icon ("/image/icons8-java-20.png" );
144
167
}
145
-
168
+
146
169
/**
147
170
* Icon for Offset / Location / Index.
148
171
*
149
172
* @return Icon for Offset
150
- * @see <a href="https://icons8.com/icon/2gsR2g07AQvu/map-pin">Map Pin</a> icon by <a href="https://icons8.com">Icons8</a>
173
+ * @see <a href="https://icons8.com/icon/2gsR2g07AQvu/map-pin">Map Pin</a>
174
+ * icon by <a href="https://icons8.com">Icons8</a>
151
175
*/
152
176
public static Icon icon4Offset () {
153
177
return icon ("/image/icons8-map-pin-16.png" );
154
178
}
155
179
180
+ /**
181
+ * Icon for parameter, of a method.
182
+ *
183
+ * @return Icon for Offset
184
+ * @see <a href="https://icons8.com/icon/Pohj4RQVOJYd/filter">Filter</a> icon by <a href="https://icons8.com">Icons8</a>
185
+ */
186
+ public static Icon icon4Parameter () {
187
+ return icon ("/image/icons8-filter-16.png" );
188
+ }
189
+
156
190
/**
157
191
* Icon for magic number.
158
192
*
159
193
* @return Icon for magic number
160
- * @see <a href="https://icons8.com/icon/q8t3iE9rg6YF/magic-wand">Magic Wand</a> icon by <a href="https://icons8.com">Icons8</a>
194
+ * @see <a href="https://icons8.com/icon/q8t3iE9rg6YF/magic-wand">Magic
195
+ * Wand</a> icon by <a href="https://icons8.com">Icons8</a>
161
196
*/
162
197
public static Icon icon4Magic () {
163
198
return icon ("/image/icons8-magic-wand-16.png" );
164
199
}
165
200
201
+ /**
202
+ * Icon for return type, of a method.
203
+ *
204
+ * @return return type icon
205
+ *
206
+ * @see <a href="https://icons8.com/icon/13107/return">Return</a> icon by <a href="https://icons8.com">Icons8</a>
207
+ */
208
+ public static Icon icon4Return () {
209
+ return icon ("/image/icons8-return-16.png" );
210
+ }
211
+
166
212
/**
167
213
* Icon for shortcut.
168
214
*
169
215
* @return Shortcut icon
170
216
*
171
- * @see <a href="https://icons8.com/icon/78265/shortcut">Shortcut</a> icon
172
- * by <a href="https://icons8.com">Icons8</a>
217
+ * @see <a href="https://icons8.com/icon/i1z7pQ2orcJk/shortcut">Shortcut</a> icon by <a href="https://icons8.com">Icons8</a>
173
218
*/
174
219
public static Icon icon4Shortcut () {
175
220
return icon ("/image/icons8-shortcut-16.png" );
@@ -179,28 +224,31 @@ public static Icon icon4Shortcut() {
179
224
* Icon for signature.
180
225
*
181
226
* @return Icon for signature
182
- * @see <a href="https://icons8.com/icon/bmicUxC0XDNt/signature">Signature</a> icon by <a href="https://icons8.com">Icons8</a>
227
+ * @see
228
+ * <a href="https://icons8.com/icon/bmicUxC0XDNt/signature">Signature</a>
229
+ * icon by <a href="https://icons8.com">Icons8</a>
183
230
*/
184
231
public static Icon icon4Signature () {
185
232
return icon ("/image/icons8-signature-16.png" );
186
233
}
187
-
234
+
188
235
/**
189
236
* Icon for Size.
190
- *
237
+ *
191
238
* @return Shortcut icon
192
- * @see <a href="https://icons8.com/icon/d8VomliGByyY/page-size">Page Size</a> icon by <a href="https://icons8.com">Icons8</a>
239
+ * @see <a href="https://icons8.com/icon/d8VomliGByyY/page-size">Page
240
+ * Size</a> icon by <a href="https://icons8.com">Icons8</a>
193
241
*/
194
242
public static Icon icon4Size () {
195
243
return icon ("/image/icons8-page-size-16.png" );
196
244
}
197
245
198
-
199
246
/**
200
247
* Icon for tag.
201
- *
248
+ *
202
249
* @return tag icon
203
- * @see <a href="https://icons8.com/icon/pmzH4rF8Lrv9/tag">Tag</a> icon by <a href="https://icons8.com">Icons8</a>
250
+ * @see <a href="https://icons8.com/icon/pmzH4rF8Lrv9/tag">Tag</a> icon by
251
+ * <a href="https://icons8.com">Icons8</a>
204
252
*/
205
253
public static Icon icon4Tag () {
206
254
return icon ("/image/icons8-tag-16.png" );
@@ -210,13 +258,42 @@ public static Icon icon4Tag() {
210
258
* Icon for version.
211
259
*
212
260
* @return Icon for versions
213
- * @see <a href="https://icons8.com/icon/21933/versions">Versions</a> icon by <a href="https://icons8.com">Icons8</a>
214
- * @see <a href="https://icons8.com/icon/59954/versions">Versions</a> icon by <a href="https://icons8.com">Icons8</a>
261
+ * @see <a href="https://icons8.com/icon/21933/versions">Versions</a> icon
262
+ * by <a href="https://icons8.com">Icons8</a>
263
+ * @see <a href="https://icons8.com/icon/59954/versions">Versions</a> icon
264
+ * by <a href="https://icons8.com">Icons8</a>
215
265
*/
216
266
public static Icon icon4Versions () {
217
267
return icon ("/image/icons8-versions-16.png" );
218
268
}
219
269
270
+ /**
271
+ * Get left part of string for tree node.
272
+ *
273
+ * @param s The String to get left part
274
+ * @return Left part of string
275
+ */
276
+ public static String left (String s ) {
277
+ return left (s , TREENODE_STRING_MAXLEN );
278
+ }
279
+
280
+ /**
281
+ * Get left part of string.
282
+ *
283
+ * @param s The String to get left part
284
+ * @param length Length to get
285
+ * @return Left part of string
286
+ */
287
+ public static String left (String s , int length ) {
288
+ if (s == null ) {
289
+ return s ;
290
+ } else if (s .length () < length ) {
291
+ return s ;
292
+ } else {
293
+ return s .substring (0 , length - 1 ) + " ..." ;
294
+ }
295
+ }
296
+
220
297
/**
221
298
* Show a popup window with given message.
222
299
*
0 commit comments