Issue #1449 Add interface in front of VizApp task running methods

Change-Id: I4696782d800a836f347cf72738c6c0673314a492

Former-commit-id: f6e081d331 [formerly b9c9030d05] [formerly f6e081d331 [formerly b9c9030d05] [formerly dc61af2dea [formerly 3ed5c31344148559c0e5479f4b7955fcee7cb0a7]]]
Former-commit-id: dc61af2dea
Former-commit-id: 853ea19014 [formerly 19cdf2f57c]
Former-commit-id: 05951d66c6
This commit is contained in:
Dustin Johnson 2013-01-02 11:01:15 -06:00
parent be9e052dc3
commit 1bc5b09603
2 changed files with 131 additions and 0 deletions

View file

@ -0,0 +1,66 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.core;
/**
* Executor service that runs tasks asynchronously or synchronously on the GUI
* thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 02, 2013 1449 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public interface IGuiThreadTaskExecutor {
/**
* Run a task asynchronously on the UI thread
*
* @param aTask
* the task to run
*/
void runAsync(Runnable aTask);
/**
* Run a task synchronously on the UI thread
*
* @param task
* the task to run
*/
void runSync(Runnable task);
/**
* Run a task synchronously on the UI thread if a workbench is running,
* otherwise just runs the task
*
* @param task
* the task to run
*/
void runSyncIfWorkbench(Runnable task);
}

View file

@ -0,0 +1,65 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.core;
/**
* Implementation of {@link IVizAppTaskExecutor} that uses VizApp.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 02, 2013 1449 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class VizAppTaskExecutor implements IGuiThreadTaskExecutor {
/**
* {@inheritDoc}
*/
@Override
public void runAsync(Runnable aTask) {
VizApp.runAsync(aTask);
}
/**
* {@inheritDoc}
*/
@Override
public void runSync(Runnable task) {
VizApp.runSync(task);
}
/**
* {@inheritDoc}
*/
@Override
public void runSyncIfWorkbench(Runnable task) {
VizApp.runSyncIfWorkbench(task);
}
}