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


Java ProgressWatcher类代码示例

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


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

示例1: doLoad

import ca.sqlpower.swingui.ProgressWatcher; //导入依赖的package包/类
/**
 * Loads the given List of driver names into the tree, then starts
    * a worker thread that searches for implementations of the JDBC Driver
    * interface in them.  As the worker finds JDBC Drivers in the JARs,
    * it will add them to the tree.
 */
private void doLoad(List<String> list) {
       logger.debug("about to start a worker", new Exception()); //$NON-NLS-1$
	LoadJDBCDrivers ljd = new LoadJDBCDrivers(list);
	LoadJDBCDriversWorker worker = new LoadJDBCDriversWorker(ljd);
	
	// Create a progress bar to show JDBC driver load progress, and hide when finished
	ProgressWatcher pw = new ProgressWatcher(progressBar,ljd,progressLabel);
	pw.setHideLabelWhenFinished(true);
	pw.start();
	
	new Thread(worker).start();
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:19,代码来源:JDBCDriverPanel.java

示例2: EngineWorker

import ca.sqlpower.swingui.ProgressWatcher; //导入依赖的package包/类
/**
 * @param engine The MatchMakerEngine that the worker will run
 * @param outputPanel The EngineOutputPanel where the engine will display it's output, 
 * including the log output and progress bar
 * @param registry The SwingWorkerRegistry that this worker will register itself with
 * @throws EngineSettingException
 * @throws SQLObjectException
 * @throws SourceTableException 
 */
public EngineWorker(MatchMakerEngine engine, EngineOutputPanel outputPanel,
		MatchMakerSwingSession session, Project project, Action action) throws EngineSettingException, SQLObjectException, SourceTableException {
	super(session);
	this.session = session;
	this.project = project;
	this.engine = engine;
	this.engineOutputDoc = outputPanel.getOutputDocument();
	this.parentComponent = outputPanel.getOutputComponent().getTopLevelAncestor();
	this.action = action;
	ProgressWatcher.watchProgress(outputPanel.getProgressBar(), engine);
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:21,代码来源:EngineWorker.java

示例3: actionPerformed

import ca.sqlpower.swingui.ProgressWatcher; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
	int response = JOptionPane.showConfirmDialog(getPanel(), warningMessage, "WARNING", JOptionPane.OK_CANCEL_OPTION);
	if (response == JOptionPane.OK_OPTION) {
		try {
			MungeProcess selectedProcess = (MungeProcess) mungeProcessComboBox.getSelectedItem();
			AutoMatchWorker worker = new AutoMatchWorker(pool, selectedProcess, session);
			ProgressMonitor monitor = new ProgressMonitor(session.getFrame(), "Auto-matching...", null, 0, 100);
			ProgressWatcher watcher = new ProgressWatcher(monitor, worker);
        	watcher.start();
            new Thread(worker).start();
		} catch (Exception ex) {
			MMSUtils.showExceptionDialog(getPanel(), "Auto-Match failed, most likely a database connection error", ex);
		}
	}
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:16,代码来源:MatchResultVisualizer.java

示例4: applyChanges

import ca.sqlpower.swingui.ProgressWatcher; //导入依赖的package包/类
public boolean applyChanges() {
	swingSession.setSelectNewChild(false);
	try {
       	progressBar.setVisible(true);
       	logger.debug("Progress Bar has been set to visible");
       	ProgressWatcher watcher = new ProgressWatcher(progressBar, deriveAction);
       	watcher.start();
           new Thread(deriveAction).start();
       } catch (Exception ex) {
           SPSUtils.showExceptionDialogNoReport(swingSession.getFrame(),
                   "Error in deriving related rules.", ex );
           return false;
       }
       return true;
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:16,代码来源:DeriveRelatedRulesPanel.java

示例5: showProgressWindow

import ca.sqlpower.swingui.ProgressWatcher; //导入依赖的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


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