| /** |
| * |
| * 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.datamart.common; |
| |
| import org.eclipse.osbp.ui.api.datamart.IDatamartBetweenInput; |
| import org.eclipse.osbp.ui.api.themes.EnumCssClass; |
| |
| import com.vaadin.data.Property.ValueChangeListener; |
| import com.vaadin.ui.HorizontalLayout; |
| import com.vaadin.ui.TextField; |
| |
| public class DatamartBetweenText extends HorizontalLayout implements IDatamartBetweenInput { |
| |
| private TextField fromInput; |
| |
| private TextField untilInput; |
| |
| private static final long serialVersionUID = -5673052113801450589L; |
| |
| public static long getSerialversionuid() { |
| return serialVersionUID; |
| } |
| |
| public DatamartBetweenText() { |
| fromInput = new TextField(); |
| untilInput = new TextField(); |
| fromInput.setSizeFull(); |
| untilInput.setSizeFull(); |
| addComponent(fromInput); |
| addComponent(untilInput); |
| addStyleName(EnumCssClass.RANGE_SELECTION.styleName()); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.osbp.xtext.datamart.common.IDatamartBetweenInput#getFrom() |
| */ |
| @Override |
| public String getFrom() { |
| return fromInput.getValue(); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.osbp.xtext.datamart.common.IDatamartBetweenInput#setFrom(java.lang.String) |
| */ |
| @Override |
| public void setFrom(String from) { |
| fromInput.setValue((String) from); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.osbp.xtext.datamart.common.IDatamartBetweenInput#getUntil() |
| */ |
| @Override |
| public String getUntil() { |
| return untilInput.getValue(); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.osbp.xtext.datamart.common.IDatamartBetweenInput#setUntil(java.lang.String) |
| */ |
| @Override |
| public void setUntil(String until) { |
| untilInput.setValue((String) until); |
| } |
| |
| @SuppressWarnings("unchecked") |
| public TextField getFromInput() { |
| return fromInput; |
| } |
| |
| @SuppressWarnings("unchecked") |
| public TextField getUntilInput() { |
| return untilInput; |
| } |
| |
| @Override |
| public void addValueChangeListener(ValueChangeListener listener) { |
| fromInput.addValueChangeListener(listener); |
| untilInput.addValueChangeListener(listener); |
| } |
| |
| @Override |
| public void removeValueChangeListener(ValueChangeListener listener) { |
| fromInput.removeValueChangeListener(listener); |
| untilInput.removeValueChangeListener(listener); |
| } |
| |
| |
| @Override |
| public void setDescription(String description) { |
| fromInput.setDescription("[" + description); |
| untilInput.setDescription(description + "]"); |
| } |
| |
| |
| |
| } |