当前位置: 首页>>代码示例>>Java>>正文


Java SPSwingWorker类代码示例

本文整理汇总了Java中ca.sqlpower.swingui.SPSwingWorker的典型用法代码示例。如果您正苦于以下问题:Java SPSwingWorker类的具体用法?Java SPSwingWorker怎么用?Java SPSwingWorker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SPSwingWorker类属于ca.sqlpower.swingui包,在下文中一共展示了SPSwingWorker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runInBackground

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void runInBackground(final Runnable runner) {
    SPSwingWorker worker = new SPSwingWorker(this) {
        
        @Override
        public void doStuff() throws Exception {
            runner.run();
        }

        @Override
        public void cleanup() throws Exception {
            //do nothing
        }
        
    };
    new Thread(worker).start();
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:17,代码来源:WabitSwingSessionImpl.java

示例2: ActiveWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
ActiveWorker(@NonNull SPSwingWorker worker) {
    if (worker == null) {
        throw new NullPointerException("Null worker!");
    }
    this.worker = worker;
    if (worker.getResponsibleObject() instanceof WabitObject) {
        WabitObject responsibleObject = (WabitObject) worker.getResponsibleObject();
        pathToResponsibleObject =
            workspaceTreeModel.createTreePathForObject(responsibleObject);
        
    } else {
        pathToResponsibleObject = null;
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:15,代码来源:WabitSwingSessionImpl.java

示例3: removeSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void removeSwingWorker(@NonNull final SPSwingWorker worker) {
    synchronized (activeWorkers) {
        for (Iterator<ActiveWorker> it = activeWorkers.iterator(); it.hasNext(); ) {
            ActiveWorker aw = it.next();
        	if (aw.getWorker().equals(worker)) {
            	it.remove();
        	}
        }
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:11,代码来源:WabitSwingSessionImpl.java

示例4: TaskTerminationEvent

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public TaskTerminationEvent(SPSwingWorker source) {
	this.source = source;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:4,代码来源:TaskTerminationEvent.java

示例5: getSource

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public SPSwingWorker getSource() {
	return source; 
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:4,代码来源:TaskTerminationEvent.java

示例6: registerSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void registerSwingWorker(SPSwingWorker worker) {
	workers.add(worker);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:4,代码来源:SQLQueryUIComponentsTest.java

示例7: removeSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void removeSwingWorker(SPSwingWorker worker) {
	workers.remove(worker);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:4,代码来源:SQLQueryUIComponentsTest.java

示例8: registerSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void registerSwingWorker(SPSwingWorker worker) {
	swingWorkers.add(worker);
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:4,代码来源:MatchMakerSwingSession.java

示例9: removeSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void removeSwingWorker(SPSwingWorker worker) {
	swingWorkers.remove(worker);
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:4,代码来源:MatchMakerSwingSession.java

示例10: showProgressWindow

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
/**
 * This method displays a modal dialog that shows the progress of a
 * workspace loading. The progress window will appear immediately and make
 * the Wabit window unresponsive. When the worker completes the dialog will
 * be disposed of and the Wabit window will become responsive again.
 * 
 * @param parent
 *            The frame to parent the dialog to. This frame will be
 *            unresponsive while the progress dialog is displayed.
 * @param worker
 *            The worker this progress window will monitor. When the worker
 *            finishes this dialog will go away.
 */
public static void showProgressWindow(final JFrame parent, final SPSwingWorker worker) {
    
    final JDialog progressDialog = new JDialog(parent, "Loading");
    
    final JLabel messageLabel = new JLabel("Loading");
    
    final JProgressBar progressBar = new JProgressBar();
    
    final JButton cancelButton = new JButton(new AbstractAction("Cancel") {

        public void actionPerformed(ActionEvent e) {
            worker.setCancelled(true);
        }
        
    });
    
    // sticking the timer in an array so it can be accessed from inside the innerO class
    final Timer[] timerHandle = new Timer[1];
    timerHandle[0] = new Timer(50, new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (worker.isFinished() || worker.isCancelled()) {
                timerHandle[0].stop();
                progressDialog.setVisible(false);
                progressDialog.dispose();
                parent.setEnabled(true);
                parent.toFront(); // hack for bug in Windows which sends parent behind other applications
            }
        }
    });
    timerHandle[0].start(); 
            
    
    progressDialog.setLayout(new MigLayout("fillx"));
    progressDialog.add(messageLabel, "grow, wrap");
    progressDialog.add(progressBar, "grow, wrap");
    progressDialog.add(cancelButton, "align right");

    ProgressWatcher.watchProgress(progressBar, worker, messageLabel);
    
    messageLabel.setMinimumSize(new Dimension(300, (int) messageLabel.getPreferredSize().getHeight()));
    messageLabel.setPreferredSize(new Dimension(300, (int) messageLabel.getPreferredSize().getHeight()));
    progressDialog.pack();
    
    progressDialog.setLocationRelativeTo(parent);
    
    progressDialog.setVisible(true);
    
    parent.setEnabled(false);
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:64,代码来源:OpenProgressWindow.java

示例11: registerSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void registerSwingWorker(@NonNull SPSwingWorker worker) {
    activeWorkers.add(new ActiveWorker(worker));
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:4,代码来源:WabitSwingSessionImpl.java

示例12: registerSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void registerSwingWorker(SPSwingWorker worker) {
    activeWorkers.add(worker);
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:4,代码来源:WabitSwingSessionContextImpl.java

示例13: removeSwingWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void removeSwingWorker(SPSwingWorker worker) {
    activeWorkers.remove(worker);
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:4,代码来源:WabitSwingSessionContextImpl.java

示例14: close

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
public void close() {
    for (SPSwingWorker worker : activeWorkers) {
        worker.kill();
    }
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:6,代码来源:WabitSwingSessionContextImpl.java

示例15: getWorker

import ca.sqlpower.swingui.SPSwingWorker; //导入依赖的package包/类
/**
 * Returns the worker.
 * 
 * @return The worker (never null)
 */
@NonNull
public SPSwingWorker getWorker() {
    return worker;
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:10,代码来源:WabitSwingSessionImpl.java


注:本文中的ca.sqlpower.swingui.SPSwingWorker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。