Search in sources :

Example 1 with AbstractErrataListModel

use of org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel in project ovirt-engine by oVirt.

the class ErrataTableView method createErrataTable.

private void createErrataTable() {
    errataTable = new EntityModelCellTable<AbstractErrataListModel>(false, true) {

        // Override the addSelectionChangeHandler method to prevent a class cast exception. The EntityModelCellTable
        // expect to be handed a list of EntityModels, but the ErrataListModel is returning a list of Erratums. If
        // I rework the list model to return EntityModel<Erratum> I get another class cast exception on something
        // that expects it to return a straight Erratum.
        public void addSelectionChangeHandler() {
            // Handle selection
            getSelectionModel().addSelectionChangeHandler(new Handler() {

                @Override
                public void onSelectionChange(SelectionChangeEvent event) {
                    if (errataListModel == null || errataListModel.getItems() == null) {
                        return;
                    }
                    SelectionModel<?> selectionModel = errataTable.getSelectionModel();
                    Erratum selectedObject = (Erratum) ((SingleSelectionModel<?>) selectionModel).getSelectedObject();
                    clearCurrentSelectedItems();
                    if (selectedObject != null) {
                        errataListModel.setSelectedItem(selectedObject);
                    }
                }

                private void clearCurrentSelectedItems() {
                    errataListModel.setSelectedItems(null);
                    errataListModel.setSelectedItem(null);
                }
            });
        }
    };
}
Also used : AbstractErrataListModel(org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) Handler(com.google.gwt.view.client.SelectionChangeEvent.Handler) PlaceTransitionHandler(org.ovirt.engine.ui.common.presenter.PlaceTransitionHandler) Erratum(org.ovirt.engine.core.common.businessentities.Erratum) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent)

Example 2 with AbstractErrataListModel

use of org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel in project ovirt-engine by oVirt.

the class ErrataListWithDetailsPopupPresenterWidget method init.

@Override
public void init(final AbstractErrataCountModel clickSource) {
    super.init(clickSource);
    AbstractErrataListModel model = modelProvider.getModel();
    model.setItemsFilter(createFilter(clickSource.getFilterCommand()));
}
Also used : AbstractErrataListModel(org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel)

Aggregations

AbstractErrataListModel (org.ovirt.engine.ui.uicommonweb.models.AbstractErrataListModel)2 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 SelectionChangeEvent (com.google.gwt.view.client.SelectionChangeEvent)1 Handler (com.google.gwt.view.client.SelectionChangeEvent.Handler)1 Erratum (org.ovirt.engine.core.common.businessentities.Erratum)1 PlaceTransitionHandler (org.ovirt.engine.ui.common.presenter.PlaceTransitionHandler)1