use of com.servoy.j2db.cmd.ICmd in project servoy-client by Servoy.
the class PrintPreview method actionPerformed.
public void actionPerformed(ActionEvent ae) {
String command = ae.getActionCommand();
if (// $NON-NLS-1$
command.equals("print")) {
startPrinting(application, fpp.getPageable(), printerJob, preferredPrinterName, true, false);
} else if (// true); //$NON-NLS-1$
command.equals("pagesetup"))
// true); //$NON-NLS-1$
setPageFormat();
else if (// $NON-NLS-1$
command.equals("pageprevious"))
// $NON-NLS-1$
show(-1);
else if (// $NON-NLS-1$
command.equals("pagenext"))
// $NON-NLS-1$
show(+1);
else if (// $NON-NLS-1$
command.equals("close")) {
ICmdManager cm = application.getCmdManager();
// $NON-NLS-1$
Action a = cm.getRegisteredAction("cmdbrowsemode");
ICmd cmd = (ICmd) a;
cmd.doIt(ae);
}
}
use of com.servoy.j2db.cmd.ICmd in project servoy-client by Servoy.
the class CmdManager method propertyChange.
public void propertyChange(PropertyChangeEvent evt) {
String name = evt.getPropertyName();
if (// $NON-NLS-1$
"repository".equals(name)) {
final IRepository repository = (IRepository) evt.getNewValue();
// $NON-NLS-1$
Action cmdnewsolution = actions.get("cmdnewsolution");
if (cmdnewsolution != null)
cmdnewsolution.setEnabled(repository != null);
if (autoOpenSolutionSelectDialog) {
// $NON-NLS-1$
final Action cmdopensolution = actions.get("cmdopensolution");
if (cmdopensolution != null) {
application.invokeLater(new Runnable() {
public void run() {
cmdopensolution.setEnabled(repository != null);
if (repository != null) {
try {
if (repository.getRootObjectMetaDatasForType(IRepository.SOLUTIONS).length != 0 && application.getSolution() == null && (application.getFlattenedSolution() == null || !application.getFlattenedSolution().isLoadingSolution())) {
executeCmd((ICmd) cmdopensolution, null);
}
} catch (Exception ex) {
Debug.error(ex);
}
}
}
});
}
}
} else if (// $NON-NLS-1$
"solution".equals(name)) {
Solution solution = (Solution) evt.getNewValue();
ableFormRelatedBrowseActions(solution != null);
ableFormRelatedDataEditActions(solution != null);
undoAction.setEnabled(solution != null);
redoAction.setEnabled(solution != null);
// $NON-NLS-1$
Action cmdclose = actions.get("cmdclose");
if (cmdclose != null)
cmdclose.setEnabled(solution != null);
// $NON-NLS-1$
Action cmdsolutionsettings = actions.get("cmdsolutionsettings");
if (cmdsolutionsettings != null)
cmdsolutionsettings.setEnabled(solution != null);
// TODO:could be optimized by using fast method getFormCount
if (solution != null && application.getFlattenedSolution().getForms(false).hasNext()) {
ableFormRelatedActions(true);
} else {
ableFormRelatedActions(false);
}
} else if (// $NON-NLS-1$
"mode".equals(name)) {
int oldmode = ((Integer) evt.getOldValue()).intValue();
// $NON-NLS-1$
Action menuselectaction = actions.get("menuselectaction");
int mode = ((Integer) evt.getNewValue()).intValue();
switch(mode) {
case IModeManager.FIND_MODE:
break;
case IModeManager.PREVIEW_MODE:
break;
case IModeManager.EDIT_MODE:
default:
if (menuselectaction != null)
menuselectaction.setEnabled(true);
}
ableFormRelatedFindActions(mode == IModeManager.FIND_MODE);
// $NON-NLS-1$
Action cmdfindmode = actions.get("cmdfindmode");
if (cmdfindmode != null)
cmdfindmode.setEnabled(mode == IModeManager.EDIT_MODE);
if (mode == IModeManager.FIND_MODE) {
ableFormRelatedBrowseActions(false);
ableFormRelatedDataEditActions(true);
} else {
ableFormRelatedBrowseActions(mode == IModeManager.EDIT_MODE);
}
} else if (// $NON-NLS-1$
"formCreated".equals(name)) {
ableFormRelatedActions(evt.getNewValue() != null);
} else if (// $NON-NLS-1$
"undomanager".equals(name)) {
String sUndoRedo = (String) evt.getOldValue();
Boolean bValue = (Boolean) evt.getNewValue();
Action menuUndoRedo = actions.get(sUndoRedo);
if (menuUndoRedo != null)
menuUndoRedo.setEnabled(bValue.booleanValue());
}
}
Aggregations