Skip to content
Snippets Groups Projects
Commit 63fa7257 authored by buczekp's avatar buczekp
Browse files

[LMS-1949] exposed TableModel once again to simplify dependencies; introduced...

[LMS-1949] exposed TableModel once again to simplify dependencies; introduced some interfaces for managed properties

SVN: 19429
parent 5efcaddd
No related branches found
No related tags found
No related merge requests found
Showing
with 68 additions and 38 deletions
......@@ -30,6 +30,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder;
*
* @author Chandrasekhar Ramakrishnan
*/
// TODO 2011-01-14, Piotr Buczek: it should be possible to reuse evaluator by set of properties
public class ManagedPropertyEvaluator
{
private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION,
......
......@@ -20,6 +20,7 @@ import java.util.Date;
import ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.api.IRowBuilderAdaptor;
import ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.api.ISimpleTableModelBuilderAdaptor;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel;
import ch.systemsx.cisd.openbis.generic.shared.util.IRowBuilder;
import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder;
......@@ -46,17 +47,12 @@ public class SimpleTableModelBuilderAdaptor implements ISimpleTableModelBuilderA
// SimpleTableModelBuilder delegated methods
//
// This is not exposed in API interface on purpose.
// We don't want to expose neither builder nor TableModel.
public SimpleTableModelBuilder getBuilder()
// NOTE: TableModel is exposed to keep dependencies simple
public TableModel getTableModel()
{
return builder;
return builder.getTableModel();
}
//
// ISimpleTableModelBuilderAdaptor
//
public void addHeader(String title)
{
builder.addHeader(title);
......
......@@ -17,6 +17,7 @@
package ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.api;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel;
/**
* Builder of simple table models.
......@@ -28,6 +29,13 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException;
public interface ISimpleTableModelBuilderAdaptor
{
/**
* Returns table model to be set in as output.
* <p>
* NOTE: scripts shouldn't rely on the returned object's interface
*/
TableModel getTableModel();
/**
* Adds an empty row and returns a row builder for setting values of this row.
*
......
......@@ -23,10 +23,8 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto;
*/
public interface IManagedEntityProperty
{
// private String tabName; // tab name could be just property code
boolean isOwnTab();
ManagedUiDescription getUiDescription();
IManagedUiDescription getUiDescription();
}
/*
* Copyright 2011 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.generic.shared.basic.dto;
/**
* Interface implemented by objects describing an input UI element (text field, combo box)
*
* @author Piotr Buczek
*/
public interface IManagedInputWidgetDescription extends IManagedWidgetDescription
{
ManagedInputFieldType getManagedInputFieldType();
void setValue(String value);
String getValue();
void setLabel(String label);
String getLabel();
}
......@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.generic.shared.basic.dto;
import ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.api.ISimpleTableModelBuilderAdaptor;
/**
* The interface exposed to the Managed Property script.
......@@ -25,13 +24,11 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.api.
*/
public interface IManagedUiDescription
{
public void setupTableOutput(ISimpleTableModelBuilderAdaptor tableModelBuilder);
// FIXME remove this as it exposes TableModel (or introduce TableModelAdaptor)
@Deprecated
public void useTableOutput(TableModel tableModel);
public void addTextInputField(String label);
public void addComboBoxInputField(String labels, String[] values);
public IManagedWidgetDescription getOutputWidgetDescription();
}
......@@ -28,6 +28,12 @@ public class ManagedComboBoxInputWidgetDescription extends ManagedInputWidgetDes
private List<String> options = new ArrayList<String>();
@Override
public ManagedInputFieldType getManagedInputFieldType()
{
return ManagedInputFieldType.COMBO_BOX;
}
public List<String> getOptions()
{
return options;
......
......@@ -53,7 +53,7 @@ public class ManagedEntityProperty implements IEntityProperty, IManagedEntityPro
this.ownTab = ownTab;
}
public ManagedUiDescription getUiDescription()
public IManagedUiDescription getUiDescription()
{
return uiDescription;
}
......
......@@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto;
/**
* @author Chandrasekhar Ramakrishnan
*/
public abstract class ManagedInputWidgetDescription implements IManagedWidgetDescription
public abstract class ManagedInputWidgetDescription implements IManagedInputWidgetDescription
{
private static final long serialVersionUID = 1L;
......@@ -27,11 +27,19 @@ public abstract class ManagedInputWidgetDescription implements IManagedWidgetDes
private String value;
//
// IManagedWidgetDescription
//
public ManagedWidgetType getManagedWidgetType()
{
return ManagedWidgetType.INPUT;
}
//
// IManagedInputWidgetDescription
//
public ManagedInputFieldType getManagedInputFieldType()
{
return ManagedInputFieldType.TEXT;
......
......@@ -19,10 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto;
import java.util.Arrays;
import java.util.List;
import ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.SimpleTableModelBuilderAdaptor;
import ch.systemsx.cisd.openbis.generic.server.business.bo.managed_property.api.ISimpleTableModelBuilderAdaptor;
import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable;
import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder;
/**
* Object that declaratively describes a UI (labels, fields, their ordering, table content).
......@@ -82,23 +79,6 @@ public class ManagedUiDescription implements IManagedUiDescription, ISerializabl
addInputWidgetDescription(inputField);
}
public void setupTableOutput(ISimpleTableModelBuilderAdaptor tableModelBuilder)
{
ManagedTableWidgetDescription tableWidget = new ManagedTableWidgetDescription();
SimpleTableModelBuilder simpleTableModelBuilder;
if (tableModelBuilder instanceof SimpleTableModelBuilderAdaptor)
{
simpleTableModelBuilder =
((SimpleTableModelBuilderAdaptor) tableModelBuilder).getBuilder();
} else
{
simpleTableModelBuilder = new SimpleTableModelBuilder();
simpleTableModelBuilder.setMessage("can't handle table builder");
}
tableWidget.setTableModel(simpleTableModelBuilder.getTableModel());
setOutputWidgetDescription(tableWidget);
}
public void useTableOutput(TableModel tableModel)
{
ManagedTableWidgetDescription tableWidget = new ManagedTableWidgetDescription();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment