public void dbAttributeChanged(AttributeEvent e) { table.select(e.getAttribute()); }
public void dbAttributeRemoved(AttributeEvent e) { DbAttributeTableModel model = (DbAttributeTableModel) table.getModel(); int ind = model.getObjectList().indexOf(e.getAttribute()); model.removeRow(e.getAttribute()); table.select(ind); }
public void dbAttributeAdded(AttributeEvent e) { rebuildTable((DbEntity) e.getEntity()); table.select(e.getAttribute()); }
public void objAttributeAdded(AttributeEvent e) { ObjAttributeTableModel model = (ObjAttributeTableModel) table.getModel(); if (!model.isValid()) { model.resetModel(); } model.addRow(new ObjAttributeWrapper((ObjAttribute) e.getAttribute())); model.fireTableDataChanged(); int ind = -1; List<ObjAttributeWrapper> list = model.getObjectList(); for (int i = 0; i < list.size(); i++) { if (list.get(i).getValue() == e.getAttribute()) { ind = i; } } table.select(ind); }
public void objAttributeRemoved(AttributeEvent e) { ObjAttributeTableModel model = (ObjAttributeTableModel) table.getModel(); int ind = -1; List<ObjAttributeWrapper> list = model.getObjectList(); for (int i = 0; i < list.size(); i++) { if (list.get(i).getValue() == e.getAttribute()) { ind = i; } } if (!model.isValid()) { model.resetModel(); } if (ind >= 0) { model.removeRow(list.get(ind)); model.fireTableDataChanged(); table.select(ind); } }
public void removeDuplicateAttribute(AttributeEvent e) { Collection<ObjEntity> objEntities = ProjectUtil.getCollectionOfChildren((ObjEntity) e.getEntity()); for (ObjEntity objEntity: objEntities) { if (objEntity.getDeclaredAttribute(e.getAttribute().getName()) != null) { JOptionPane pane = new JOptionPane( String.format("'%s' and '%s' can't have attribute '%s' together. " + "Would you like to delete this attribute from the '%s' class?", objEntity.getName(), e.getEntity().getName(), e.getAttribute().getName(), objEntity.getName()), JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); JDialog dialog = pane.createDialog(Application.getFrame(), "Confirm Remove"); dialog.setVisible(true); boolean shouldDelete; Object selectedValue = pane.getValue(); shouldDelete = selectedValue != null && selectedValue.equals(JOptionPane.YES_OPTION); if (shouldDelete) { objEntity.removeAttribute(e.getAttribute().getName()); objEntity.removeAttributeOverride(e.getAttribute().getName()); } } } }
Attribute attr = e.getAttribute(); if ((attr == null) && (this.attributes.isEmpty())) { this.primaryKey.clear();
public void objAttributeChanged(AttributeEvent e) { ObjAttributeTableModel model = (ObjAttributeTableModel) table.getModel(); if (!model.isValid()) { model.resetModel(); } model.fireTableDataChanged(); int ind = -1; List<ObjAttributeWrapper> list = model.getObjectList(); for (int i = 0; i < list.size(); i++) { if (list.get(i).getValue() == e.getAttribute()) { ind = i; } } table.select(ind); if (e.getOldName() != null) { removeDuplicateAttribute(e); } }
Attribute attribute = e.getAttribute(); if (attribute == null && this.attributes.isEmpty()) { this.primaryKey.clear();
public void removeObjAttributes(ObjEntity entity, ObjAttribute[] attribs) { ProjectController mediator = getProjectController(); for (ObjAttribute attrib : attribs) { entity.removeAttribute(attrib.getName()); AttributeEvent e = new AttributeEvent( Application.getFrame(), attrib, entity, MapEvent.REMOVE); mediator.fireObjAttributeEvent(e); Collection<ObjEntity> objEntities = ProjectUtil.getCollectionOfChildren((ObjEntity) e.getEntity()); for (ObjEntity objEntity: objEntities) { objEntity.removeAttributeOverride(e.getAttribute().getName()); } } }