use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class LineColorSection method update.
@Override
protected void update() {
ILineObject lineObject = (ILineObject) getFirstSelectedObject();
String colorValue = lineObject.getLineColor();
RGB rgb = ColorFactory.convertStringToRGB(colorValue);
if (rgb == null) {
rgb = ColorFactory.getDefaultLineColor(lineObject).getRGB();
}
fColorChooser.setColorValue(rgb);
// Locked
boolean enabled = !isLocked(lineObject);
fColorChooser.setEnabled(enabled);
if (!enabled) {
return;
}
// If the user pref is to save the color in the file, then it's a different meaning of default
boolean isDefaultColor = (colorValue == null);
if (Preferences.STORE.getBoolean(IPreferenceConstants.SAVE_USER_DEFAULT_COLOR)) {
isDefaultColor = (colorValue != null) && rgb.equals(ColorFactory.getDefaultLineColor(lineObject).getRGB());
}
fColorChooser.setIsDefaultColor(isDefaultColor);
// If this is an element line disable some things
if (lineObject instanceof IDiagramModelObject) {
boolean deriveElementLineColor = Preferences.STORE.getBoolean(IPreferenceConstants.DERIVE_ELEMENT_LINE_COLOR);
fColorChooser.setDoShowColorImage(!deriveElementLineColor);
fColorChooser.getColorButton().setEnabled(!deriveElementLineColor);
fColorChooser.setDoShowDefaultMenuItem(!deriveElementLineColor);
} else {
fColorChooser.setDoShowColorImage(true);
fColorChooser.getColorButton().setEnabled(true);
fColorChooser.setDoShowDefaultMenuItem(true);
}
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class FillColorSection method update.
@Override
protected void update() {
IDiagramModelObject lastSelected = (IDiagramModelObject) getFirstSelectedObject();
String colorValue = lastSelected.getFillColor();
RGB rgb = ColorFactory.convertStringToRGB(colorValue);
if (rgb == null) {
rgb = ColorFactory.getDefaultFillColor(lastSelected).getRGB();
}
fColorChooser.setColorValue(rgb);
fColorChooser.setEnabled(!isLocked(lastSelected));
// If user pref is to save the color then it's a different meaning of default
boolean isDefaultColor = (colorValue == null);
if (Preferences.STORE.getBoolean(IPreferenceConstants.SAVE_USER_DEFAULT_COLOR)) {
isDefaultColor = (colorValue != null) && rgb.equals(ColorFactory.getDefaultFillColor(lastSelected).getRGB());
}
fColorChooser.setIsDefaultColor(isDefaultColor);
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class CopySnapshot method createSnapshotObjects.
/*
* Make snapshot copies of top level objects
*/
private List<IDiagramModelObject> createSnapshotObjects(List<IDiagramModelObject> objectsToCopy) {
List<IDiagramModelObject> topLevelObjects = new ArrayList<IDiagramModelObject>();
for (IDiagramModelObject dmo : objectsToCopy) {
IDiagramModelObject snapshotObject = createSnapshotObject(dmo);
topLevelObjects.add(snapshotObject);
}
return topLevelObjects;
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class CopySnapshot method createSnapshotObject.
/*
* Make snapshot copy of object
*/
private IDiagramModelObject createSnapshotObject(IDiagramModelObject originalObject) {
IDiagramModelObject snapshotObject = (IDiagramModelObject) originalObject.getCopy();
// Add to mapping
fOriginalToSnapshotComponentsMapping.put(originalObject, snapshotObject);
// Object is Container, so recurse
if (snapshotObject instanceof IDiagramModelContainer) {
for (IDiagramModelObject child : ((IDiagramModelContainer) originalObject).getChildren()) {
IDiagramModelObject dmo = createSnapshotObject(child);
((IDiagramModelContainer) snapshotObject).getChildren().add(dmo);
}
}
return snapshotObject;
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class CopySnapshot method translateToAbsolute.
/**
* Translate an objects x,y position to absolute co-ordinates
* @param object
* @param pt
*/
private void translateToAbsolute(IDiagramModelObject object, Point pt) {
if (object.eContainer() instanceof IDiagramModelContainer && !(object.eContainer() instanceof IDiagramModel)) {
IDiagramModelObject parent = (IDiagramModelObject) object.eContainer();
pt.performTranslate(parent.getBounds().getX(), parent.getBounds().getY());
translateToAbsolute(parent, pt);
}
}
Aggregations