package org.insightech.er.editor.controller.editpart.outline.tablespace;
import java.beans.PropertyChangeEvent;
import java.util.Collections;
import java.util.List;
import org.eclipse.gef.EditPart;
import org.insightech.er.Activator;
import org.insightech.er.ImageKey;
import org.insightech.er.ResourceString;
import org.insightech.er.editor.controller.editpart.outline.AbstractOutlineEditPart;
import org.insightech.er.editor.model.diagram_contents.not_element.tablespace.Tablespace;
import org.insightech.er.editor.model.diagram_contents.not_element.tablespace.TablespaceSet;
public class TablespaceSetOutlineEditPart extends AbstractOutlineEditPart {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(
TablespaceSet.PROPERTY_CHANGE_TABLESPACE_SET)) {
refresh();
}
}
/**
* {@inheritDoc}
*/
@Override
protected List getModelChildren() {
TablespaceSet tablespaceSet = (TablespaceSet) this.getModel();
List<Tablespace> tablespaceList = tablespaceSet.getTablespaceList();
Collections.sort(tablespaceList);
return tablespaceList;
}
/**
* {@inheritDoc}
*/
@Override
protected void refreshOutlineVisuals() {
this.setWidgetText(ResourceString.getResourceString("label.tablespace")
+ " (" + this.getModelChildren().size() + ")");
this.setWidgetImage(Activator.getImage(ImageKey.DICTIONARY));
}
/**
* {@inheritDoc}
*/
@Override
protected void refreshChildren() {
super.refreshChildren();
for (Object child : this.getChildren()) {
EditPart part = (EditPart) child;
part.refresh();
}
}
}