Search in sources :

Example 6 with InternalRibbonActionItem

use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.

the class RibbonTemplates method createFormDeactivateAction.

private InternalRibbonActionItem createFormDeactivateAction(final ViewDefinition viewDefinition) {
    InternalRibbonActionItem ribbonDeactivateAction = new RibbonActionItemImpl();
    ribbonDeactivateAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performDeactivate;", viewDefinition));
    ribbonDeactivateAction.setIcon("unactiveNotVisibleIcon.png");
    ribbonDeactivateAction.setName("deactivate");
    ribbonDeactivateAction.setEnabled(false);
    ribbonDeactivateAction.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);");
    ribbonDeactivateAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
    return ribbonDeactivateAction;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 7 with InternalRibbonActionItem

use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.

the class RibbonTemplates method createGridExportCsvAction.

private InternalRibbonActionItem createGridExportCsvAction(final ViewDefinition viewDefinition) {
    InternalRibbonActionItem ribbonExportCsvAction = new RibbonActionItemImpl();
    ribbonExportCsvAction.setIcon("exportToCsvIcon16.png");
    ribbonExportCsvAction.setName("csv");
    ribbonExportCsvAction.setEnabled(true);
    ribbonExportCsvAction.setScript("var listener = {onClick: function() {#{grid}.performEvent('exportToCsv', [], 'exportToCsv');}};" + " this.addOnChangeListener(listener);");
    ribbonExportCsvAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
    return ribbonExportCsvAction;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 8 with InternalRibbonActionItem

use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.

the class RibbonTemplates method createFormDeleteAction.

private InternalRibbonActionItem createFormDeleteAction(final ViewDefinition viewDefinition) {
    InternalRibbonActionItem ribbonDeleteAction = new RibbonActionItemImpl();
    ribbonDeleteAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performDelete;", viewDefinition));
    ribbonDeleteAction.setIcon("deleteIcon16.png");
    ribbonDeleteAction.setName("delete");
    ribbonDeleteAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
    ribbonDeleteAction.setEnabled(false);
    ribbonDeleteAction.setDefaultEnabled(false);
    ribbonDeleteAction.setScript("var listener = {onSetValue: function(value) {if (!value || !value.content) return; if (value.content.entityId) {" + "this.enable();} else {this.disable();}}}; #{form}.addOnChangeListener(listener);");
    return ribbonDeleteAction;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 9 with InternalRibbonActionItem

use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.

the class RibbonTemplates method createFormCancelAction.

private InternalRibbonActionItem createFormCancelAction(final ViewDefinition viewDefinition) {
    InternalRibbonActionItem ribbonCancelAction = new RibbonActionItemImpl();
    ribbonCancelAction.setAction(RibbonUtils.translateRibbonAction("#{form}.performCancel;", viewDefinition));
    ribbonCancelAction.setIcon("cancelIcon16.png");
    ribbonCancelAction.setName("cancel");
    ribbonCancelAction.setEnabled(true);
    ribbonCancelAction.setType(RibbonActionItem.Type.SMALL_BUTTON);
    return ribbonCancelAction;
}
Also used : RibbonActionItemImpl(com.qcadoo.view.internal.ribbon.model.RibbonActionItemImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem)

Example 10 with InternalRibbonActionItem

use of com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem in project qcadoo by qcadoo.

the class TemplateRibbonGroup method getRibbonGroup.

public InternalRibbonGroup getRibbonGroup(final RibbonTemplateParameters parameters, final ViewDefinition viewDefinition) {
    if (!PluginUtils.isEnabled(pluginIdentifier)) {
        return null;
    }
    List<InternalRibbonActionItem> itemsToApply = getFilteredList(parameters);
    if (itemsToApply.isEmpty()) {
        return null;
    }
    if (!checkCondition(condition, viewDefinition)) {
        return null;
    }
    InternalRibbonGroup group = new RibbonGroupImpl(name);
    for (InternalRibbonActionItem item : itemsToApply) {
        InternalRibbonActionItem itemCopy = item.getCopy();
        translateRibbonAction(itemCopy, viewDefinition);
        group.addItem(itemCopy);
    }
    return group;
}
Also used : RibbonGroupImpl(com.qcadoo.view.internal.ribbon.model.RibbonGroupImpl) InternalRibbonActionItem(com.qcadoo.view.internal.ribbon.model.InternalRibbonActionItem) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)

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