use of edu.cmu.cs.hcii.cogtool.ui.DesignSelectionState in project cogtool by cogtool.
the class ProjectController method createEditDesignAction.
// interactToRenameTask
// Action for EditDesign
protected IListenerAction createEditDesignAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return DesignSelectionState.class;
}
public boolean performAction(Object prms) {
DesignSelectionState selection = (DesignSelectionState) prms;
// FrameUIModel.LoadingTime = 0;
// long start = System.currentTimeMillis();
// System.out.println("\nEditDesign:" + start + " { ");
Design selectedDesign = selection.getSelectedDesign();
// Can only edit a selected design.
if (selectedDesign != null) {
// Open or create a window for the selected design
DesignEditorController.openController(selectedDesign, project);
return true;
}
interaction.protestNoSelection();
return false;
}
};
}
use of edu.cmu.cs.hcii.cogtool.ui.DesignSelectionState in project cogtool by cogtool.
the class ProjectController method createDeleteDesignAction.
// createInitiateTaskRenameAction
// Action for DeleteDesign
protected IListenerAction createDeleteDesignAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return DesignSelectionState.class;
}
public boolean performAction(Object prms) {
DesignSelectionState selection = (DesignSelectionState) prms;
Design selectedDesign = selection.getSelectedDesign();
// Can only delete if a design is currently selected.
if (selectedDesign != null) {
if (interaction.confirmDeleteDesign(selectedDesign)) {
// Delete selected design, without copying
// to the clipboard.
deleteDesign(selectedDesign, null);
return true;
}
} else {
interaction.protestNoSelection();
}
return false;
}
};
}
use of edu.cmu.cs.hcii.cogtool.ui.DesignSelectionState in project cogtool by cogtool.
the class ProjectController method createAddDesignDevicesAction.
// createNewDesignAction2
protected IListenerAction createAddDesignDevicesAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return DesignSelectionState.class;
}
public boolean performAction(Object prms) {
DesignSelectionState selection = (DesignSelectionState) prms;
Design design = selection.getSelectedDesign();
if (design != null) {
return DesignCmd.addDevices(project, design, interaction);
}
interaction.protestNoSelection();
return true;
}
};
}
use of edu.cmu.cs.hcii.cogtool.ui.DesignSelectionState in project cogtool by cogtool.
the class ProjectController method createCopyDesignAction.
// Action for CopyDesign
protected IListenerAction createCopyDesignAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return DesignSelectionState.class;
}
public boolean performAction(Object prms) {
DesignSelectionState seln = (DesignSelectionState) prms;
Design design = seln.getSelectedDesign();
// Can only copy if a design is currently selected.
if (design != null) {
try {
ObjectSaver s = CogToolClipboard.startClipboardDesignSave(project, CogToolClipboard.SAVE_TO_CLIPBOARD);
saveDesignToClipboard(design, s);
s.finish();
interaction.setStatusMessage(DESIGN_COPIED);
return true;
} catch (IOException e) {
throw new RcvrClipboardException(e);
} catch (OutOfMemoryError error) {
throw new RcvrOutOfMemoryException("Copying Design", error);
}
} else {
interaction.protestNoSelection();
}
return false;
}
};
}
use of edu.cmu.cs.hcii.cogtool.ui.DesignSelectionState in project cogtool by cogtool.
the class ProjectController method createImportWebCrawlAction.
protected IListenerAction createImportWebCrawlAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return DesignSelectionState.class;
}
public boolean performAction(Object prms) {
DesignSelectionState selection = (DesignSelectionState) prms;
ProjectInteraction.IWebCrawlImport importParms = interaction.requestWebCrawlParms(project, WebCrawler.DEFAULT_MAX_TO_CRAWL);
if (importParms != null) {
String designName = importParms.getDesignName();
Design design;
if (designName == null) {
ProjectInteraction.DesignRequestData requestData = requestNewDesignParms(false);
if (requestData == null) {
// canceled!
return false;
}
design = new Design(requestData.designName, requestData.deviceTypes);
} else {
design = project.getDesign(designName);
}
int defaultDepth = importParms.getDefaultDepth();
List<URLCrawlEntry> urls = importParms.getURLsToCrawl();
if ((urls == null) || (urls.size() == 0)) {
interaction.reportProblem(ImportWebCrawlThread.IMPORT_WEB_CRAWL, noURLsToCrawlError);
return false;
}
// If new, indicate that the work thread should add the
// new design to the project when it completes;
// -1 indicates that the design is *not* new.
int beforeIndex = ImportWebCrawlThread.EXISTING_DESIGN;
if (designName == null) {
Design selectedDesign = selection.getSelectedDesign();
beforeIndex = (selectedDesign != null) ? (project.getDesigns().indexOf(selectedDesign) + 1) : project.getDesigns().size();
}
ImportWebCrawlThread workThread = new ImportWebCrawlThread(interaction, undoMgr, project, design, beforeIndex, importParms.getMaxPages(), defaultDepth, urls, importParms.pruneSameURLs(), importParms.getBrowserWidth(), importParms.getBrowserHeight(), importParms.captureImages());
ThreadManager.startNewThread(workThread);
return true;
}
return false;
}
};
}
Aggregations