Show GraphicsCanvas.java syntax highlighted
/*
* Copyright (c) 2004
* Helsinki Institute of Physics
* see LICENSE file for details
*
* GraphicsCanvas.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.LiteDescription;
import fi.hip.gb.midlet.core.LiteResult;
/**
* Shows results with graphics content. New jobs can be
* created by cropping areas from the image.
*
* @author Juho Karppinen
*/
public class GraphicsCanvas extends GenericImageCanvas {
/** description used to re-dispatch the job with new crop values */
private LiteDescription wds = null;
/** command for saving the image to memory */
protected Command saveCommand = new Command("Save result", Command.SCREEN, 2);
/** show the information about the results */
protected Command infoCommand = new Command("Information", Command.SCREEN, 1);
/**
* Create canvas for showing graphical content.
*
* @param resultData container for result images
* @param description description used to create this results. It will
* be used as a basis when re-dispatching jobs with different crop values.
*/
public GraphicsCanvas(LiteResult resultData, LiteDescription description) {
super(resultData);
this.wds = description;
/*
if(data.getRecordID() == -1) {
addCommand(this.saveCommand);
}
*/
if(this.wds != null) {
addCommand( new Command("Dispatch", Command.SCREEN, 2));
}
addCommand(infoCommand);
addCommand(new Command("Back", Command.BACK, 1));
}
public void commandAction(Command c, Displayable disp) {
if ((c.getCommandType() == Command.BACK)) {
MIDui.back(true);
} else if(c == saveCommand) {
removeCommand(saveCommand);
MIDui.saveResult(data);
} else if(c.getLabel().equals("Dispatch")) {
MIDui.dispatchJob(getDescription(this.wds));
} else if (c == this.infoCommand) {
MIDui.next(new InfoForm(this.data, "Result information"));
}
}
}
See more files for this project here