All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.vectorpublish.desktop.vp.IOContributions Maven / Gradle / Ivy

/*
 * Copyright (c) 2016, Peter Rader. All rights reserved.
 *  ___ ___               __                 ______         __     __  __         __
 * |   |   |.-----..----.|  |_ .-----..----.|   __ \.--.--.|  |--.|  ||__|.-----.|  |--.
 * |   |   ||  -__||  __||   _||  _  ||   _||    __/|  |  ||  _  ||  ||  ||__ --||     |
 *  \_____/ |_____||____||____||_____||__|  |___|   |_____||_____||__||__||_____||__|__|
 *
 * http://www.gnu.org/licenses/gpl-3.0.html
 */
package net.vectorpublish.desktop.vp;

import java.util.Locale.LanguageRange;

import javax.inject.Inject;
import javax.inject.Named;
import javax.swing.Icon;
import javax.swing.JLabel;

import net.vectorpublish.desktop.vp.api.layer.LayerItemContribution;
import net.vectorpublish.desktop.vp.api.vpd.VectorPublishNode;
import net.vectorpublish.desktop.vp.i8n.LanguageChangeListener;
import net.vectorpublish.desktop.vp.io.VPDocumentNode;
import net.vectorpublish.desktop.vp.ui.ImageKey;
import net.vectorpublish.desktop.vp.ui.Namespace;
import net.vectorpublish.desktop.vp.ui.i8n.I8nImageFactory;

@Named
public class IOContributions implements LayerItemContribution, LanguageChangeListener {

	public static final Namespace NS = Namespace.getNamespace("net.vectorpublish", "io");

	@Inject
	private final I8nImageFactory imageFactory = null;

	private Icon docImage;

	@Override
	public void changedTo(LanguageRange lr) {
		docImage = imageFactory.get(NS, ImageKey.get("document"), true);
	}

	@Override
	public void contribute(JLabel decorationLabel, VectorPublishNode value, boolean selected, boolean expanded,
			boolean leaf) {
		if (value instanceof VPDocumentNode) {
			decorationLabel.setIcon(docImage);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy