| Visible or Invisible Properties When model changed [message #1112833] |
Fri, 20 September 2013 04:32  |
serhat gezgin Messages: 198 Registered: January 2013 Location: Izmir |
Senior Member |
|
|
Hi all,
my model;
Table
columns : Column (0..*)
type : SQLType
Column
autoIncrement : Boolean
Enum SQLType
int
varChar
numeric
..
i want to constraint property view when i change Table type to numeric or int i want to show autoIncrement boolean part on properties view to user.
But when i chande type to varChar, .. i don't want to show this property to user.
I can make constraint to user for can't edit this property;
@Override
public boolean canSetProperty(Object object) {
Column element = (Column) object;
return ColumnUtil.isAutoIncrementSettable(element); //bool }
but i want when item type nvarchar, .. i dont show this property to user.
so how can i implement this behaviour to my edit project.
Regards.
|
|
|
|
| Re: Visible or Invisible Properties When model changed [message #1114453 is a reply to message #1113456] |
Sun, 22 September 2013 15:24  |
serhat gezgin Messages: 198 Registered: January 2013 Location: Izmir |
Senior Member |
|
|
Thanks a lot i solve this like;
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
itemPropertyDescriptors = null;
super.getPropertyDescriptors(object);
addTypePropertyDescriptor(object);
addNullablePropertyDescriptor(object);
addDefaultValuePropertyDescriptor(object);
addPrimaryKeyPropertyDescriptor(object);
if (ColumnUtil.isAutoIncrementSettable(((Column) object)))
addAutoIncrementPropertyDescriptor(object);
return itemPropertyDescriptors;
}
and when model changed;
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Column.class)) {
case ContentPackage.COLUMN__TYPE:
getPropertyDescriptors(notification.getNotifier());
case ContentPackage.COLUMN__NULLABLE:
case ContentPackage.COLUMN__DEFAULT_VALUE:
case ContentPackage.COLUMN__PRIMARY_KEY:
case ContentPackage.COLUMN__AUTO_INCREMENT:
fireNotifyChanged(new ViewerNotification(notification,
notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
Regards
[Updated on: Sun, 22 September 2013 15:40] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01936 seconds