public void embeddableAttributeAdded(EmbeddableAttributeEvent e) { rebuildTable((Embeddable) e.getEmbeddable()); table.select(e.getEmbeddableAttribute()); }
public EmbeddableAttributeEvent(Object source, Embeddable embeddable, EmbeddableAttribute embeddableAttribute) { super(source, embeddable); setEmbeddableAttribute(embeddableAttribute); }
public EmbeddableAttributeEvent(Object source, EmbeddableAttribute attrib, Embeddable embeddable, int id) { this(source, embeddable, attrib); setId(id); }
@Override public void setUpdatedValueAt(Object value, int row, int col) { EmbeddableAttribute attribute = getEmbeddableAttribute(row); EmbeddableAttributeEvent event = new EmbeddableAttributeEvent( eventSource, embeddable, attribute); String path = null; Collection<String> nameAttr = null; if (col == OBJ_ATTRIBUTE) { event.setOldName(attribute.getName()); ProjectUtil.setEmbeddableAttributeName(attribute, value != null ? value .toString() .trim() : null); fireTableCellUpdated(row, col); } else if (col == OBJ_ATTRIBUTE_TYPE) { attribute.setType(value != null ? value.toString() : null); fireTableCellUpdated(row, col); } else if (col == DB_ATTRIBUTE) { attribute.setDbAttributeName(value != null ? value.toString() : null); fireTableCellUpdated(row, col); } mediator.fireEmbeddableAttributeEvent(event); }
public void removeEmbeddableAttributes(Embeddable embeddable, EmbeddableAttribute[] attrs) { ProjectController mediator = getProjectController(); for (EmbeddableAttribute attrib : attrs) { embeddable.removeAttribute(attrib.getName()); EmbeddableAttributeEvent e = new EmbeddableAttributeEvent(Application .getFrame(), attrib, embeddable, MapEvent.REMOVE); mediator.fireEmbeddableAttributeEvent(e); } } }
public void embeddableAttributeChanged(EmbeddableAttributeEvent e) { table.select(e.getEmbeddableAttribute()); }
public void fireEmbeddableAttributeEvent(EmbeddableAttributeEvent e) { setDirty(true); for (EventListener listener : listenerList.getListeners(EmbeddableAttributeListener.class)) { EmbeddableAttributeListener temp = (EmbeddableAttributeListener) listener; switch (e.getId()) { case MapEvent.ADD: temp.embeddableAttributeAdded(e); break; case MapEvent.CHANGE: temp.embeddableAttributeChanged(e); break; case MapEvent.REMOVE: temp.embeddableAttributeRemoved(e); break; default: throw new IllegalArgumentException("Invalid RelationshipEvent type: " + e.getId()); } } }
static void fireEmbeddableAttributeEvent(Object src, ProjectController mediator, Embeddable embeddable, EmbeddableAttribute attr) { mediator.fireEmbeddableAttributeEvent(new EmbeddableAttributeEvent(src, attr, embeddable, MapEvent.ADD)); EmbeddableAttributeDisplayEvent e = new EmbeddableAttributeDisplayEvent(src, embeddable, attr, mediator.getCurrentDataMap(), (DataChannelDescriptor) mediator.getProject().getRootNode()); mediator.fireEmbeddableAttributeDisplayEvent(e); }
public void embeddableAttributeRemoved(EmbeddableAttributeEvent e) { EmbeddableAttributeTableModel model = (EmbeddableAttributeTableModel) table .getModel(); int ind = model.getObjectList().indexOf(e.getEmbeddableAttribute()); model.removeRow(e.getEmbeddableAttribute()); table.select(ind); }
private void removeEmbAttributes(ProjectController mediator, ConfirmRemoveDialog dialog, EmbeddableAttribute[] embAttrs) { if (embAttrs != null && embAttrs.length > 0) { if ((embAttrs.length == 1 && dialog.shouldDelete("DbAttribute", embAttrs[0].getName())) || (embAttrs.length > 1 && dialog.shouldDelete("selected DbAttributes"))) { Embeddable embeddable = mediator.getCurrentEmbeddable(); application.getUndoManager() .addEdit(new RemoveAttributeUndoableEdit(embeddable, embAttrs)); for (EmbeddableAttribute attrib : embAttrs) { embeddable.removeAttribute(attrib.getName()); EmbeddableAttributeEvent e = new EmbeddableAttributeEvent(Application.getFrame(), attrib, embeddable, MapEvent.REMOVE); mediator.fireEmbeddableAttributeEvent(e); } ProjectUtil.cleanObjMappings(mediator.getCurrentDataMap()); } } }