Code Search for Developers
 
 
  

PictureCanvas.java from GridBlocks at Krugle


Show PictureCanvas.java syntax highlighted

/*
 * Copyright (c) 2004
 * Helsinki Institute of Physics
 * see LICENSE file for details
 *
 * PictureCanvas.java
 * Created on Sep 12, 2004
 */
package fi.hip.gb.client;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

import fi.hip.gb.midlet.core.LiteResult;

/**
 * Shows pictures taken with integrated camera.
 * 
 * @author Juho Karppinen
 */
public class PictureCanvas extends GenericImageCanvas {
	/** command for saving the image to memory */
	private Command saveCommand;
    
    public PictureCanvas(LiteResult imageData) {
        super(imageData);
        
        addCommand(new Command("Thumbs", Command.BACK, 1));
		addCommand(new Command("Capture new", Command.SCREEN, 3));
		addCommand(new Command("Send as parameter", Command.SCREEN, 4));
		
		if(imageData.getRecordID() == -1) {
		    // image not saved yet
			saveCommand = new Command("Save picture", Command.SCREEN, 2);
			addCommand(saveCommand);
		} else {
		    // image exists on persistent memory
			addCommand(new Command("Delete picture", Command.SCREEN, 2));
		}
    }
    
    public void commandAction(Command c, Displayable disp) {
		if ((c.getCommandType() == Command.BACK)) {
			MIDui.back(true);
		} else if(c.getLabel().equals("Capture new")) {
			MIDui.showCamera();
		} else if(c.getLabel().equals("Save picture")) {
			removeCommand(saveCommand);
			MIDui.savePicture(data);
		} else if(c.getLabel().equals("Delete picture")) {
			MIDui.deletePicture(data, true);
		} else if(c.getLabel().equals("Send as parameter")) {
			MIDui.showDispatch(null, data);
		}
	}
}




See more files for this project here

GridBlocks

GridBlocks builds a grid application framework via easy-to-use building blocks in distributed environment. The framework offers components for Grid security, distributed storage, computing, and Portlet web interfaces.

Project homepage: http://sourceforge.net/projects/gridblocks
Programming language(s): Java,JSP,XML
License: other

  BluetoothBrowser.java
  Broadcasts.java
  CameraCanvas.java
  Configs.java
  DispatchForm.java
  GPSForm.java
  GenericImageCanvas.java
  GenericResultForm.java
  GraphicsCanvas.java
  InfoForm.java
  InputUI.java
  JobsForm.java
  Logging.java
  MIDui.java
  MediaPlayer.java
  PictureCanvas.java
  ProgressForm.java
  Results.java
  StatusForm.java
  TextForm.java
  Thumbnails.java