use of com.qcadoo.view.api.components.WindowComponent 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);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class GenerateTimeGapsListeners method generateTimeGaps.
public void generateTimeGaps(final ViewDefinitionState viewState, final ComponentState formState, final String[] args) throws ParseException {
FormComponent form = (FormComponent) formState;
Entity contextEntity = form.getPersistedEntityWithIncludedFormValues();
// We don't want to reuse contexts - in case of the user working with many browser tabs to compare a couple of results
contextEntity.setId(null);
contextEntity.setField(TimeGapsContextFields.TIME_GAPS, Collections.<Entity>emptyList());
// Call validation
contextEntity = contextEntity.getDataDefinition().save(contextEntity);
if (!contextEntity.isValid()) {
clearSummaryFields(contextEntity);
form.setEntity(contextEntity);
return;
}
// Generate & persist results
TimeGapsSearchResult searchResult = performGeneration(contextEntity);
Entity persistedContext = persistResults(contextEntity, searchResult);
if (persistedContext.isValid()) {
// Show 'time gaps' tab
WindowComponent window = (WindowComponent) findComponentByReferenceName(viewState, QcadooViewConstants.L_WINDOW);
window.setActiveTab("timeGaps");
}
form.setEntity(persistedContext);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class WorkPlansListView method from.
public static WorkPlansListView from(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
RibbonActionItem deleteButton = window.getRibbon().getGroupByName("actions").getItemByName("delete");
return new WorkPlansListView(window, deleteButton, grid);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class OperationalTaskHooksBPC method getRibbonItem.
private RibbonActionItem getRibbonItem(final ViewDefinitionState view, final String ribbonGroupName, final String ribbonItemName) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup ribbonGroup = ribbon.getGroupByName(ribbonGroupName);
if (ribbonGroup == null) {
return null;
}
return ribbonGroup.getItemByName(ribbonItemName);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class CompanyService method disableButton.
public void disableButton(final ViewDefinitionState view, final String ribbonGroupName, final String ribbonActionItemName, final boolean isEnabled, final String message) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup ribbonGroup = window.getRibbon().getGroupByName(ribbonGroupName);
RibbonActionItem ribbonActionItem = ribbonGroup.getItemByName(ribbonActionItemName);
ribbonActionItem.setEnabled(isEnabled);
if (isEnabled) {
ribbonActionItem.setMessage(null);
} else {
ribbonActionItem.setMessage(message);
}
ribbonActionItem.requestUpdate(true);
}
Aggregations