Skip to content

Package: PersistTableStateService

PersistTableStateService

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.spi.view.table.ui.swt.persistedstate;
15:
16: import org.eclipse.emf.ecp.view.spi.model.VAttachment;
17: import org.eclipse.emf.ecp.view.spi.model.VControl;
18: import org.eclipse.emfforms.common.Optional;
19:
20: /**
21: * A service which persists the state of a table.
22: *
23: * @author Johannes Faltermeier
24: *
25: */
26: public interface PersistTableStateService {
27:
28:         /**
29:          * <p>
30:          * Use this method if a non {@link org.eclipse.emf.ecp.view.spi.table.model.VTableControl VTableControl}
31:          * {@link VControl} renders a table and wishes to persist the state.
32:          * The service will look for an {@link VAttachment} with the {@link PersistTableStateServiceVAttachment} marker
33:          * interface and will persist this attachment for the given control.
34:          * <p/>
35:          * <p>
36:          * This method may be called multiple times.
37:          * </p>
38:          *
39:          * @param controls the additional controls to registers.
40:          */
41:         void registerAdditionalControls(VControl... controls);
42:
43:         /**
44:          * This methods gives access to previsouly persisted state attachments.
45:          *
46:          * @param control the control
47:          * @return the attachment, if present
48:          */
49:         Optional<VAttachment> getPersistedState(VControl control);
50:
51:         /**
52:          * Marker interface required by the {@link PersistTableStateService#registerAdditionalControls(VControl...)} method.
53:          *
54:          * @author Johannes Faltermeier
55:          *
56:          */
57:         interface PersistTableStateServiceVAttachment {
58:
59:         }
60:
61: }