use of org.apache.cayenne.map.ObjEntity in project cayenne by apache.
the class ObjEntityTab method getDuplicatedAttributes.
private List<ObjAttribute> getDuplicatedAttributes(ObjEntity superEntity) {
List<ObjAttribute> result = new LinkedList<>();
ObjEntity entity = mediator.getCurrentObjEntity();
for (ObjAttribute attribute : entity.getAttributes()) {
if (superEntity.getAttribute(attribute.getName()) != null) {
result.add(attribute);
}
}
return result;
}
use of org.apache.cayenne.map.ObjEntity in project cayenne by apache.
the class ObjEntityTab method setComment.
private void setComment(String value) {
ObjEntity entity = mediator.getCurrentObjEntity();
if (entity == null) {
return;
}
ObjectInfo.putToMetaData(mediator.getApplication().getMetaData(), entity, ObjectInfo.COMMENT, value);
mediator.fireObjEntityEvent(new EntityEvent(this, entity));
}
use of org.apache.cayenne.map.ObjEntity in project cayenne by apache.
the class ClassesTabController method getProblem.
/**
* Returns the first encountered validation problem for an antity matching the name or
* null if the entity is valid or the entity is not present.
*/
public JLabel getProblem(Object obj) {
String name = null;
if (obj instanceof ObjEntity) {
name = ((ObjEntity) obj).getName();
} else if (obj instanceof Embeddable) {
name = ((Embeddable) obj).getClassName();
}
ValidationFailure validationFailure = null;
if (lastValidationResult != null) {
List<ValidationFailure> failures = lastValidationResult.getFailures(name);
if (!failures.isEmpty()) {
validationFailure = failures.get(0);
}
}
JLabel labelIcon = new JLabel();
labelIcon.setVisible(true);
if (validationFailure != null) {
labelIcon.setIcon(ERROR_ICON);
labelIcon.setToolTipText(validationFailure.getDescription());
}
return labelIcon;
}
use of org.apache.cayenne.map.ObjEntity in project cayenne by apache.
the class ClassesTabController method getItemName.
public JLabel getItemName(Object obj) {
String className;
Icon icon;
if (obj instanceof Embeddable) {
className = ((Embeddable) obj).getClassName();
icon = CellRenderers.iconForObject(new Embeddable());
} else if (obj instanceof ObjEntity) {
className = ((ObjEntity) obj).getName();
icon = CellRenderers.iconForObject(new ObjEntity());
} else {
className = ((DataMap) obj).getName();
icon = CellRenderers.iconForObject(new DataMap());
}
JLabel labelIcon = new JLabel();
labelIcon.setIcon(icon);
labelIcon.setVisible(true);
labelIcon.setText(className);
return labelIcon;
}
use of org.apache.cayenne.map.ObjEntity in project cayenne by apache.
the class RawQueryPropertiesPanel method initController.
protected void initController() {
super.initController();
dataObjects.addItemListener(e -> setFetchingDataObjects(dataObjects.isSelected()));
entities.addActionListener(event -> {
ObjEntity entity = (ObjEntity) entities.getModel().getSelectedItem();
setEntity(entity);
});
}
Aggregations