本文整理汇总了Java中org.jdesktop.application.ApplicationContext.getTaskService方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationContext.getTaskService方法的具体用法?Java ApplicationContext.getTaskService怎么用?Java ApplicationContext.getTaskService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.application.ApplicationContext
的用法示例。
在下文中一共展示了ApplicationContext.getTaskService方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeAutoBackup
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
/**
* This method starts a background thread that creates an automatic backup
* of the current main data file. the file is saved to the same directory as
* the main data file, just changing the extenstion to ".zkb3".
* <br><br>
* This method is called when we have changes that are not save, e.g. after
* the methods {@link #newEntry() newEntry()} or
* {@link #editEntry() editEntry()}.
*/
private void makeAutoBackup() {
// if
// - task is already running, or
// - no backup necessary
// - or an save-operation is in progress...
// ...then do nothing.
if (isAutoBackupRunning() || !isBackupNecessary() || isSaving) {
return;
}
// check for autobackup
if (settings.getAutoBackup() && (settings.getFilePath() != null)) {
Task cabT = autoBackupTask();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(cabT);
tM.setForegroundTask(cabT);
} else {
setAutoBackupRunning(false);
}
}
示例2: updateDisplay
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
/**
* This method updates the display, i.e. receiving the entry-structure from
* the jTree and displays all those entries in html-formatting in the
* jEditorPane.
*/
private synchronized void updateDisplay() {
// when the display is up to date, do nothing here...
if (!isNeedsUpdate()) {
return;
}
// cancel already running task if necessary, so we don't have more parallel tasks running
if (cDisplayTask != null) {
cDisplayTask.cancel(true);
}
// if task is already running, leave...
if (cDisplayTaskIsRunning) {
return;
}
Task cdT = displayTask();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(cdT);
tM.setForegroundTask(cdT);
}
示例3: startTask
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
public void startTask() {
// start the background task manually
Task fdeT = findDoubleEntries();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(fdeT);
tM.setForegroundTask(fdeT);
}
示例4: startTask
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
/**
*
*/
private void startTask() {
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
tM = appC.getTaskMonitor();
tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(foregroundTask);
tM.setForegroundTask(foregroundTask);
}
示例5: showAuthors
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
/**
* This method creates the quickinput-list for authors by calling a
* background task which does this work...
*/
@Action
public final synchronized void showAuthors() {
// when authorlist is uptodate, leave...
if (authorListUpToDate) {
// select added authors if we have some
selectNewAddedAuthors();
return;
}
// en/disable keyword quick-input function depending on the amount of keywords
int aucount = dataObj.getCount(Daten.AUCOUNT);
jTextFieldFilterAuthorlist.setEnabled(aucount > 0);
// disbale button, will only be enabled on selection
// jButtonAddAuthors.setEnabled(false);
// when we have no authors at all, quit
if (aucount < 1) {
return;
}
// leave method when task is already running...
if (qiAuthorTaskIsRunning) {
return;
}
// set upto-date-indicator to false, otherwise the thread will not be executed
authorListUpToDate = false;
// when opening this dialog, automatically create the author list
Task qiauT = quickInputAuthor();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(qiauT);
tM.setForegroundTask(qiauT);
}
示例6: fillBibtexTable
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
private void fillBibtexTable() {
if (jRadioButtonSourceFile.isSelected()) {
// retrieve currently attached file
File currentlyattachedfile = bibtexObj.getCurrentlyAttachedFile();
// if we have no currently attached bibtex-file, or the currently attached bibtex-file
// differs from the new selected file of the user, open the bibtex-file now
if ((null == currentlyattachedfile) || (!currentlyattachedfile.toString().equals(bibtexObj.getFilePath().toString()))) {
// open selected file, using the character encoding of the related reference-manager (i.e.
// the programme that has exported the bib-tex-file).
bibtexObj.openAttachedFile(Constants.BIBTEX_ENCODINGS[jComboBoxEncoding.getSelectedIndex()], false);
// retrieve currently attached bibtex-file
currentlyattachedfile = bibtexObj.getCurrentlyAttachedFile();
}
// set filepath to textfield
jTextFieldBibtexFilepath.setText((currentlyattachedfile != null && currentlyattachedfile.exists()) ? currentlyattachedfile.toString() : "");
}
// block all components
setComponentsBlocked(true);
// reset linked list
linkedtablelist = null;
// start the background task manually
Task impBibT = startImport();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(impBibT);
tM.setForegroundTask(impBibT);
}
示例7: filterLinks
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
/**
* This method filters the entries in the jTableLinks depending on the selected keyword(s)
* of the jListKeywords.<br><br>
* This method is called when the user selects an entry from the list jListKeywords.
* We then want to filter the list
* with links/references to other entries (jTableLinks) to show only those links (entries)
* that are related to the selected keywords.<br><br>
* Futhermore, we want to offer logical-and and logical-or combination of the keywords,
* i.e. showing either entries that contain ALL selected keywords or AT LEAST ONE of
* the selected keywords.
*/
private synchronized void filterLinks() {
// if no data available, leave method
if (data.getCount(Daten.ZKNCOUNT)<1) {
return;
}
// if the link-table is not shown, leave
if (jTabbedPaneMain.getSelectedIndex()!=TAB_LINKS) {
return;
}
// if no selections made, or all values de-selected, leave method
// and show all links instead
if (jListEntryKeywords.getSelectedIndices().length<1) {
showLinks();
return;
}
// when thread is already running, do nothing...
if (createFilterLinksIsRunning) {
return;
}
// clear table
DefaultTableModel tm = (DefaultTableModel) jTableLinks.getModel();
// reset the table
tm.setRowCount(0);
// tell user that we are doing something...
statusMsgLabel.setText(getResourceMap().getString("createLinksMsg"));
// create task
Task cflT = createFilterLinks();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(cflT);
tM.setForegroundTask(cflT);
}
示例8: computeLikelihood
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
public void computeLikelihood(int numModels, ApplicationOptions options) {
enableHandler();
ProtTestPrinter.printExecutionHeader(options);
preferencesMenuItem.setEnabled(false);
this.numModels = numModels;
if (errorLogView != null) {
ProtTestLogger.getDefaultLogger().removeHandler(
errorLogView.getLogHandler());
errorLogView.setVisible(false);
errorLogView.dispose();
errorLogView = null;
}
if (resultsView != null) {
resultsView.setVisible(false);
resultsView.dispose();
resultsView = null;
}
if (treeView != null) {
treeView.setVisible(false);
treeView.dispose();
treeView = null;
}
if (consensusView != null) {
consensusView.setVisible(false);
consensusView.dispose();
consensusView = null;
}
errorLogView = new ErrorLogView();
ProtTestLogger.getDefaultLogger().addHandler(
errorLogView.getLogHandler());
RunningFrame runningFrame = new RunningFrame(this, numModels);
errorMenuItem.setEnabled(false);
prottestFacade.addObserver(runningFrame);
lblMoreInfo.setVisible(false);
Task task = new ComputeLikelihoodTask(getApplication(), runningFrame,
this, options);
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// i.e. making the animated progressbar and busy icon visible
tS.execute(task);
taskRunning = true;
enableItems(false);
runningFrame.setVisible(true);
}
示例9: showLinks
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
/**
* This method displays the links/connection of an entry by starting a
* background task. after the task finishes, all links from this entry to
* other entries are display in the JTable of the JTabbedPane
*/
private synchronized void showLinks() {
// if no data available, leave method
if (data.getCount(Daten.ZKNCOUNT) < 1) {
return;
}
// if the link-table is not shown, leave
if (jTabbedPaneMain.getSelectedIndex() != TAB_LINKS) {
return;
}
// when no update needed, show menu and leave method
if (!needsLinkUpdate) {
// update might be needed next time
needsLinkUpdate = true;
// show/enable viewmenu, if we have at least one entry...
if ((jTableLinks.getRowCount() > 0) && (TAB_LINKS == jTabbedPaneMain.getSelectedIndex())) {
showTabMenu(viewMenuLinks);
}
// we might have changes to the manual links, so update this here...
displayManualLinks();
// and leave method
return;
}
// when task is already running, quit...
if (createLinksIsRunning) {
return;
}
// clear selections
jListEntryKeywords.clearSelection();
// clear table
DefaultTableModel tm = (DefaultTableModel) jTableLinks.getModel();
// reset the table
tm.setRowCount(0);
// clear table with manual links
tm = (DefaultTableModel) jTableManLinks.getModel();
// reset the table
tm.setRowCount(0);
// hide the panel with the table with manual links
/* jPanelManLinks.setVisible(false); */
// tell user that we are doing something...
statusMsgLabel.setText(getResourceMap().getString("createLinksMsg"));
Task clT = createLinks();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(clT);
tM.setForegroundTask(clT);
}
示例10: initClusterList
import org.jdesktop.application.ApplicationContext; //导入方法依赖的package包/类
private synchronized void initClusterList() {
// get the treemodel
DefaultTreeModel dtm = (DefaultTreeModel) jTreeCluster.getModel();
// and first of all, clear the jTree
dtm.setRoot(null);
// get the amount of keywords
int kwcount = data.getCount(Daten.KWCOUNT);
// if we have no keywords, quit
if (kwcount < 1) {
return;
}
// if this checkbox is selected, we don't show the relations of *all*
// keywords, but only of those keywords that appear in the current entry
// and all related keywords of the current entry's keywords.
if (jCheckBoxCluster.isSelected()) {
// when a cluster-taks is already running, return
if (createClusterIsRunning) {
return;
}
// disable checkbox during task operation
jCheckBoxCluster.setEnabled(false);
// tell user that we are doing something...
statusMsgLabel.setText(getResourceMap().getString("createLuhmannMsg"));
Task ccT = clusterTask();
// get the application's context...
ApplicationContext appC = Application.getInstance().getContext();
// ...to get the TaskMonitor and TaskService
TaskMonitor tM = appC.getTaskMonitor();
TaskService tS = appC.getTaskService();
// with these we can execute the task and bring it to the foreground
// i.e. making the animated progressbar and busy icon visible
tS.execute(ccT);
tM.setForegroundTask(ccT);
} else {
// else create a string array (for sorting the keywords)
String[] kws = new String[kwcount];
// copy all keywords to that array
for (int cnt = 1; cnt <= kwcount; cnt++) {
kws[cnt - 1] = data.getKeyword(cnt);
}
// sort the array
if (kws != null && kws.length > 0) {
Arrays.sort(kws, new Comparer());
}
// set this as root node. we don't need to care about this, since the
// root is not visible.
DefaultMutableTreeNode root = new DefaultMutableTreeNode("ZKN3-Cluster");
dtm.setRoot(root);
// if we have any keywords, set them to the list
if (kws != null) {
// for each array in the keyword-array...
for (String kw : kws) {
// create a new node and add the keyword to the tree
// remember that we might have empty keyword-entries in the array, which
// have to be "removed" here
if (!kw.isEmpty()) {
root.add(new DefaultMutableTreeNode(kw));
}
}
// completely expand the jTree
TreeUtil.expandAllTrees(true, jTreeCluster);
}
// we have no filtered list...
linkedclusterlist = false;
// indicate that the cluster list is up to date...
data.setClusterlistUpToDate(true);
}
}