Browse Source

Pull request #6627: REPORT-60789【开发者预览支持调整模板布局】新自适应-本地环境模板进入开发者调试,路径处显示已锁定但模板图标上没有锁图标,远程下是有的

Merge in DESIGN/design from ~KERRY/design_10.0:release/11.0 to release/11.0

* commit 'e86dd190a6158cdf9ea8471e8e387ad3f58ff4aa':
  REPORT-60789【开发者预览支持调整模板布局】新自适应-本地环境模板进入开发者调试,路径处显示已锁定但模板图标上没有锁图标,远程下是有的
bugfix/11.0
kerry 3 years ago
parent
commit
9473a3013d
  1. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  2. 42
      designer-base/src/main/java/com/fr/design/icon/LocalFileIcon.java
  3. 3
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  4. BIN
      designer-base/src/main/resources/com/fr/design/images/gui/file_lock.png

11
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -2,6 +2,7 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.icon.LocalFileIcon;
import com.fr.design.icon.LockIcon; import com.fr.design.icon.LockIcon;
import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
@ -19,6 +20,8 @@ public class FileTreeIcon {
private FileTreeIcon() { private FileTreeIcon() {
} }
public static final String FILE_LOCKED_ICON_PATH = "/com/fr/design/images/gui/file_lock.png";
public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif");
public static final Icon FOLDER_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png"); public static final Icon FOLDER_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png");
@ -153,7 +156,7 @@ public class FileTreeIcon {
if (node.isDirectory()) { if (node.isDirectory()) {
return FileTreeIcon.FOLDER_IMAGE_ICON; return FileTreeIcon.FOLDER_IMAGE_ICON;
} }
return getLocalFileIcon(path); return getLocalFileIcon(path, isShowLock);
} }
} }
if (node.isDirectory()) { if (node.isDirectory()) {
@ -163,12 +166,12 @@ public class FileTreeIcon {
} }
} }
private static Icon getLocalFileIcon(String path) { private static Icon getLocalFileIcon(String path, boolean isShowLock) {
Icon icon = getExtraIcon(path, false); Icon icon = getExtraIcon(path, isShowLock);
if (icon != null) { if (icon != null) {
return icon; return icon;
} }
return FileSystemView.getFileSystemView().getSystemIcon(new File(path)); return new LocalFileIcon(FileSystemView.getFileSystemView().getSystemIcon(new File(path)), isShowLock);
} }
private static Icon getRemoteFileIcon(FileNode node, boolean isShowLock) { private static Icon getRemoteFileIcon(FileNode node, boolean isShowLock) {

42
designer-base/src/main/java/com/fr/design/icon/LocalFileIcon.java

@ -0,0 +1,42 @@
package com.fr.design.icon;
import com.fr.base.BaseUtils;
import com.fr.design.gui.itree.filetree.FileTreeIcon;
import javax.swing.Icon;
import java.awt.Component;
import java.awt.Graphics;
/**
* Created by kerry on 2021/11/11
*/
public class LocalFileIcon implements Icon {
private static final Icon FILE_LOCKED_ICON = BaseUtils.readIcon(FileTreeIcon.FILE_LOCKED_ICON_PATH);
private static final int OFFSET_X = 9;
private static final int OFFSET_Y = 8;
private final Icon mainIcon;
private final boolean showLock;
public LocalFileIcon(Icon mainIcon, boolean showLock) {
this.mainIcon = mainIcon;
this.showLock = showLock;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
mainIcon.paintIcon(c, g, x, y);
if (showLock) {
FILE_LOCKED_ICON.paintIcon(c, g, OFFSET_X, OFFSET_Y);
}
}
@Override
public int getIconWidth() {
return mainIcon.getIconWidth();
}
@Override
public int getIconHeight() {
return mainIcon.getIconHeight();
}
}

3
designer-base/src/main/java/com/fr/design/icon/LockIcon.java

@ -1,6 +1,7 @@
package com.fr.design.icon; package com.fr.design.icon;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.GrayFilter; import javax.swing.GrayFilter;
@ -12,7 +13,7 @@ import java.awt.MediaTracker;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
public class LockIcon extends ImageIcon { public class LockIcon extends ImageIcon {
private final static Image lockImage = BaseUtils.readImage("/com/fr/design/images/gui/locked.gif"); private final static Image lockImage = BaseUtils.readImage(FileTreeIcon.FILE_LOCKED_ICON_PATH);
private Image mainImage = null; private Image mainImage = null;

BIN
designer-base/src/main/resources/com/fr/design/images/gui/file_lock.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Loading…
Cancel
Save