7 changed files with 112 additions and 56 deletions
@ -0,0 +1,54 @@ |
|||||||
|
package com.fine.theme.icon.plugin; |
||||||
|
|
||||||
|
import com.fine.theme.icon.AbstractIconSet; |
||||||
|
import com.fine.theme.icon.img.ImageIconSource; |
||||||
|
import com.fine.theme.icon.svg.SvgIconSource; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* 插件 map 图标集 |
||||||
|
* |
||||||
|
* @author lemon |
||||||
|
* @since |
||||||
|
* Created on 2024/08/20 |
||||||
|
*/ |
||||||
|
public class PluginMapIconSet extends AbstractIconSet { |
||||||
|
|
||||||
|
public PluginMapIconSet(Map<String, String> iconId2Path) { |
||||||
|
addIconWithMap(iconId2Path); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 根据 map 注册图标 |
||||||
|
* @param iconId2Path key: id, value: icon path |
||||||
|
*/ |
||||||
|
public void addIconWithMap(Map<String, String> iconId2Path) { |
||||||
|
for (Map.Entry<String, String> entry: iconId2Path.entrySet()) { |
||||||
|
if (PluginIconManager.isSvgIcon(entry.getValue())) { |
||||||
|
addIcon(new SvgIconSource(entry.getKey(), entry.getValue())); |
||||||
|
} else if (PluginIconManager.isImageIcon(entry.getValue())) { |
||||||
|
addIcon(new ImageIconSource(entry.getKey(), entry.getValue())); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object o) { |
||||||
|
if (this == o) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
if (o == null || getClass() != o.getClass()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
PluginMapIconSet that = (PluginMapIconSet) o; |
||||||
|
return Objects.equals(name, that.name); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int hashCode() { |
||||||
|
return Objects.hashCode(name); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue