comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 425:b284b8f9e535 stable-1.9.0-8

cleanup logging
author Carl Byington <carl@five-ten-sg.com>
date Fri, 31 Oct 2014 17:22:05 -0700
parents 09c1d3aae3f0
children b525a8141923
comparison
equal deleted inserted replaced
424:09c1d3aae3f0 425:b284b8f9e535
383 m++; 383 m++;
384 } 384 }
385 385
386 Log.d(TAG, "" + sum); 386 Log.d(TAG, "" + sum);
387 return sumVector; 387 return sumVector;
388 }
389
390 /**
391 * This will move the screen cursor based on the mouse event.
392 *
393 * I do not think the checks here for the gui characters should be here but
394 * will leave them here for now until we work out the interaction. This
395 * should be up to the gui frontend in my opinion.
396 *
397 * @param pos
398 */
399 public boolean moveCursor(int pos) {
400 if (!oia.isKeyBoardLocked()) {
401 if (pos < 0)
402 return false;
403
404 // because getRowColFromPoint returns offset of 1,1 we need to
405 // translate to offset 0,0
406 // pos -= (numCols + 1);
407 int g = planes.getWhichGUI(pos);
408
409 // lets check for hot spots
410 if (g >= BUTTON_LEFT && g <= BUTTON_LAST) {
411 StringBuffer aid = new StringBuffer();
412 boolean aidFlag = true;
413
414 switch (g) {
415 case BUTTON_RIGHT:
416 case BUTTON_MIDDLE:
417 while (planes.getWhichGUI(--pos) != BUTTON_LEFT) {
418 }
419
420 case BUTTON_LEFT:
421 if (planes.getChar(pos) == 'F') {
422 pos++;
423 }
424 else
425 aidFlag = false;
426
427 if (planes.getChar(pos + 1) != '='
428 && planes.getChar(pos + 1) != '.'
429 && planes.getChar(pos + 1) != '/') {
430 Log.d(TAG, " Hotspot clicked!!! we will send characters "
431 + planes.getChar(pos) + " " + planes.getChar(pos + 1));
432 aid.append(planes.getChar(pos));
433 aid.append(planes.getChar(pos + 1));
434 }
435 else {
436 Log.d(TAG, " Hotspot clicked!!! we will send character "
437 + planes.getChar(pos));
438 aid.append(planes.getChar(pos));
439 }
440
441 break;
442 }
443
444 if (aidFlag) {
445 switch (g) {
446 case BUTTON_LEFT_UP:
447 case BUTTON_MIDDLE_UP:
448 case BUTTON_RIGHT_UP:
449 case BUTTON_ONE_UP:
450 case BUTTON_SB_UP:
451 case BUTTON_SB_GUIDE:
452 sessionVT.sendAidKey(AID_ROLL_UP);
453 break;
454
455 case BUTTON_LEFT_DN:
456 case BUTTON_MIDDLE_DN:
457 case BUTTON_RIGHT_DN:
458 case BUTTON_ONE_DN:
459 case BUTTON_SB_DN:
460 case BUTTON_SB_THUMB:
461 sessionVT.sendAidKey(AID_ROLL_DOWN);
462 break;
463
464 case BUTTON_LEFT_EB:
465 case BUTTON_MIDDLE_EB:
466 case BUTTON_RIGHT_EB:
467 StringBuffer eb = new StringBuffer();
468
469 while (planes.getWhichGUI(pos--) != BUTTON_LEFT_EB)
470 ;
471
472 while (planes.getWhichGUI(pos++) != BUTTON_RIGHT_EB) {
473 eb.append(planes.getChar(pos));
474 }
475
476 sessionVT.showURL(eb.toString());
477 // take out the log statement when we are sure it is
478 // working
479 Log.i(TAG, "Send to external Browser: " + eb.toString());
480 break;
481
482 default:
483 int aidKey = Integer.parseInt(aid.toString());
484
485 if (aidKey >= 1 && aidKey <= 12)
486 sessionVT.sendAidKey(0x30 + aidKey);
487
488 if (aidKey >= 13 && aidKey <= 24)
489 sessionVT.sendAidKey(0xB0 + (aidKey - 12));
490 }
491 }
492 else {
493 if (screenFields.getCurrentField() != null) {
494 int xPos = screenFields.getCurrentField().startPos();
495
496 for (int x = 0; x < aid.length(); x++) {
497 // System.out.println(sr + "," + (sc + x) + " " +
498 // aid.charAt(x));
499 planes.setChar(xPos + x , aid.charAt(x));
500 }
501
502 // System.out.println(aid);
503 screenFields.setCurrentFieldMDT();
504 sessionVT.sendAidKey(AID_ENTER);
505 }
506 }
507
508 // return back to the calling routine that the cursor was not moved
509 // but something else here was done like aid keys or the such
510 return false;
511 }
512
513 // this is a note to not execute this code here when we
514 // implement
515 // the remain after edit function option.
516 // if (gui.rubberband.isAreaSelected()) {
517 // gui.rubberband.reset();
518 // gui.repaint();
519 // } else {
520 goto_XY(pos);
521 isInField();
522 // return back to the calling object that the cursor was indeed
523 // moved with in the screen object
524 return true;
525 // }
526 }
527
528 return false;
529 } 388 }
530 389
531 public void setVT(tnvt v) { 390 public void setVT(tnvt v) {
532 sessionVT = v; 391 sessionVT = v;
533 } 392 }