/** {@inheritDoc} */ @Override protected IFigure createFigure() { Category category = (Category) this.getModel(); CategoryFigure figure = new CategoryFigure(category.getName()); return figure; }
/** {@inheritDoc} */ @Override protected Rectangle getRectangle() { Rectangle rectangle = super.getRectangle(); Category category = (Category) this.getModel(); ERDiagramEditPart rootEditPart = (ERDiagramEditPart) this.getRoot().getContents(); for (Object child : rootEditPart.getChildren()) { if (child instanceof NodeElementEditPart) { NodeElementEditPart editPart = (NodeElementEditPart) child; if (category.contains((NodeElement) editPart.getModel())) { Rectangle bounds = editPart.getFigure().getBounds(); if (bounds.x + bounds.width > rectangle.x + rectangle.width) { rectangle.width = bounds.x + bounds.width - rectangle.x; } if (bounds.y + bounds.height > rectangle.y + rectangle.height) { rectangle.height = bounds.y + bounds.height - rectangle.y; } if (rectangle.width != category.getWidth() || rectangle.height != category.getHeight()) { category.setLocation( new Location(category.getX(), category.getY(), rectangle.width, rectangle.height)); } } } } return rectangle; }
@Override protected List getModelChildren() { List<ColumnHolder> wordHolderList = new ArrayList<ColumnHolder>(); List<ERTable> wordHolderList1 = new ArrayList<ERTable>(); List<View> wordHolderList2 = new ArrayList<View>(); List<ColumnGroup> wordHolderList3 = new ArrayList<ColumnGroup>(); ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel(); UniqueWord word = (UniqueWord) this.getModel(); Collection<NormalColumn> normalColumns = diagram.getDiagramContents().getDictionary().getColumnList(word); Category category = this.getCurrentCategory(); for (NormalColumn normalColumn : normalColumns) { ColumnHolder columnHolder = normalColumn.getColumnHolder(); if (columnHolder instanceof ERTable) { ERTable table = (ERTable) columnHolder; if (wordHolderList1.contains(table)) { continue; } if (category != null && !category.contains(table)) { continue; } wordHolderList1.add(table); } else if (columnHolder instanceof View) { View view = (View) columnHolder; if (wordHolderList2.contains(view)) { continue; } if (category != null && !category.contains(view)) { continue; } wordHolderList2.add(view); } else if (columnHolder instanceof ColumnGroup) { if (wordHolderList3.contains(columnHolder)) { continue; } wordHolderList3.add((ColumnGroup) columnHolder); } } Collections.sort(wordHolderList1); Collections.sort(wordHolderList2); Collections.sort(wordHolderList3); wordHolderList.addAll(wordHolderList1); wordHolderList.addAll(wordHolderList2); wordHolderList.addAll(wordHolderList3); return wordHolderList; }