Search in sources :

Example 11 with WindowComponent

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 12 with WindowComponent

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);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) WindowComponent(com.qcadoo.view.api.components.WindowComponent) TimeGapsSearchResult(com.qcadoo.mes.timeGapsPreview.TimeGapsSearchResult)

Example 13 with WindowComponent

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);
}
Also used : WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 14 with WindowComponent

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon)

Example 15 with WindowComponent

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Aggregations

WindowComponent (com.qcadoo.view.api.components.WindowComponent)105 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)93 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)75 FormComponent (com.qcadoo.view.api.components.FormComponent)51 Entity (com.qcadoo.model.api.Entity)46 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)31 GridComponent (com.qcadoo.view.api.components.GridComponent)28 FieldComponent (com.qcadoo.view.api.components.FieldComponent)12 LookupComponent (com.qcadoo.view.api.components.LookupComponent)8 EntityTree (com.qcadoo.model.api.EntityTree)4 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)3 JSONObject (org.json.JSONObject)3 Optional (com.google.common.base.Optional)2 AssignmentToShiftState (com.qcadoo.mes.assignmentToShift.states.constants.AssignmentToShiftState)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)2 TreeComponent (com.qcadoo.view.api.components.TreeComponent)2 Date (java.util.Date)2 HashMultimap (com.google.common.collect.HashMultimap)1 Lists (com.google.common.collect.Lists)1