use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class FaultTypeDetailsHooks method disableActionsWhenDefault.
public void disableActionsWhenDefault(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName("actions");
for (RibbonActionItem item : actions.getItems()) {
item.setEnabled(false);
item.requestUpdate(true);
}
GridComponent workstationsGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.WORKSTATIONS);
GridComponent subassembliesGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.SUBASSEMBLIES);
GridComponent workstationTypesGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.WORKSTATION_TYPES);
workstationsGrid.setEnabled(false);
subassembliesGrid.setEnabled(false);
workstationTypesGrid.setEnabled(false);
FieldComponent nameField = (FieldComponent) view.getComponentByReference(FaultTypeFields.NAME);
FieldComponent appliesToField = (FieldComponent) view.getComponentByReference(FaultTypeFields.APPLIES_TO);
nameField.setEnabled(false);
appliesToField.setEnabled(false);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class FaultTypeListHooks method disableActionsWhenDefault.
private void disableActionsWhenDefault(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName("actions");
RibbonActionItem copyButton = actions.getItemByName("copy");
RibbonActionItem deleteButton = actions.getItemByName("delete");
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
List<Entity> selectedFaults = grid.getSelectedEntities();
for (Entity selectedFault : selectedFaults) {
if (selectedFault.getBooleanField("isDefault")) {
copyButton.setEnabled(false);
deleteButton.setEnabled(false);
copyButton.requestUpdate(true);
deleteButton.requestUpdate(true);
return;
}
}
boolean enabled = !selectedFaults.isEmpty();
copyButton.setEnabled(enabled);
deleteButton.setEnabled(enabled);
copyButton.requestUpdate(true);
deleteButton.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class NumberPatternDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity numberPattern = form.getPersistedEntityWithIncludedFormValues();
if (numberPattern.getBooleanField(NumberPatternFields.USED)) {
form.setFormEnabled(false);
GridComponent grid = (GridComponent) view.getComponentByReference("numberPatternElements");
grid.setEditable(false);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName("actions");
RibbonActionItem save = actions.getItemByName("save");
save.setEnabled(false);
save.requestUpdate(true);
RibbonActionItem saveBack = actions.getItemByName("saveBack");
saveBack.setEnabled(false);
saveBack.requestUpdate(true);
RibbonActionItem saveNew = actions.getItemByName("saveNew");
saveNew.setEnabled(false);
saveNew.requestUpdate(true);
window.requestRibbonRender();
}
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class EventHooks method toggleOldSolutionsButton.
private void toggleOldSolutionsButton(ViewDefinitionState view) {
WindowComponent windowComponent = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = windowComponent.getRibbon();
RibbonGroup solutionsRibbonGroup = ribbon.getGroupByName("solutions");
RibbonActionItem showSolutionsRibbonActionItem = solutionsRibbonGroup.getItemByName("showSolutions");
FormComponent formComponent = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity event = formComponent.getPersistedEntityWithIncludedFormValues();
showSolutionsRibbonActionItem.setEnabled(event.getId() != null);
showSolutionsRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class EventHooks method toggleRibbonButton.
private void toggleRibbonButton(final ViewDefinitionState view, String groupName, String itemName, boolean enabled) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup group = ribbon.getGroupByName(groupName);
RibbonActionItem item = group.getItemByName(itemName);
item.setEnabled(enabled);
item.requestUpdate(true);
}
Aggregations