Search in sources :

Example 16 with InternalRibbonActionItem

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;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 17 with InternalRibbonActionItem

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;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 18 with InternalRibbonActionItem

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;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 19 with InternalRibbonActionItem

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;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 20 with InternalRibbonActionItem

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);
        }
    }
}
Also used : RibbonComboItem(com.qcadoo.view.api.ribbon.RibbonComboItem) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Aggregations

InternalRibbonActionItem (com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)21 RibbonActionItemImpl (com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl)18 InternalRibbonGroup (com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)4 RibbonGroupImpl (com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl)4 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)3 RibbonComboItem (com.qcadoo.view.api.ribbon.RibbonComboItem)2 RibbonComboBox (com.qcadoo.view.api.ribbon.RibbonComboBox)1 InternalRibbonComboItem (com.qcadoo.view.internal.ribbon.model.InternalRibbonComboItem)1 RibbonComboBoxImpl (com.qcadoo.view.internal.ribbon.model.RibbonComboBoxImpl)1 RibbonComboItemImpl (com.qcadoo.view.internal.ribbon.model.RibbonComboItemImpl)1 ViewDefinitionParserNodeException (com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1