продолжение рефакторинга и проверка на занятость файлов
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
package Common.Utils;
|
||||
import Common.CommonConstants;
|
||||
import Common_old.Utils.Utils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
@@ -281,7 +285,27 @@ public class CommonUtils {
|
||||
public static double getFileSizeMegaBytes(File file) {
|
||||
return ((double)file.length()) / (1024 * 1024);
|
||||
}
|
||||
//Иконки
|
||||
public static ImageIcon getIcon(String path) {
|
||||
URL imageUrl = CommonUtils.class.getResource(path);
|
||||
if (imageUrl == null) {
|
||||
return null;
|
||||
}
|
||||
return new ImageIcon(imageUrl);
|
||||
}
|
||||
public static ImageIcon getTabIcon(String path) {
|
||||
URL imageUrl = CommonUtils.class.getResource(path);
|
||||
if (imageUrl == null) {
|
||||
return null;
|
||||
}
|
||||
ImageIcon icon = new ImageIcon(imageUrl);
|
||||
return new ImageIcon(icon.getImage().getScaledInstance(
|
||||
18,
|
||||
18,
|
||||
Image.SCALE_DEFAULT));
|
||||
}
|
||||
//-
|
||||
//ГЕНЕРАЦИЯ ИМЕН
|
||||
//ГЕНЕРАЦИЯ ИМЕН Старт задачи
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package Common.Visual;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.UI.Menus_2023.StableMenuItem;
|
||||
import Common_old.Utils.Utils;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
|
||||
@@ -21,7 +20,7 @@ public abstract class DBObjectFilter<D extends DBObject> {
|
||||
return "/Common/icons/Pick.png";
|
||||
}
|
||||
void Mark() {
|
||||
menuItem.setIcon(Utils.getIcon(active ? getActiveIconPath() : getNotActiveIconPath()));
|
||||
menuItem.setIcon(CommonUtils.getIcon(active ? getActiveIconPath() : getNotActiveIconPath()));
|
||||
}
|
||||
//-------
|
||||
public boolean Validate(D object) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package Common.Visual;
|
||||
import Common_old.Utils.Utils;
|
||||
import Common.Utils.CommonUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
public interface Selectable {
|
||||
@@ -13,11 +13,11 @@ public interface Selectable {
|
||||
default ImageIcon GetSelectionIcon() {
|
||||
return
|
||||
isSelectionEnabled() ?
|
||||
Utils.getIcon("/Common/icons/" + (isSelected() ? "Pick" : "NotPick") + ".png") :
|
||||
CommonUtils.getIcon("/Common/icons/" + (isSelected() ? "Pick" : "NotPick") + ".png") :
|
||||
GetDisabledIcon();
|
||||
}
|
||||
default ImageIcon GetDisabledIcon() {
|
||||
return Utils.getIcon("/Common/icons/Arrays/Unknown.png");
|
||||
return CommonUtils.getIcon("/Common/icons/Arrays/Unknown.png");
|
||||
}
|
||||
default void SwitchSelection() {
|
||||
Select(!isSelected());
|
||||
|
||||
Reference in New Issue
Block a user