use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.
the class RibbonTemplates method createFormCopyAction.
private InternalRibbonActionItem createFormCopyAction(final ViewDefinition viewDefinition) {
InternalRibbonActionItem ribbonCopyAction = new RibbonActionItemImpl();
ribbonCopyAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performCopy;", viewDefinition));
ribbonCopyAction.setIcon("copyIcon16.png");
ribbonCopyAction.setName("copy");
ribbonCopyAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
ribbonCopyAction.setEnabled(false);
ribbonCopyAction.setDefaultEnabled(false);
ribbonCopyAction.setScript("var listener = {onSetValue: function(value) {if (!value || !value.content) return; if (value.content.entityId) {" + "this.enable();} else {this.disable();}}}; #{form}.addOnChangeListener(listener);");
return ribbonCopyAction;
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.
the class RibbonTemplates method createFormActivateAction.
private InternalRibbonActionItem createFormActivateAction(final ViewDefinition viewDefinition) {
InternalRibbonActionItem ribbonActivateAction = new RibbonActionItemImpl();
ribbonActivateAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performActivate;", viewDefinition));
ribbonActivateAction.setIcon("unactiveVisibleIcon.png");
ribbonActivateAction.setName("activate");
ribbonActivateAction.setEnabled(false);
ribbonActivateAction.setScript("var listener = {onSetValue: function(value) {if (!value || !value.content) return; if (value.content.entityId " + "&& !value.content.isActive) {this.enable();} else {this.disable();}}}; #{form}.addOnChangeListener(listener);");
ribbonActivateAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
return ribbonActivateAction;
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.
the class RibbonTemplates method createFormSaveAndNewAction.
private InternalRibbonActionItem createFormSaveAndNewAction(final ViewDefinition viewDefinition) {
InternalRibbonActionItem ribbonSaveNewAction = new RibbonActionItemImpl();
ribbonSaveNewAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performSaveAndClear;", viewDefinition));
ribbonSaveNewAction.setIcon("saveNewIcon16.png");
ribbonSaveNewAction.setName("saveNew");
ribbonSaveNewAction.setEnabled(true);
ribbonSaveNewAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
return ribbonSaveNewAction;
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.
the class RibbonTemplates method createGridActivateAction.
private InternalRibbonActionItem createGridActivateAction(final ViewDefinition viewDefinition) {
InternalRibbonActionItem ribbonActivateAction = new RibbonActionItemImpl();
ribbonActivateAction.setAction(RibbonUtils.translateRibbonAction("#{grid}.performActivate;", viewDefinition));
ribbonActivateAction.setIcon("unactiveVisibleIcon.png");
ribbonActivateAction.setName("activate");
ribbonActivateAction.setEnabled(false);
ribbonActivateAction.setScript("var listener = {onChange: function(selectedArray) {if (selectedArray.length == 0) {" + "this.disable();} else {this.enable();}}}; #{grid}.addOnChangeListener(listener);");
ribbonActivateAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
return ribbonActivateAction;
}
use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.
the class TemplateRibbonGroup method translateRibbonAction.
private void translateRibbonAction(final RibbonActionItem item, final ViewDefinition viewDefinition) {
InternalRibbonActionItem internalItem = (InternalRibbonActionItem) item;
String translatedAction = RibbonUtils.translateRibbonAction(internalItem.getAction(), viewDefinition);
internalItem.setAction(translatedAction);
if (internalItem instanceof RibbonComboItem) {
RibbonComboItem comboItem = (RibbonComboItem) internalItem;
for (RibbonActionItem comboItemElement : comboItem.getItems()) {
translateRibbonAction(comboItemElement, viewDefinition);
}
}
}
Aggregations