use of org.apache.pivot.wtk.media.Image in project pivot by apache.
the class TextPaneSkinImageNodeView method childLayout.
@Override
protected void childLayout(int breakWidth) {
ImageNode imageNode = (ImageNode) getNode();
Image image = imageNode.getImage();
if (image == null) {
setSize(0, 0);
} else {
setSize(image.getWidth(), image.getHeight());
}
}
use of org.apache.pivot.wtk.media.Image in project pivot by apache.
the class ImageNode method setImage.
public void setImage(Image image) {
Image previousImage = this.image;
if (previousImage != image) {
this.image = image;
imageNodeListeners.imageChanged(this, previousImage);
}
}
use of org.apache.pivot.wtk.media.Image in project pivot by apache.
the class TerraTheme method loadMessageIcons.
private void loadMessageIcons(Map<String, String> messageIconNames, Map<MessageType, Image> messageIconsMap) {
for (String messageIconType : messageIconNames) {
String messageIconName = messageIconNames.get(messageIconType);
Image messageIcon;
try {
messageIcon = Image.load(getClass().getResource(messageIconName));
} catch (TaskExecutionException exception) {
throw new RuntimeException(exception);
}
messageIconsMap.put(MessageType.fromString(messageIconType), messageIcon);
}
}
use of org.apache.pivot.wtk.media.Image in project pivot by apache.
the class TerraExpanderSkin method install.
@Override
public void install(Component component) {
super.install(component);
Expander expander = (Expander) component;
expander.add(titleBarTablePane);
Image buttonData = expander.isExpanded() ? collapseImage : expandImage;
shadeButton = new ShadeButton(buttonData);
buttonBoxPane.add(shadeButton);
shadeButton.getButtonPressListeners().add(this);
Theme theme = currentTheme();
theme.setDefaultStyles(this);
titleChanged(expander, null);
collapsibleChanged(expander);
enabledChanged(expander);
}
use of org.apache.pivot.wtk.media.Image in project pivot by apache.
the class ListButtons method initialize.
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
listButton = (ListButton) namespace.get("listButton");
imageView = (ImageView) namespace.get("imageView");
listButton.getListButtonSelectionListeners().add(new ListButtonSelectionListener() {
@Override
public void selectedItemChanged(ListButton listButtonArgument, Object previousSelectedItem) {
Object selectedItem = listButtonArgument.getSelectedItem();
if (selectedItem != null) {
// Get the image URL for the selected item
Image image = Image.loadFromCache(ImageUtils.findByName("/org/apache/pivot/tutorials/" + selectedItem, "image"));
// Update the image
imageView.setImage(image);
}
}
});
listButton.setSelectedIndex(0);
}
Aggregations