/*
* Licensed Materials - Property of Perforce Software, Inc.
* © Copyright Perforce Software, Inc. 2014, 2021
* © Copyright IBM Corp. 2009, 2014
* © Copyright ILOG 1996, 2009
* All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* The Software and Documentation were developed at private expense and
* are "Commercial Items" as that term is defined at 48 CFR 2.101,
* consisting of "Commercial Computer Software" and
* "Commercial Computer Software Documentation", as such terms are
* used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4,
* as applicable.
*/
package demo.editing;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import ilog.views.gantt.IlvActivity;
import ilog.views.gantt.IlvDuration;
import ilog.views.gantt.IlvHierarchyChart;
import ilog.views.gantt.faces.dhtml.component.IlvFacesGanttPropertyAccessor;
/**
* Property accessor for the properties of Gantt model objects, as found in the
* sample date file.
*/
public class PropertyAccessor extends IlvFacesGanttPropertyAccessor {
/** List of the properties to hide from the client. */
static List<String> hiddenProperties = Arrays
.asList(new String[] { "earliestStart", "earliestFinish", "latestStart", "latestFinish", "totalSlack" });
/**
* Creates a <code>PropertyAccessor</code>.
*/
public PropertyAccessor() {
// Register the data type for the user-defined properties.
registerType(IlvActivity.class, "totalSlack", IlvDuration.class);
registerType(IlvActivity.class, "critical", Boolean.class);
registerType(IlvActivity.class, "completion", Float.class);
registerType(IlvActivity.class, "earliestStart", Date.class);
registerType(IlvActivity.class, "earliestFinish", Date.class);
registerType(IlvActivity.class, "latestStart", Date.class);
registerType(IlvActivity.class, "latestFinish", Date.class);
}
/**
* Returns the properties of an object, that will be exported for a hierachy
* chart. The method is redefined to hide some user-defined properties from
* the client.
*
* @param view
* The <code>IlvHierarchyChart</code> to which the object belongs to.
* @param object
* The Gantt model <code>Object</code> for which to return property
* names.
*
* @return The names of the properties.
*/
Override
protected List<String> getPropertyNames(IlvHierarchyChart view, Object object) {
List<String> allProperties = super.getPropertyNames(view, object);
List<String> properties = new ArrayList<String>(allProperties);
properties.removeAll(hiddenProperties);
return properties;
}
}