use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class AnomalyProductionTrackingDetailsHooks method updateRibbon.
private void updateRibbon(final ViewDefinitionState view) {
try {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName(L_ACTIONS);
RibbonActionItem perform = actions.getItemByName("perform");
RibbonActionItem performAndAccept = actions.getItemByName("performAndAccept");
boolean performAndAcceptFlag = view.getJsonContext().getBoolean("window.mainTab.form.performAndAccept");
perform.setEnabled(!performAndAcceptFlag);
performAndAccept.setEnabled(performAndAcceptFlag);
perform.requestUpdate(true);
performAndAccept.requestUpdate(true);
} catch (JSONException e) {
}
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class StoppageForOrderFormHooks method onRibbonBeforeRender.
public final void onRibbonBeforeRender(final ViewDefinitionState view) throws JSONException {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup actionsRibbonGroup = ribbon.getGroupByName("actions");
RibbonActionItem addNew = actionsRibbonGroup.getItemByName("new");
RibbonActionItem copy = actionsRibbonGroup.getItemByName("copy");
JSONObject context = view.getJsonContext();
if (context.has("window.mainTab.stoppage.forOrder")) {
Entity order = dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER).get(context.getLong("window.mainTab.stoppage.forOrder"));
if (OrderState.DECLINED.getStringValue().equals(order.getStringField(OrderFields.STATE))) {
addNew.setEnabled(false);
addNew.requestUpdate(true);
copy.setEnabled(false);
copy.requestUpdate(true);
}
}
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class GeneratorView method setActionsGroupButtonEnabled.
public void setActionsGroupButtonEnabled(boolean enabled, boolean msg, String itemName) {
RibbonGroup actions = (RibbonGroup) window.getRibbon().getGroupByName("actions");
RibbonActionItem saveButton = actions.getItemByName(itemName);
saveButton.setEnabled(enabled);
saveButton.requestUpdate(true);
if (!enabled && msg) {
saveButton.setMessage("technologiesGenerator.generateTechnologyInProgress");
}
window.requestRibbonRender();
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class GeneratorView method getRibbonItemByName.
private RibbonActionItem getRibbonItemByName(String itemName) {
Ribbon ribbon = window.getRibbon();
RibbonGroup generateGroup = ribbon.getGroupByName("generate");
return generateGroup.getItemByName(itemName);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class TechnologyReferenceTechnologyComponentDetailsHooks method disabledSaveBackButton.
public void disabledSaveBackButton(final ViewDefinitionState viewDefinitionState) {
WindowComponent window = (WindowComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actionsGroup = (RibbonGroup) window.getRibbon().getGroupByName("actions");
RibbonActionItem saveBack = (RibbonActionItem) actionsGroup.getItemByName("saveBack");
LookupComponent technology = (LookupComponent) viewDefinitionState.getComponentByReference("technology");
if (technology.getEntity() == null) {
saveBack.setEnabled(false);
} else {
saveBack.setEnabled(true);
}
saveBack.requestUpdate(true);
}
Aggregations