Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r1135 committed - FlashIssue158 Added "Copy log to Clipboard" button

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r1135 committed - FlashIssue158 Added "Copy log to Clipboard" button


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r1135 committed - FlashIssue158 Added "Copy log to Clipboard" button
  • Date: Mon, 03 Nov 2014 14:21:53 +0000

Revision: 1135
Author:

Date: Mon Nov 3 14:21:35 2014 UTC
Log: FlashIssue158 Added "Copy log to Clipboard" button

https://code.google.com/p/ndt/source/detail?r=1135

Modified:
/branches/FlashClientFixes/flash-client/src/GUI.as

=======================================
--- /branches/FlashClientFixes/flash-client/src/GUI.as Mon Nov 3 11:41:51 2014 UTC
+++ /branches/FlashClientFixes/flash-client/src/GUI.as Mon Nov 3 14:21:35 2014 UTC
@@ -25,6 +25,8 @@
import flash.display.DisplayObjectContainer;
import flash.display.DisplayObject;
import flash.filters.BlurFilter;
+ import flash.desktop.Clipboard;
+ import flash.desktop.ClipboardFormats;
import spark.effects.*;

/**
@@ -54,6 +56,7 @@
private var _debugButton:NDTButton;
private var _activeButton:NDTButton;
private var _restartButton:Sprite;
+ private var _copyButton:Sprite;

public function GUI(
stageWidth:int, stageHeight:int, callerObj:NDTPController) {
@@ -169,6 +172,11 @@
this.addChild(_progressText);
_callerObj.startNDTTest();
}
+
+ private function clickCopy(e:MouseEvent):void {
+ Clipboard.generalClipboard.clear();
+ Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, _resultsTextField.text);
+ }

public function updateProgressText(completed:int, total:int):void {
if (_progressText) {
@@ -250,6 +258,7 @@
if (CONFIG::debug)
_debugButton = new NDTButton("DEBUG", 18, 30, 0.25);
_restartButton = new NDTButton("RESTART", 18, 30, 0.25);
+ _copyButton = new NDTButton("Copy log \nto Clipboard", 12, 35, 0.25);

var verticalMargin:Number = _stageHeight / 5;
if (CONFIG::debug)
@@ -260,11 +269,13 @@
_debugButton.y = _detailsButton.y + verticalMargin;
_restartButton.y = CONFIG::debug ? _debugButton.y + verticalMargin
: _detailsButton.y + verticalMargin;
+ _copyButton.y = _restartButton.y + verticalMargin;
_resultsButton.x += _resultsButton.width / 2;
_detailsButton.x += _detailsButton.width / 2;
if (_debugButton)
_debugButton.x += _debugButton.width / 2;
_restartButton.x += _restartButton.width / 2;
+ _copyButton.x += _copyButton.width / 2;

this.addChild(_resultsButton);
this.addChild(_detailsButton);
@@ -277,18 +288,21 @@
if (_debugButton)
_debugButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);
_restartButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);
+ _copyButton.addEventListener(MouseEvent.ROLL_OVER, rollOver);

_resultsButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
_detailsButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
if (_debugButton)
_debugButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
_restartButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);
+ _copyButton.addEventListener(MouseEvent.ROLL_OUT, rollOut);

_resultsButton.addEventListener(MouseEvent.CLICK, clickResults);
_detailsButton.addEventListener(MouseEvent.CLICK, clickDetails);
if (_debugButton)
_debugButton.addEventListener(MouseEvent.CLICK, clickDebug);
_restartButton.addEventListener(MouseEvent.CLICK, clickRestart);
+ _copyButton.addEventListener(MouseEvent.CLICK, clickCopy);

changeActiveButton(_resultsButton);
setSummaryResultText();
@@ -363,12 +377,14 @@

private function clickResults(e:MouseEvent):void {
changeActiveButton(NDTButton(e.target));
+ hideCopyButton();
_resultsTextField.htmlText = _summaryResultText;
_resultsTextField.scrollV = 0;
}

private function clickDetails(e:MouseEvent):void {
changeActiveButton(NDTButton(e.target));
+ showCopyButton();
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getResultDetails();
_resultsTextField.scrollV = 0;
@@ -376,6 +392,7 @@

private function clickDebug(e:MouseEvent):void {
changeActiveButton(NDTButton(e.target));
+ showCopyButton();
_resultsTextField.htmlText = "<font size=\"14\">"
+ TestResults.getDebugMsg();
_resultsTextField.scrollV = 0;
@@ -396,6 +413,16 @@
target.setActive();
_activeButton = target;
}
+
+ private function showCopyButton():void {
+ if (!this.contains(_copyButton))
+ this.addChild(_copyButton);
+ }
+
+ private function hideCopyButton():void {
+ if (this.contains(_copyButton))
+ this.removeChild(_copyButton);
+ }
}
}



  • [ndt-dev] [ndt] r1135 committed - FlashIssue158 Added "Copy log to Clipboard" button, ndt, 11/03/2014

Archive powered by MHonArc 2.6.16.

Top of Page