org.nakedobjects.nos.client.dnd.lookup.OptionContent Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.nos.client.dnd.lookup;
import org.nakedobjects.noa.adapter.Naked;
import org.nakedobjects.noa.adapter.NakedObject;
import org.nakedobjects.noa.reflect.Consent;
import org.nakedobjects.noa.spec.NakedObjectSpecification;
import org.nakedobjects.nof.core.reflect.Veto;
import org.nakedobjects.nof.core.util.DebugString;
import org.nakedobjects.nos.client.dnd.Content;
import org.nakedobjects.nos.client.dnd.content.AbstractContent;
import org.nakedobjects.nos.client.dnd.drawing.Image;
import org.nakedobjects.nos.client.dnd.image.ImageFactory;
public class OptionContent extends AbstractContent {
private Naked naked;
public OptionContent(Naked naked) {
this.naked = naked;
}
public Consent canDrop(Content sourceContent) {
return Veto.DEFAULT;
}
public void debugDetails(DebugString debug) {}
public Naked drop(Content sourceContent) {
return null;
}
public String getDescription() {
return null;
}
public String getHelp() {
return null;
}
public String getIconName() {
return naked.getIconName();
}
public Image getIconPicture(final int iconHeight) {
if (naked instanceof NakedObject) {
NakedObject nakedObject = (NakedObject) naked;
if (nakedObject == null) {
return ImageFactory.getInstance().loadIcon("empty-field", iconHeight, null);
}
NakedObjectSpecification specification = nakedObject.getSpecification();
Image icon = ImageFactory.getInstance().loadIcon(specification, iconHeight, null);
if (icon == null) {
icon = ImageFactory.getInstance().loadDefaultIcon(iconHeight, null);
}
return icon;
} else {
return null;
}
}
public String getId() {
return "OptionContent " + naked;
}
public Naked getNaked() {
return naked;
}
public Naked[] getOptions() {
return null;
}
public NakedObjectSpecification getSpecification() {
return naked.getSpecification();
}
public boolean isOptionEnabled() {
return false;
}
public boolean isTransient() {
return false;
}
public void parseTextEntry(String entryText) {}
public String title() {
return naked.titleString();
}
}
// Copyright (c) Naked Objects Group Ltd.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy