| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.gui; |
| 22 |
|
|
| 23 |
|
import jalview.io.packed.DataProvider.JvDataType; |
| 24 |
|
import jalview.jbgui.GRestServiceEditorPane; |
| 25 |
|
import jalview.util.MessageManager; |
| 26 |
|
import jalview.ws.rest.InputType; |
| 27 |
|
import jalview.ws.rest.RestServiceDescription; |
| 28 |
|
|
| 29 |
|
import java.awt.BorderLayout; |
| 30 |
|
import java.awt.FlowLayout; |
| 31 |
|
import java.awt.event.ActionEvent; |
| 32 |
|
import java.awt.event.ActionListener; |
| 33 |
|
import java.awt.event.ComponentEvent; |
| 34 |
|
import java.awt.event.ComponentListener; |
| 35 |
|
import java.awt.event.KeyEvent; |
| 36 |
|
import java.awt.event.KeyListener; |
| 37 |
|
import java.awt.event.MouseEvent; |
| 38 |
|
import java.util.HashMap; |
| 39 |
|
import java.util.List; |
| 40 |
|
import java.util.Map; |
| 41 |
|
import java.util.Vector; |
| 42 |
|
import java.util.regex.Matcher; |
| 43 |
|
import java.util.regex.Pattern; |
| 44 |
|
|
| 45 |
|
import javax.swing.JFrame; |
| 46 |
|
import javax.swing.JMenuItem; |
| 47 |
|
import javax.swing.JPanel; |
| 48 |
|
import javax.swing.JPopupMenu; |
| 49 |
|
import javax.swing.event.ChangeEvent; |
| 50 |
|
import javax.swing.event.ChangeListener; |
| 51 |
|
|
| |
|
| 0% |
Uncovered Elements: 262 (262) |
Complexity: 63 |
Complexity Density: 0.36 |
|
| 52 |
|
public class RestServiceEditorPane extends GRestServiceEditorPane |
| 53 |
|
{ |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
jalview.ws.rest.RestServiceDescription currentservice = null; |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
jalview.ws.rest.RestServiceDescription oldservice = null; |
| 64 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 65 |
0 |
public RestServiceEditorPane()... |
| 66 |
|
{ |
| 67 |
0 |
super(); |
| 68 |
|
|
| 69 |
0 |
urldesc.addKeyListener(new KeyListener() |
| 70 |
|
{ |
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 71 |
0 |
@Override... |
| 72 |
|
public void keyTyped(KeyEvent e) |
| 73 |
|
{ |
| 74 |
|
} |
| 75 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 76 |
0 |
@Override... |
| 77 |
|
public void keyReleased(KeyEvent e) |
| 78 |
|
{ |
| 79 |
0 |
refreshCutnPaste(true); |
| 80 |
|
} |
| 81 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 82 |
0 |
@Override... |
| 83 |
|
public void keyPressed(KeyEvent e) |
| 84 |
|
{ |
| 85 |
|
|
| 86 |
|
} |
| 87 |
|
}); |
| 88 |
0 |
panels.addChangeListener(new ChangeListener() |
| 89 |
|
{ |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
Object lastComp; |
| 96 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 97 |
0 |
@Override... |
| 98 |
|
public void stateChanged(ChangeEvent e) |
| 99 |
|
{ |
| 100 |
0 |
if (lastComp != paste) |
| 101 |
|
{ |
| 102 |
0 |
updateServiceFromGui(); |
| 103 |
0 |
refreshCutnPaste(false); |
| 104 |
|
} |
| 105 |
|
else |
| 106 |
|
{ |
| 107 |
0 |
refreshCutnPaste(true); |
| 108 |
|
} |
| 109 |
0 |
lastComp = panels.getSelectedComponent(); |
| 110 |
|
|
| 111 |
|
} |
| 112 |
|
}); |
| 113 |
0 |
currentservice = new RestServiceDescription("Analysis", |
| 114 |
|
"service description", "service name", "http://localhost/", "", |
| 115 |
|
null, false, false, '-'); |
| 116 |
0 |
initGuiWith(currentservice); |
| 117 |
0 |
refreshCutnPaste(false); |
| 118 |
0 |
updateButtons(); |
| 119 |
|
} |
| 120 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 121 |
0 |
public RestServiceEditorPane(RestServiceDescription toedit)... |
| 122 |
|
{ |
| 123 |
0 |
this(); |
| 124 |
0 |
oldservice = toedit; |
| 125 |
0 |
if (oldservice != null) |
| 126 |
|
{ |
| 127 |
0 |
currentservice = new RestServiceDescription(toedit); |
| 128 |
|
} |
| 129 |
|
else |
| 130 |
|
{ |
| 131 |
0 |
currentservice = new RestServiceDescription("Analysis", |
| 132 |
|
"service description", "service name", "http://localhost/", |
| 133 |
|
"", null, false, false, '-'); |
| 134 |
|
} |
| 135 |
0 |
initGuiWith(currentservice); |
| 136 |
0 |
refreshCutnPaste(false); |
| 137 |
0 |
updateButtons(); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 143 |
0 |
public void updateButtons()... |
| 144 |
|
{ |
| 145 |
0 |
cancelButton.setEnabled(true); |
| 146 |
0 |
okButton.setEnabled(currentservice != null && currentservice.isValid()); |
| 147 |
|
|
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
Vector<String> _iparam = new Vector<>(); |
| 151 |
|
|
| 152 |
|
Vector<String> _rparam = new Vector<>(); |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
| 157 |
|
|
| 158 |
|
@param |
| 159 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 2 |
Complexity Density: 0.07 |
|
| 160 |
0 |
private void initGuiWith(RestServiceDescription currentservice)... |
| 161 |
|
{ |
| 162 |
0 |
_iparam.clear(); |
| 163 |
0 |
_rparam.clear(); |
| 164 |
0 |
action.removeAllItems(); |
| 165 |
0 |
action.addItem("Alignment"); |
| 166 |
0 |
action.addItem("Analysis"); |
| 167 |
0 |
gapChar.removeAllItems(); |
| 168 |
0 |
gapChar.addItem("."); |
| 169 |
0 |
gapChar.addItem(" "); |
| 170 |
0 |
gapChar.addItem("-"); |
| 171 |
0 |
if (currentservice == null) |
| 172 |
|
{ |
| 173 |
0 |
name.setText(""); |
| 174 |
0 |
descr.setText(""); |
| 175 |
0 |
url.setText(""); |
| 176 |
0 |
urlsuff.setText(""); |
| 177 |
0 |
action.setSelectedItem("Analysis"); |
| 178 |
0 |
gapChar.setSelectedItem("-"); |
| 179 |
|
} |
| 180 |
|
else |
| 181 |
|
{ |
| 182 |
0 |
name.setText(currentservice.getName()); |
| 183 |
0 |
descr.setText(currentservice.getDescription()); |
| 184 |
0 |
url.setText(currentservice.getPostUrl()); |
| 185 |
0 |
urlsuff.setText(currentservice.getUrlSuffix()); |
| 186 |
0 |
for (Map.Entry<String, InputType> inparam : currentservice |
| 187 |
|
.getInputParams().entrySet()) |
| 188 |
|
{ |
| 189 |
0 |
_iparam.add(inparam.getKey() + " " |
| 190 |
|
+ inparam.getValue().getURLtokenPrefix() + ":" |
| 191 |
|
+ inparam.getValue().getURLEncodedParameter().toString()); |
| 192 |
|
} |
| 193 |
|
|
| 194 |
0 |
for (JvDataType oparam : currentservice.getResultDataTypes()) |
| 195 |
|
{ |
| 196 |
0 |
_rparam.add(oparam.name()); |
| 197 |
|
} |
| 198 |
0 |
iprms.setListData(_iparam); |
| 199 |
0 |
rdata.setListData(_rparam); |
| 200 |
|
|
| 201 |
0 |
action.setSelectedItem(currentservice.getAction()); |
| 202 |
|
|
| 203 |
0 |
gapChar.setSelectedItem("" + currentservice.getGapCharacter()); |
| 204 |
|
} |
| 205 |
0 |
revalidate(); |
| 206 |
|
} |
| 207 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 208 |
0 |
private String getSelectedInputToken()... |
| 209 |
|
{ |
| 210 |
0 |
if (iprms.getSelectedIndex() > -1) |
| 211 |
|
{ |
| 212 |
0 |
String toktoedit = (String) iprms.getSelectedValue(); |
| 213 |
0 |
toktoedit = toktoedit.substring(0, toktoedit.indexOf(" ")); |
| 214 |
0 |
return toktoedit; |
| 215 |
|
} |
| 216 |
0 |
return null; |
| 217 |
|
} |
| 218 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 219 |
0 |
@Override... |
| 220 |
|
protected void iprmListSelection_doubleClicked() |
| 221 |
|
{ |
| 222 |
0 |
String toktoedit = getSelectedInputToken(); |
| 223 |
0 |
if (toktoedit != null) |
| 224 |
|
{ |
| 225 |
0 |
InputType toedit = currentservice.getInputParams().get(toktoedit); |
| 226 |
0 |
String oldParam = toktoedit; |
| 227 |
0 |
RestInputParamEditDialog dialog = new RestInputParamEditDialog(this, |
| 228 |
|
currentservice, toedit); |
| 229 |
0 |
if (dialog.wasUpdated()) |
| 230 |
|
{ |
| 231 |
0 |
currentservice.getInputParams().remove(oldParam); |
| 232 |
0 |
currentservice.getInputParams().put(dialog.current.token, |
| 233 |
|
dialog.current); |
| 234 |
0 |
initGuiWith(currentservice); |
| 235 |
|
} |
| 236 |
|
|
| 237 |
|
} |
| 238 |
|
} |
| 239 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 240 |
0 |
@Override... |
| 241 |
|
protected void iprmsAdd_actionPerformed(ActionEvent e) |
| 242 |
|
{ |
| 243 |
0 |
RestInputParamEditDialog dialog = new RestInputParamEditDialog(this, |
| 244 |
|
currentservice, |
| 245 |
|
"param" + (1 + currentservice.getInputParams().size())); |
| 246 |
0 |
if (dialog.wasUpdated()) |
| 247 |
|
{ |
| 248 |
0 |
currentservice.getInputParams().put(dialog.current.token, |
| 249 |
|
dialog.current); |
| 250 |
0 |
initGuiWith(currentservice); |
| 251 |
|
} |
| 252 |
|
|
| 253 |
|
} |
| 254 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 255 |
0 |
@Override... |
| 256 |
|
protected void iprmsRem_actionPerformed(ActionEvent e) |
| 257 |
|
{ |
| 258 |
0 |
String toktoedit = getSelectedInputToken(); |
| 259 |
0 |
if (toktoedit != null) |
| 260 |
|
{ |
| 261 |
0 |
currentservice.getInputParams().remove(toktoedit); |
| 262 |
0 |
initGuiWith(currentservice); |
| 263 |
|
|
| 264 |
|
} |
| 265 |
|
} |
| 266 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 267 |
0 |
@Override... |
| 268 |
|
protected void rdata_rightClicked(MouseEvent mouse) |
| 269 |
|
{ |
| 270 |
0 |
final int rdatasel = rdata.getSelectedIndex(); |
| 271 |
0 |
if (rdatasel > -1) |
| 272 |
|
{ |
| 273 |
0 |
JPopupMenu popup = new JPopupMenu( |
| 274 |
|
MessageManager.getString("label.select_return_type")); |
| 275 |
0 |
for (final JvDataType type : JvDataType.values()) |
| 276 |
|
{ |
| 277 |
0 |
popup.add(new JMenuItem(type.name())) |
| 278 |
|
.addActionListener(new ActionListener() |
| 279 |
|
{ |
| 280 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 281 |
0 |
@Override... |
| 282 |
|
public void actionPerformed(ActionEvent e) |
| 283 |
|
{ |
| 284 |
0 |
currentservice.getResultDataTypes().set(rdatasel, type); |
| 285 |
0 |
initGuiWith(currentservice); |
| 286 |
0 |
rdata.setSelectedIndex(rdatasel); |
| 287 |
|
} |
| 288 |
|
}); |
| 289 |
|
} |
| 290 |
0 |
popup.show(rdata, mouse.getX(), mouse.getY()); |
| 291 |
|
} |
| 292 |
|
} |
| 293 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 294 |
0 |
@Override... |
| 295 |
|
protected void rdataAdd_actionPerformed(ActionEvent e) |
| 296 |
|
{ |
| 297 |
0 |
int p; |
| 298 |
0 |
if ((p = rdata.getSelectedIndex()) > -1) |
| 299 |
|
{ |
| 300 |
0 |
currentservice.getResultDataTypes().add(p + 1, JvDataType.ANNOTATION); |
| 301 |
|
} |
| 302 |
|
else |
| 303 |
|
{ |
| 304 |
0 |
currentservice.addResultDatatype(JvDataType.ANNOTATION); |
| 305 |
|
} |
| 306 |
0 |
initGuiWith(currentservice); |
| 307 |
0 |
rdata.setSelectedIndex( |
| 308 |
0 |
p == -1 ? currentservice.getResultDataTypes().size() - 1 |
| 309 |
|
: p + 1); |
| 310 |
|
} |
| 311 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 312 |
0 |
@Override... |
| 313 |
|
protected void rdataNdown_actionPerformed(ActionEvent e) |
| 314 |
|
{ |
| 315 |
0 |
int p; |
| 316 |
0 |
if ((p = rdata.getSelectedIndex()) > -1 && p < _rparam.size() - 1) |
| 317 |
|
{ |
| 318 |
0 |
List<JvDataType> rtypes = currentservice.getResultDataTypes(); |
| 319 |
0 |
JvDataType below = rtypes.get(p + 1); |
| 320 |
0 |
rtypes.set(p + 1, rtypes.get(p)); |
| 321 |
0 |
rtypes.set(p, below); |
| 322 |
0 |
initGuiWith(currentservice); |
| 323 |
0 |
rdata.setSelectedIndex(p + 1); |
| 324 |
|
} |
| 325 |
|
} |
| 326 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 327 |
0 |
@Override... |
| 328 |
|
protected void rdataNup_actionPerformed(ActionEvent e) |
| 329 |
|
{ |
| 330 |
0 |
int p; |
| 331 |
0 |
if ((p = rdata.getSelectedIndex()) > 0) |
| 332 |
|
{ |
| 333 |
0 |
List<JvDataType> rtypes = currentservice.getResultDataTypes(); |
| 334 |
0 |
JvDataType above = rtypes.get(p - 1); |
| 335 |
0 |
rtypes.set(p - 1, rtypes.get(p)); |
| 336 |
0 |
rtypes.set(p, above); |
| 337 |
0 |
initGuiWith(currentservice); |
| 338 |
0 |
rdata.setSelectedIndex(p - 1); |
| 339 |
|
} |
| 340 |
|
} |
| 341 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 342 |
0 |
@Override... |
| 343 |
|
protected void rdataRem_actionPerformed(ActionEvent e) |
| 344 |
|
{ |
| 345 |
0 |
if (rdata.getSelectedIndex() > -1) |
| 346 |
|
{ |
| 347 |
0 |
currentservice.getResultDataTypes().remove(rdata.getSelectedIndex()); |
| 348 |
0 |
initGuiWith(currentservice); |
| 349 |
|
} |
| 350 |
|
} |
| 351 |
|
|
| |
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 6 |
Complexity Density: 0.3 |
|
| 352 |
0 |
private boolean updateServiceFromGui()... |
| 353 |
|
{ |
| 354 |
0 |
Map<String, InputType> inputTypes = new HashMap<>(); |
| 355 |
0 |
StringBuffer warnings = new StringBuffer(); |
| 356 |
0 |
for (String its : _iparam) |
| 357 |
|
{ |
| 358 |
0 |
Matcher mtch = Pattern.compile("(\\S+)\\s(\\S+):\\[(.+)]") |
| 359 |
|
.matcher(its); |
| 360 |
0 |
if (mtch.find()) |
| 361 |
|
{ |
| 362 |
0 |
if (!RestServiceDescription.parseTypeString( |
| 363 |
|
mtch.group(2) + ":" + mtch.group(3), mtch.group(1), |
| 364 |
|
mtch.group(2), mtch.group(3), inputTypes, warnings)) |
| 365 |
|
{ |
| 366 |
0 |
jalview.bin.Console.errPrintln( |
| 367 |
|
"IMPLEMENTATION PROBLEM: Cannot parse RestService input parameter string '" |
| 368 |
|
+ its + "'" + "\n" + warnings); |
| 369 |
|
} |
| 370 |
|
} |
| 371 |
|
} |
| 372 |
0 |
char gc = gapChar.getSelectedItem() == null ? ' ' |
| 373 |
|
: ((String) gapChar.getSelectedItem()).charAt(0); |
| 374 |
0 |
RestServiceDescription newService = new RestServiceDescription( |
| 375 |
|
(String) action.getSelectedItem(), descr.getText().trim(), |
| 376 |
|
name.getText().trim(), url.getText().trim(), |
| 377 |
|
urlsuff.getText().trim(), inputTypes, hSeparable.isSelected(), |
| 378 |
|
vSeparable.isSelected(), gc); |
| 379 |
|
|
| 380 |
0 |
if (newService.isValid()) |
| 381 |
|
{ |
| 382 |
0 |
for (String its : _rparam) |
| 383 |
|
{ |
| 384 |
0 |
JvDataType dtype; |
| 385 |
0 |
try |
| 386 |
|
{ |
| 387 |
0 |
dtype = JvDataType.valueOf(its); |
| 388 |
0 |
newService.addResultDatatype(dtype); |
| 389 |
|
} catch (Throwable x) |
| 390 |
|
{ |
| 391 |
|
|
| 392 |
0 |
jalview.bin.Console.errPrintln( |
| 393 |
|
"IMPLEMENTATION PROBLEM: Cannot parse RestService output parameter string '" |
| 394 |
|
+ its + "'" + "\n" + warnings); |
| 395 |
|
} |
| 396 |
|
} |
| 397 |
0 |
currentservice = newService; |
| 398 |
0 |
return true; |
| 399 |
|
} |
| 400 |
|
else |
| 401 |
|
{ |
| 402 |
0 |
jalview.bin.Console.errPrintln( |
| 403 |
|
"IMPLEMENTATION PROBLEM: Restservice generated from GUI is invalid\n" |
| 404 |
|
+ warnings); |
| 405 |
|
|
| 406 |
|
} |
| 407 |
0 |
return false; |
| 408 |
|
} |
| 409 |
|
|
| |
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 7 |
Complexity Density: 0.37 |
|
| 410 |
0 |
protected void refreshCutnPaste(boolean reparse)... |
| 411 |
|
{ |
| 412 |
0 |
if (!reparse && currentservice.isValid()) |
| 413 |
|
{ |
| 414 |
0 |
urldesc.setText(currentservice.toString()); |
| 415 |
0 |
parseWarnings.setVisible(false); |
| 416 |
|
} |
| 417 |
|
else |
| 418 |
|
{ |
| 419 |
0 |
if (reparse) |
| 420 |
|
{ |
| 421 |
0 |
String txt = urldesc.getText().trim(); |
| 422 |
0 |
if (txt.length() > 0) |
| 423 |
|
{ |
| 424 |
0 |
RestServiceDescription rsd = null; |
| 425 |
0 |
try |
| 426 |
|
{ |
| 427 |
0 |
rsd = new RestServiceDescription(txt); |
| 428 |
0 |
if (rsd.isValid()) |
| 429 |
|
{ |
| 430 |
0 |
parseWarnings.setVisible(false); |
| 431 |
0 |
parseRes.setText(""); |
| 432 |
0 |
initGuiWith(currentservice = rsd); |
| 433 |
|
} |
| 434 |
|
else |
| 435 |
|
{ |
| 436 |
0 |
parseRes.setText(MessageManager.formatMessage( |
| 437 |
|
"label.parsing_failed_syntax_errors_shown_below_param", |
| 438 |
|
new String[] |
| 439 |
|
{ rsd.getInvalidMessage() })); |
| 440 |
0 |
parseWarnings.setVisible(true); |
| 441 |
|
} |
| 442 |
|
} catch (Throwable e) |
| 443 |
|
{ |
| 444 |
0 |
e.printStackTrace(); |
| 445 |
0 |
parseRes.setText(MessageManager.formatMessage( |
| 446 |
|
"label.parsing_failed_unrecoverable_exception_thrown_param", |
| 447 |
|
new String[] |
| 448 |
|
{ e.toString() })); |
| 449 |
0 |
parseWarnings.setVisible(true); |
| 450 |
|
} |
| 451 |
|
} |
| 452 |
0 |
paste.revalidate(); |
| 453 |
|
} |
| 454 |
|
} |
| 455 |
|
|
| 456 |
|
} |
| 457 |
|
|
| 458 |
|
|
| 459 |
|
|
| 460 |
|
@param |
| 461 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 462 |
0 |
public static void main(String[] args)... |
| 463 |
|
{ |
| 464 |
0 |
if (args.length == 0) |
| 465 |
|
{ |
| 466 |
0 |
new Thread(new Runnable() |
| 467 |
|
{ |
| 468 |
|
boolean visible = true; |
| 469 |
|
|
| |
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.38 |
|
| 470 |
0 |
@Override... |
| 471 |
|
public void run() |
| 472 |
|
{ |
| 473 |
0 |
boolean nulserv = true; |
| 474 |
0 |
while (visible) |
| 475 |
|
{ |
| 476 |
0 |
final Thread runner = Thread.currentThread(); |
| 477 |
0 |
JFrame df = new JFrame(); |
| 478 |
0 |
df.getContentPane().setLayout(new BorderLayout()); |
| 479 |
0 |
df.getContentPane().add((nulserv = !nulserv) |
| 480 |
|
? new RestServiceEditorPane(jalview.ws.rest.RestClient |
| 481 |
|
.makeShmmrRestClient().getRestDescription()) |
| 482 |
|
: new RestServiceEditorPane(), BorderLayout.CENTER); |
| 483 |
0 |
df.setBounds(100, 100, 600, 400); |
| 484 |
0 |
df.addComponentListener(new ComponentListener() |
| 485 |
|
{ |
| 486 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 487 |
0 |
@Override... |
| 488 |
|
public void componentShown(ComponentEvent e) |
| 489 |
|
{ |
| 490 |
|
|
| 491 |
|
} |
| 492 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 493 |
0 |
@Override... |
| 494 |
|
public void componentResized(ComponentEvent e) |
| 495 |
|
{ |
| 496 |
|
|
| 497 |
|
} |
| 498 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 499 |
0 |
@Override... |
| 500 |
|
public void componentMoved(ComponentEvent e) |
| 501 |
|
{ |
| 502 |
|
|
| 503 |
|
} |
| 504 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 505 |
0 |
@Override... |
| 506 |
|
public void componentHidden(ComponentEvent e) |
| 507 |
|
{ |
| 508 |
0 |
visible = false; |
| 509 |
0 |
runner.interrupt(); |
| 510 |
|
|
| 511 |
|
} |
| 512 |
|
}); |
| 513 |
0 |
df.setVisible(true); |
| 514 |
0 |
while (visible) |
| 515 |
|
{ |
| 516 |
0 |
try |
| 517 |
|
{ |
| 518 |
0 |
Thread.sleep(10000); |
| 519 |
|
} catch (Exception x) |
| 520 |
|
{ |
| 521 |
|
} |
| 522 |
|
} |
| 523 |
0 |
visible = true; |
| 524 |
|
} |
| 525 |
|
} |
| 526 |
|
}).start(); |
| 527 |
|
|
| 528 |
|
} |
| 529 |
|
} |
| 530 |
|
|
| 531 |
|
String finalService = null; |
| 532 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 533 |
0 |
public void showDialog(String title)... |
| 534 |
|
{ |
| 535 |
0 |
if (oldservice != null) |
| 536 |
|
{ |
| 537 |
0 |
finalService = oldservice.toString(); |
| 538 |
|
} |
| 539 |
0 |
JalviewDialog jvd = new JalviewDialog() |
| 540 |
|
{ |
| 541 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 542 |
0 |
@Override... |
| 543 |
|
protected void raiseClosed() |
| 544 |
|
{ |
| 545 |
|
|
| 546 |
|
|
| 547 |
|
} |
| 548 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 549 |
0 |
@Override... |
| 550 |
|
protected void okPressed() |
| 551 |
|
{ |
| 552 |
0 |
updateServiceFromGui(); |
| 553 |
0 |
finalService = currentservice.toString(); |
| 554 |
|
} |
| 555 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 556 |
0 |
@Override... |
| 557 |
|
protected void cancelPressed() |
| 558 |
|
{ |
| 559 |
|
|
| 560 |
|
} |
| 561 |
|
}; |
| 562 |
0 |
JPanel pane = new JPanel(new BorderLayout()), |
| 563 |
|
okcancel = new JPanel(new FlowLayout()); |
| 564 |
0 |
pane.add(this, BorderLayout.CENTER); |
| 565 |
0 |
okcancel.add(jvd.ok); |
| 566 |
0 |
okcancel.add(jvd.cancel); |
| 567 |
0 |
pane.add(okcancel, BorderLayout.SOUTH); |
| 568 |
0 |
jvd.initDialogFrame(pane, true, true, title, 600, 350); |
| 569 |
0 |
jvd.waitForInput(); |
| 570 |
|
} |
| 571 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 572 |
0 |
public String getEditedRestService()... |
| 573 |
|
{ |
| 574 |
0 |
return finalService; |
| 575 |
|
} |
| 576 |
|
} |