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


Java ProgressMonitor.isCanceled方法代码示例

本文整理汇总了Java中javax.swing.ProgressMonitor.isCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor.isCanceled方法的具体用法?Java ProgressMonitor.isCanceled怎么用?Java ProgressMonitor.isCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.ProgressMonitor的用法示例。


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

示例1: addFrames

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/** Add all the frames from an AnimationReader.
 * 
 * @param r the animation to read.
 * @param monitor an optional ProgressMonitor to update
 * @throws IOException if an error occurs copying frames.
 */
public void addFrames(AnimationReader r, ProgressMonitor monitor) throws IOException {
	if(monitor!=null)
		monitor.setMaximum(r.getFrameCount());
	BufferedImage bi = r.getNextFrame(false);
	int ctr = 1;
	while(bi!=null) {
		if(monitor!=null) {
			if(monitor.isCanceled()) {
				throw new UserCancelledException();
			}
			monitor.setProgress(ctr);
		}
		float d;
		try {
			d = (float)r.getFrameDuration();
		} catch(Exception e) {
			e.printStackTrace();
			d = 1;
		}
		addFrame(d, bi, .98f);
		bi = r.getNextFrame(false);
		ctr++;
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:31,代码来源:JPEGMovWriter.java

示例2: export

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public boolean export(OutputStream out)
        throws IOException, NoninvertibleTransformException {
    this.out = out;
    List lines = ornament.getLines();
    int nLines = lines.size(), maxProgress = nLines + 2;
    ProgressMonitor pm = new ProgressMonitor(ornament, I18n._("exporting"),
                                             null, 0, maxProgress);
    init();
    prepareStream();
    pm.setProgress(1);
    head();
    BufferedImage bg = ornament.getBackgroundTile();
    if (bg != null) background(bg);
    for (int i = 0; i != nLines && !pm.isCanceled(); ++i) {
        pm.setProgress(2+i);
        export((LinPath)lines.get(i));
    }
    pm.setProgress(2+nLines);
    postBody();
    tail();
    if (out != null) out.close();
    pm.close();
    return true;
}
 
开发者ID:IMAGINARY,项目名称:morenaments-euc,代码行数:25,代码来源:Export.java

示例3: main

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        createTestUI();

        monitor = new ProgressMonitor(frame, "Progress", null, 0, 100);

        robotThread = new TestThread();
        robotThread.start();

        for (counter = 0; counter <= 100; counter += 10) {
            Thread.sleep(1000);

            EventQueue.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    if (!monitor.isCanceled()) {
                        monitor.setProgress(counter);
                        System.out.println("Progress bar is in progress");
                    }
                }
            });

            if (monitor.isCanceled()) {
                break;
            }
        }

        disposeTestUI();

        if (counter >= monitor.getMaximum()) {
            throw new RuntimeException("Escape key did not cancel the ProgressMonitor");
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:ProgressMonitorEscapeKeyPress.java

示例4: runAnnotation

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
private boolean runAnnotation() {

    theThread.start();

    // launch progress dialog
    progressDialog = new ProgressMonitor(theApplication, "Matching peaks with fragments", null, 0, theThread.getTarget());
    
    // set up the timer action
    activityMonitor = new Timer(200, new ActionListener() {  
        public void actionPerformed (ActionEvent event) {  
            int progress = theThread.getProgress();
            
            // show progress
            progressDialog.setProgress(progress);

            // check if task is completed or canceled
            if( progress==theThread.getTarget() || theThread.isInterrupted() ||  progressDialog.isCanceled ()) {  
            activityMonitor.stop();
            progressDialog.close();
            
            if( progress!=theThread.getTarget() ) {
                theThread.interrupt();    
                onAnnotationAborted(theThread);                
            }
            else {
                onAnnotationCompleted(theThread);                
            }
            }
        }
        });
    activityMonitor.start();    
    
    // return control
    return true;
    }
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:36,代码来源:GAGPlugin.java

示例5: scanAnnotationCascade

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public boolean scanAnnotationCascade(boolean ask, Vector<Scan> parentScans) {
	if(setAnnotationOptions(ask)){
		theApplication.haltInteractions();
		showTopResults = false;
		
		scanThread=new ScanAnnotationCascadeThread(parentScans,theWorkspace.getFragmentOptions(), theWorkspace.getAnnotationOptions());
		scanThread.start();

		progressDialog = new ProgressMonitor(theApplication,"Parent scans completed", null, 0, scanThread.getTarget());

		// set up the timer action
		activityMonitor = new Timer(200, new ActionListener() {
			public void actionPerformed(ActionEvent event) {
				int progress = scanThread.getProgress();
				// show progress
				progressDialog.setProgress(progress);

				// check if task is completed or canceled
				if (progress == scanThread.getTarget()
						|| progressDialog.isCanceled()) {

					System.err.println("Stopping activity monitor");
					activityMonitor.stop();
					progressDialog.close();

					if (progress != scanThread.getTarget()) {
						scanThread.interrupt();
						onAnnotationAborted(scanThread);
					} else {
						onAnnotationCompleted(scanThread);
					}

				}
			}
		});
		activityMonitor.start();
	}
	return true;
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:40,代码来源:AnnotationPlugin.java

示例6: cutSurface

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public synchronized void cutSurface(Surface surface, ProgressMonitor monitor) {
  if (cpList.isEmpty() || (repeat <= 0)) {
    return;
  }
  double zRotation = indexOffsetDegrees();
  if (zRotation != 0.0) {
    surface.rotateZ(zRotation);			// initial phase rotation
  }
  outerloop:
  for (int i = 0; i < repeat; i++) {
    if (i > 0) {
      surface.rotateZ(360.0 / repeat);	// rotate to the next one
      zRotation += 360.0 / repeat;		// keep track of cumulative rotation
    }
    surface.offset(-getX(), 0.0, -getZ());			// move the surface over the offset point
    surface.rotateY(-getTangentAngle());

    // this is where the main work is done
    monitor.setProgress(num+1);
    monitor.setNote("CutPoint " + getNum() + ": " + i + "/" + repeat + "\n");
    for (CutPoint cPt : cpList) {
      if (cPt instanceof OffRosettePoint) {
        Vector2d offsetPt = offsetForCutPoint(cPt);
        ((OffRosettePoint) cPt).cutSurface(surface, offsetPt.x, offsetPt.y);			// and cut with it
      }
      if (monitor.isCanceled()) {
        break outerloop;
      }
    }

    surface.rotateY(getTangentAngle());
    surface.offset(getX(), 0.0, getZ());	// move the surface back so that the z rotation will be around the center
  }
  if (zRotation < 360.0) {
    surface.rotateZ(360.0 - zRotation);		// this should get you back to original rotation
  }
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:39,代码来源:OffsetGroup.java

示例7: cutSurface

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public synchronized void cutSurface(Surface surface, ProgressMonitor monitor) {
  ArrayList<CutPoint> list = makeListOfPoints();
  for (int i = 0; i < list.size(); i++) {
    monitor.setProgress(num + 1);
    monitor.setNote("CutPoint " + getNum() + ": " + i + "/" + list.size() + "\n");
    list.get(i).cutSurface(surface, monitor);
    if (monitor.isCanceled()) {
      break;
    }
  }
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:13,代码来源:SpiralCut.java

示例8: writeEEPROM

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * This is a BLOCKING write call to write the Cypress EEPROM. Max number of
 * bytes is defined by {@link #EEPROM_SIZE}. Thread-safe.
 *
 * @param addr the starting address
 * @param bytes the bytes to write
 */
synchronized public void writeEEPROM(int addr, byte[] bytes) throws HardwareInterfaceException {

    log.info("writing EEPROM to addr=" + addr + " with " + bytes.length + " bytes");

    if (bytes.length > this.EEPROM_SIZE) {
        throw new RuntimeException(bytes.length + " is too many bytes for EEPROM to hold (" + EEPROM_SIZE + ")");
    }
    if ((addr < 0) || ((addr + bytes.length) > EEPROM_SIZE)) {
        throw new RuntimeException(bytes.length + " is too many bytes for EEPROM to hold (" + EEPROM_SIZE + ") starting at address " + addr);
    }
    int result; // result of USBIO operations
    USBIO_DATA_BUFFER dataBuffer = null;
    USBIO_CLASS_OR_VENDOR_REQUEST vendorRequest = null;

    int numChunks, index;

    // make vendor request structure and populate it
    vendorRequest = new USBIO_CLASS_OR_VENDOR_REQUEST();

    vendorRequest.Request = VR_EEPROM; // this is EEPROM command, direction of vendor request defines download here

    vendorRequest.Flags = UsbIoInterface.USBIO_SHORT_TRANSFER_OK;
    vendorRequest.Type = UsbIoInterface.RequestTypeVendor;  // this is a vendor, not generic USB, request
    vendorRequest.Recipient = UsbIoInterface.RecipientDevice; // device (not endpoint, interface, etc) receives it
    vendorRequest.RequestTypeReservedBits = 0;    // set these bits to zero for Cypress-specific 'vendor request' rather that user defined
    vendorRequest.Index = 0;

    //send all but last chunk
    vendorRequest.Value = (short) addr;			//address to write to (starting)
    dataBuffer = new USBIO_DATA_BUFFER(MAX_CONTROL_XFER_SIZE);
    dataBuffer.setNumberOfBytesToTransfer(dataBuffer.Buffer().length);
    index = 0;
    numChunks = bytes.length / MAX_CONTROL_XFER_SIZE;  // this is number of full chunks to send
    ProgressMonitor progressMonitor = makeProgressMonitor("Writing " + numChunks + " " + MAX_CONTROL_XFER_SIZE + " byte chunks FX2 firmware - do not unplug!", 0, numChunks);
    for (int i = 0; i < numChunks; i++) {
        System.arraycopy(bytes, i * MAX_CONTROL_XFER_SIZE, dataBuffer.Buffer(), 0, MAX_CONTROL_XFER_SIZE);
        result = gUsbIo.classOrVendorOutRequest(dataBuffer, vendorRequest);
        if (result != USBIO_ERR_SUCCESS) {
            close();
            throw new HardwareInterfaceException("Error on downloading segment number " + i + " of EEPROM write: " + UsbIo.errorText(result));
        }
        vendorRequest.Value += MAX_CONTROL_XFER_SIZE;			//change address of EEPROM write location
        // can't cancel
        if (progressMonitor.isCanceled()) {
            progressMonitor = makeProgressMonitor("Writing FX2 firmware - do not unplug!", 0, numChunks);
            progressMonitor.setMillisToDecideToPopup(0);
        }
        progressMonitor.setProgress(i);
        progressMonitor.setNote(String.format("wrote %d of %d chunks of FX2 firmware", i, numChunks));
    }

    // now send final (short) chunk
    int numBytesLeft = bytes.length % MAX_CONTROL_XFER_SIZE;  // remainder
    if (numBytesLeft > 0) {
        dataBuffer = new USBIO_DATA_BUFFER(numBytesLeft);
        dataBuffer.setNumberOfBytesToTransfer(dataBuffer.Buffer().length);
        System.arraycopy(bytes, numChunks * MAX_CONTROL_XFER_SIZE, dataBuffer.Buffer(), 0, numBytesLeft);

        // send remaining part of firmware
        result = gUsbIo.classOrVendorOutRequest(dataBuffer, vendorRequest);
        if (result != USBIO_ERR_SUCCESS) {
            close();
            throw new HardwareInterfaceException("Error on downloading final segment of EEPROM write: " + UsbIo.errorText(result) + "\nIs there an EEPROM? Does the device have firmware that can write the EEPROM?");
        }
    }
    progressMonitor.close();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:76,代码来源:CypressFX2.java

示例9: runAnnotation

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
protected boolean runAnnotation(PeakList _peaks,
		Collection<Glycan> _structures, Fragmenter _fragmenter,
		AnnotationOptions _ann_opt) {

	// start activity
	theThread = new AnnotationThread(_peaks, _structures, _fragmenter,
			_ann_opt);
	theThread.start();

	// launch progress dialog
	progressDialog = new ProgressMonitor(theApplication,
			"Matching peaks with fragments", null, 0, theThread.getTarget());

	// set up the timer action
	activityMonitor = new Timer(200, new ActionListener() {
		public void actionPerformed(ActionEvent event) {
			int progress = theThread.getProgress();
			// show progress
			progressDialog.setProgress(progress);

			// check if task is completed or canceled
			if (progress == theThread.getTarget()
					|| progressDialog.isCanceled()) {

				System.err.println("Stopping activity monitor");
				activityMonitor.stop();
				progressDialog.close();

				if (progress != theThread.getTarget()) {
					theThread.interrupt();
					onAnnotationAborted(theThread);
				} else {
					onAnnotationCompleted(theThread);
				}

			}
		}
	});
	System.err.println("Starting activity monitor");
	activityMonitor.start();

	// return control
	return true;
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:45,代码来源:AnnotationPlugin.java

示例10: ParallelCoordinatesChart

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * Instantiates a new parallel coordinates chart.
 * 
 * @param dataSheet
 *            the data sheet
 * @param progressMonitor 
 * 			the progress monitor
 * @param id 
 * 				the id
 */
public ParallelCoordinatesChart(DataSheet dataSheet, ProgressMonitor progressMonitor, int id) {
	super(dataSheet, id);
	this.setLocation(new Point(100, 100));
	this.setFrameSize(new Dimension(1280, 800));
	log("constructor called. Read Base settings.");
	UserPreferences userPreferences = UserPreferences.getInstance();
	this.backGroundColor = userPreferences.getParallelCoordinatesDefaultBackgroundColor();
	this.showDesignIDs = userPreferences.isParallelCoordinatesShowDesignIDs();
	this.showFilteredDesigns = userPreferences.isParallelCoordinatesShowFilteredDesigns();
	this.verticallyOffsetAxisLabels = userPreferences.isParallelCoordinatesVerticallyOffsetAxisLabels();
	this.setActiveDesignColor(userPreferences.getParallelCoordinatesActiveDesignDefaultColor());
	this.selectedDesignColor = userPreferences.getParallelCoordinatesSelectedDesignDefaultColor();
	this.setFilteredDesignColor(userPreferences.getParallelCoordinatesFilteredDesignDefaultColor());
	this.designLabelFontSize = userPreferences.getParallelCoordinatesDesignLabelFontSize();
	this.lineThickness = userPreferences.getParallelCoordinatesLineThickness();
	this.selectedDesignsLineThickness = userPreferences.getParallelCoordinatesSelectedDesignLineThickness();
	this.filterColor = userPreferences.getParallelCoordinatesFilterDefaultColor();
	this.showOnlySelectedDesigns = userPreferences.isParallelCoordinatesShowOnlySelectedDesigns();
	this.filterHeight = userPreferences.getParallelCoordinatesFilterHeight();
	this.filterWidth = userPreferences.getParallelCoordinatesFilterWidth();
	log("constructor: Base settings read. Creating axes...");
	progressMonitor.setMaximum(dataSheet.getParameterCount() - 1);
	progressMonitor.setNote("Building Chart...");
	for (int i = 0; i < dataSheet.getParameterCount() && !progressMonitor.isCanceled(); i++) {
		// log("constructor: Creating axis "+dataSheet.getParameter(i).getName());
		Axis newAxis = new Axis(dataSheet, this, dataSheet.getParameter(i));
		this.addAxis(newAxis);
		progressMonitor.setProgress(i);
	}

	if (!progressMonitor.isCanceled()) {
		progressMonitor.setNote("Building Filters...");
		progressMonitor.setProgress(0);
		// log("constructor: axes created. Creating filters...");
		for (int i = 0; i < dataSheet.getParameterCount() && !progressMonitor.isCanceled(); i++) {
			this.axes.get(i).addFilters();
			progressMonitor.setProgress(i);
		}
		// log("constructor: filters created. ");
	}

}
 
开发者ID:enguerrand,项目名称:xdat,代码行数:53,代码来源:ParallelCoordinatesChart.java

示例11: importData

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * Fills the DataSheet with data from a given file and assigns Parameter
 * names.r
 * <p>
 * If dataHasHeaders is true, the Parameter names are read from the first
 * line. Otherwise the parameter names are created automatically.
 * 
 * @param pathToInputFile
 *            the path to the input file
 * @param dataHasHeaders
 *            specifies whether the data has headers to read the Parameter
 *            names from.
 * @param progressMonitor
 *            the progress monitor.
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 */
private void importData(String pathToInputFile, boolean dataHasHeaders, ProgressMonitor progressMonitor) throws IOException {
	Vector<Design> buffer = new Vector<Design>(0, 1);
	if (this.data != null) {
		buffer = (Vector<Design>) this.data.clone();
	}
	int lineCount = getLineCount(pathToInputFile);
	progressMonitor.setMaximum(lineCount);

	BufferedReader f;
	String line;
	int idCounter = 1;
	f = new BufferedReader(new FileReader(pathToInputFile));
	line = (f.readLine()).trim();

	String[] lineElements = line.split(this.delimiter);
	if (dataHasHeaders) // if data has headers read the parameter names from
						// the first line
	{
		for (int i = 0; i < lineElements.length; i++) {
			this.parameters.add(new Parameter(this.getUniqueParameterName(lineElements[i]), this));
		}
	} else // if data does not have headers read the first Design from the first line and create default Parameter names
	{
		Design newDesign = new Design(idCounter++);
		for (int i = 0; i < lineElements.length; i++) {
			this.parameters.add(new Parameter("Parameter " + (i + 1), this));
			newDesign.setValue(this.parameters.get(i), lineElements[i]);

		}
		this.data.add(newDesign);
		this.designIdsMap.put(newDesign.getId(), newDesign);
		progressMonitor.setProgress(idCounter - 1);
	}
	try {
		readDesignsFromFile(progressMonitor, f, idCounter);
	} catch (IOException e) {

		this.data = buffer;
		throw e;
	}
	f.close();
	if (progressMonitor.isCanceled()) {
		this.data = buffer;
	}

	// this loop ensures that all discrete levels are known to the parameter
	// so it returns the right double values
	for (int i = 0; i < this.parameters.size(); i++) {
		if (!this.parameters.get(i).isNumeric()) {
			this.parameters.get(i).getMaxValue();
		}
	}
}
 
开发者ID:enguerrand,项目名称:xdat,代码行数:71,代码来源:DataSheet.java

示例12: readDesignsFromFile

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * @param progressMonitor
 *            the Progress Monitor to be updated during import
 * @param f
 *            a BufferedReader
 * @param idCounter
 *            The current value of the design id incremental counter
 * @throws IOException
 */
private void readDesignsFromFile(ProgressMonitor progressMonitor, BufferedReader f, int idCounter) throws IOException {
	String line;
	String[] lineElements;
	while ((line = f.readLine()) != null && !progressMonitor.isCanceled()) // read all  subsequent lines  into Designs
	{
		progressMonitor.setProgress(idCounter - 1);
		Design newDesign;
		lineElements = line.split(this.delimiter);
		if (lineElements.length < 1) {
			// skip line
		} else {
			newDesign = new Design(idCounter++);
			boolean newDesignContainsValues = false; // flag to prevent
														// reading in empty
														// lines
			for (int i = 0; i < lineElements.length; i++) {
				if (lineElements[i].length() > 0 && (!lineElements[i].equals(new String("\\s")))) {
					newDesignContainsValues = true; // found non-empty empty
													// field on the line
				}

			}
			if (newDesignContainsValues) // only continue if at least one
											// non-empty field was found on
											// the line
			{
				for (int i = 0; i < this.parameters.size(); i++) {
					if (lineElements.length <= i || lineElements[i].length() <= 0 || lineElements[i].equals(new String("\\s"))) {
						newDesign.setValue(this.parameters.get(i), "-");
					} else {
						newDesignContainsValues = true; // found a non-empty
														// field on the line
						newDesign.setValue(this.parameters.get(i), lineElements[i]);
					}
					// log("importData: design ID "+newDesign.getId()+": setting value of parameter "+this.parameters.get(i).getName()+" to "+newDesign.getStringValue(this.parameters.get(i)));

				}
				this.data.add(newDesign);
				this.designIdsMap.put(newDesign.getId(), newDesign);
			}
		}
	}
}
 
开发者ID:enguerrand,项目名称:xdat,代码行数:53,代码来源:DataSheet.java

示例13: tableChanged

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public void tableChanged(TableModelEvent e) {
	super.tableChanged(e);
	if (e.getType() == DataTableModelEvent.CUSTOM_TABLE_MODEL_TYPE) {
		DataTableModelEvent ec = (DataTableModelEvent) e;
		// log("tableChanged: columnIndex: "+columnIndex+", firstRow = "+e.getFirstRow()+", lastRow = "+e.getLastRow()+", Type = "+e.getType()+", source = "+e.getSource());
		// log("tableChange: this.mainWindow: "+this.mainWindow);
		// log("TableModelEventIDs: Allcols:"+TableModelEvent.ALL_COLUMNS+", Delete:"+TableModelEvent.DELETE+", Insert:"+TableModelEvent.INSERT+", Header:"+TableModelEvent.HEADER_ROW+", Update:"+TableModelEvent.UPDATE);
		boolean[] autofitRequired = ec.getAxisAutofitRequired();
		boolean[] resetFiltersRequired = ec.getAxisResetFilterRequired();
		boolean[] applyFiltersRequired = ec.getAxisApplyFiltersRequired();

		final ProgressMonitor progressMonitor = new ProgressMonitor(this.getParent(), "", "Rebuilding charts", 0, this.mainWindow.getDataSheet().getParameterCount() - 1);
		progressMonitor.setMillisToPopup(0);

		for (int i = 0; i < this.mainWindow.getDataSheet().getParameterCount() && !progressMonitor.isCanceled(); i++) {
			final int progress = i;
			SwingUtilities.invokeLater(new Runnable() {
				public void run() {
					progressMonitor.setProgress(progress);
				}
			});
			if (autofitRequired[i]) {
				// log("tableChanged:  autofitRequired");
				this.mainWindow.autofitAxisAllChartFrames(i);
			}
			if (resetFiltersRequired[i]) {
				// log("tableChanged:  resetFiltersRequired");
				this.mainWindow.resetFiltersOnAxisAllChartFrames(i);
			}
			if (applyFiltersRequired[i]) {
				// log("tableChanged:  applyFiltersRequired");
				this.mainWindow.refilterAllChartFrames(i);
			}
		}
		if (ec.isChartRebuildRequired()) {
			log("tableChanged: isChartRebuildRequired ");
			this.mainWindow.rebuildAllChartFrames();
		}
		if (ec.isChartRepaintRequired()) {
			log("tableChanged:isChartRepaintRequired  ");
			this.mainWindow.repaintAllChartFrames();
		}
		if (ec.isDataPanelUpdateRequired()) {
			log("tableChanged:isDataPanelUpdateRequired  ");
			this.mainWindow.updateDataPanel();
		}

		progressMonitor.close();
	}
}
 
开发者ID:enguerrand,项目名称:xdat,代码行数:52,代码来源:DataTable.java

示例14: loadVenueData

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public Vector loadVenueData(Component parent) throws Exception {

		headers = null;
		Socket s = null;
		ProgressMonitor progress = null;
		Vector venues = null;

		try
		{
			StallInputStream stallInput = new StallInputStream();

			ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(
					parent, "Loading filter data from pente.org", stallInput);
			progress = pmis.getProgressMonitor();
            progress.setNote("Connecting to pente.org...");
			progress.setMillisToDecideToPopup(1);
            progress.setMillisToPopup(1);
            progress.setMaximum(15000);

			StringBuffer paramsBuffer = new StringBuffer();
	        StringBuffer requestBuffer = createHttpRequest(paramsBuffer, "/venues");

	        int len = 0;

        	s = getHttpResponseSocket(requestBuffer);
        	progress.setProgress(2000);
            progress.setNote("Downloading from pente.org...");

            // read past the http headers to the data
            InputStream in = s.getInputStream();
            String contentLength = getHeader("content-length:", in);
            if (contentLength != null) {
            	len = Integer.parseInt(contentLength);
            }
//            for (int i = 0; i < len; i++) {
//            	int b = in.read();
//            	if (b == -1) {
//            		System.out.println("error");
//            	}
//            }

        	progress.setMaximum(len);
        	stallInput.setInputStream(in);

        	ObjectInputStream objectIn = new ObjectInputStream(pmis);
			venues = (Vector) objectIn.readObject();

        } catch (Exception e) {
        	if (s != null) {
        		s.close();
            	s = null;
        	}
			if (!(e instanceof InterruptedException) && !(progress == null || !progress.isCanceled())) {
				throw e;
			}
        }

        return venues;
	}
 
开发者ID:dweebo,项目名称:pentedb,代码行数:60,代码来源:PlunkHttpLoader.java

示例15: installDataFromFiles

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
protected Document installDataFromFiles(Component parentComponent, File[] files, File directory,String datasetName,Sector bbox) throws Exception {
		
		// Create a ProgressMonitor that will provide feedback on how
		final ProgressMonitor progressMonitor = new ProgressMonitor(parentComponent, "Importing "+datasetName, null, 0, 100);

		final AtomicInteger progress = new AtomicInteger(0);
		
		final DataStoreProducer producer = getProducer(files,bbox,datasetName,progressMonitor,progress);

		progressMonitor.setProgress(0);

		// Configure a timer to check if the user has clicked the ProgressMonitor's "Cancel" button. If so, stop
		// production as soon as possible. This just stops the production from completing; it doesn't clean up any state
		// changes made during production,
		java.util.Timer progressTimer = new java.util.Timer();
		progressTimer.schedule(new TimerTask() {
			public void run() {
				progressMonitor.setProgress(progress.get());

				if (progressMonitor.isCanceled()) {
					producer.stopProduction();
					this.cancel();
				}
			}
		}, progressMonitor.getMillisToDecideToPopup(), 100L);

		Document doc = null;
		try {
			// Install the file into the specified FileStore.
			doc = ImportUtils.createDataStore(files, directory, producer,datasetName);

			// Create a raster server configuration document if the installation was successful
			// and we're not converting a WW.NET tile set to a WW Java tile set.
			// The raster server document enables the layer or elevation model (created to display this data)
			// to create tiles from the original sources at runtime.
			if (doc != null && !(producer instanceof WWDotNetLayerSetConverter)) ImportUtils.createRasterServerConfigDoc(directory, producer);

			// The user clicked the ProgressMonitor's "Cancel" button. Revert any change made during production, and
			// discard the returned DataConfiguration reference.
			if (progressMonitor.isCanceled()) {
				doc = null;
				producer.removeProductionState();
			}
		} finally {
			// Remove the progress event listener from the DataStoreProducer. stop the progress timer, and signify to the
			// ProgressMonitor that we're done.
//			producer.removePropertyChangeListener(progressListener);TODO FIXME
			producer.removeAllDataSources();
			progressMonitor.close();
			progressTimer.cancel();
		}

		return doc;
	}
 
开发者ID:TrilogisIT,项目名称:FAO_Application,代码行数:55,代码来源:GUIClass.java


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