| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.table.common; |
| |
| import org.eclipse.osbp.xtext.datamart.common.olap.DerivedPosition; |
| import org.eclipse.osbp.ui.api.datamart.IDataMart; |
| import org.eclipse.osbp.utils.vaadin.CellSetImage; |
| |
| public class PositionInfo { |
| private DerivedPosition position; |
| private Class<?> type; |
| private Class<?> innerType; |
| private Object selectedValue; |
| |
| public DerivedPosition getPosition() { |
| return position; |
| } |
| |
| public Class<?> getType() { |
| return type; |
| } |
| |
| public Class<?> getInnerType() { |
| return innerType; |
| } |
| |
| public Object getSelectedValue() { |
| return selectedValue; |
| } |
| |
| public void setSelectedValue(Object selectedValue) { |
| this.selectedValue = selectedValue; |
| } |
| |
| public PositionInfo(DerivedPosition position, Object cellObject) { |
| this.position = position; |
| if (cellObject != null) { |
| type = cellObject.getClass(); |
| if (type == CellSetImage.class) { |
| if (((CellSetImage)cellObject).getValue() != null) { |
| innerType = ((CellSetImage)cellObject).getValue().getClass(); |
| } |
| } |
| else |
| { |
| innerType = type; |
| } |
| } |
| } |
| |
| public boolean isPrimaryKey() { |
| if(position != null) { |
| if(position.toUnformattedString().startsWith(IDataMart.DATAMART_ID_COLUMN_PREFIX) && position.toUnformattedString().endsWith(IDataMart.DATAMART_ID_COLUMN_POSTFIX)) { |
| return true; |
| } |
| } |
| return false; |
| } |
| } |
| |