29
29
30
30
package cc .arduino .view .preferences ;
31
31
32
- import com .google .common .base .Function ;
33
32
import com .google .common .base .Joiner ;
34
- import com .google .common .base .Predicate ;
35
33
import com .google .common .collect .FluentIterable ;
36
34
import processing .app .Base ;
37
35
@@ -53,13 +51,7 @@ public AdditionalBoardsManagerURLTextArea(Window parent) {
53
51
initComponents ();
54
52
setLocationRelativeTo (parent );
55
53
56
- Base .registerWindowCloseKeys (getRootPane (), new ActionListener () {
57
- @ Override
58
- public void actionPerformed (ActionEvent e ) {
59
- cancelActionPerformed (e );
60
- }
61
- });
62
-
54
+ Base .registerWindowCloseKeys (getRootPane (), this ::cancelActionPerformed );
63
55
}
64
56
65
57
/**
@@ -75,6 +67,7 @@ private void initComponents() {
75
67
javax .swing .JButton cancel = new javax .swing .JButton ();
76
68
javax .swing .JButton ok = new javax .swing .JButton ();
77
69
javax .swing .JLabel jLabel1 = new javax .swing .JLabel ();
70
+ unofficialListURLLabel = new javax .swing .JLabel ();
78
71
79
72
setDefaultCloseOperation (javax .swing .WindowConstants .DISPOSE_ON_CLOSE );
80
73
setTitle (_ ("Additional Boards Manager URLs" ));
@@ -102,6 +95,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
102
95
103
96
jLabel1 .setText (_ ("Enter additional URLs, one for each row" ));
104
97
98
+ unofficialListURLLabel .setText (_ ("Click for a list of unofficial boards support URLs" ));
99
+ unofficialListURLLabel .setCursor (new java .awt .Cursor (java .awt .Cursor .HAND_CURSOR ));
100
+ unofficialListURLLabel .addMouseListener (new java .awt .event .MouseAdapter () {
101
+ public void mouseClicked (java .awt .event .MouseEvent evt ) {
102
+ unofficialListURLLabelMouseClicked (evt );
103
+ }
104
+
105
+ public void mouseExited (java .awt .event .MouseEvent evt ) {
106
+ unofficialListURLLabelMouseExited (evt );
107
+ }
108
+
109
+ public void mouseEntered (java .awt .event .MouseEvent evt ) {
110
+ unofficialListURLLabelMouseEntered (evt );
111
+ }
112
+ });
113
+
105
114
javax .swing .GroupLayout layout = new javax .swing .GroupLayout (getContentPane ());
106
115
getContentPane ().setLayout (layout );
107
116
layout .setHorizontalGroup (
@@ -110,13 +119,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
110
119
.addContainerGap ()
111
120
.addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING )
112
121
.addGroup (layout .createSequentialGroup ()
113
- .addGap (0 , 332 , Short .MAX_VALUE )
122
+ .addGap (0 , 0 , Short .MAX_VALUE )
114
123
.addComponent (ok )
115
124
.addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
116
125
.addComponent (cancel ))
117
- .addComponent (jScrollPane1 )
126
+ .addComponent (jScrollPane1 , javax . swing . GroupLayout . DEFAULT_SIZE , 538 , Short . MAX_VALUE )
118
127
.addGroup (layout .createSequentialGroup ()
119
- .addComponent (jLabel1 )
128
+ .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING )
129
+ .addComponent (jLabel1 )
130
+ .addComponent (unofficialListURLLabel ))
120
131
.addGap (0 , 0 , Short .MAX_VALUE )))
121
132
.addContainerGap ())
122
133
);
@@ -126,12 +137,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
126
137
.addContainerGap ()
127
138
.addComponent (jLabel1 )
128
139
.addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
129
- .addComponent (jScrollPane1 , javax .swing .GroupLayout .DEFAULT_SIZE , 118 , Short .MAX_VALUE )
140
+ .addComponent (jScrollPane1 , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE )
141
+ .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
142
+ .addComponent (unofficialListURLLabel )
130
143
.addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
131
144
.addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .BASELINE )
132
- .addComponent (cancel )
133
- .addComponent (ok ))
134
- .addContainerGap ())
145
+ .addComponent (ok )
146
+ .addComponent (cancel ))
147
+ .addContainerGap (javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ))
135
148
);
136
149
137
150
pack ();
@@ -147,24 +160,26 @@ private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:even
147
160
cancelActionPerformed (evt );
148
161
}//GEN-LAST:event_okActionPerformed
149
162
163
+ private void unofficialListURLLabelMouseEntered (java .awt .event .MouseEvent evt ) {//GEN-FIRST:event_unofficialListURLLabelMouseEntered
164
+ unofficialListURLLabel .setForeground (new Color (0 , 0 , 140 ));
165
+ }//GEN-LAST:event_unofficialListURLLabelMouseEntered
166
+
167
+ private void unofficialListURLLabelMouseExited (java .awt .event .MouseEvent evt ) {//GEN-FIRST:event_unofficialListURLLabelMouseExited
168
+ unofficialListURLLabel .setForeground (new Color (76 , 76 , 76 ));
169
+ }//GEN-LAST:event_unofficialListURLLabelMouseExited
170
+
171
+ private void unofficialListURLLabelMouseClicked (java .awt .event .MouseEvent evt ) {//GEN-FIRST:event_unofficialListURLLabelMouseClicked
172
+ Base .openURL ("https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls" );
173
+ }//GEN-LAST:event_unofficialListURLLabelMouseClicked
174
+
150
175
public void setText (String text ) {
151
176
Collection <String > urls = splitAndTrim (text , "," );
152
177
additionalBoardsManagerURLs .setText (Joiner .on ("\n " ).skipNulls ().join (urls ));
153
178
}
154
179
155
180
private Collection <String > splitAndTrim (String text , String separator ) {
156
181
Collection <String > urls = Arrays .asList (text .split (separator ));
157
- return FluentIterable .from (urls ).transform (new Function <String , String >() {
158
- @ Override
159
- public String apply (String input ) {
160
- return input .trim ();
161
- }
162
- }).filter (new Predicate <String >() {
163
- @ Override
164
- public boolean apply (String input ) {
165
- return !input .isEmpty ();
166
- }
167
- }).toList ();
182
+ return FluentIterable .from (urls ).transform (String ::trim ).filter (url -> !url .isEmpty ()).toList ();
168
183
}
169
184
170
185
public String getText () {
@@ -174,6 +189,7 @@ public String getText() {
174
189
175
190
// Variables declaration - do not modify//GEN-BEGIN:variables
176
191
private final javax .swing .JTextArea additionalBoardsManagerURLs = new javax .swing .JTextArea ();
192
+ private javax .swing .JLabel unofficialListURLLabel ;
177
193
// End of variables declaration//GEN-END:variables
178
194
179
195
public void onOk (ActionListener listener ) {
0 commit comments