diff --git a/src/main/java/tihwin/MainAppUi.form b/src/main/java/tihwin/MainAppUi.form
index 5f616a4..a3efd14 100644
--- a/src/main/java/tihwin/MainAppUi.form
+++ b/src/main/java/tihwin/MainAppUi.form
@@ -20,6 +20,8 @@
+
+
@@ -33,23 +35,22 @@
-
-
+
-
+
-
-
+
+
@@ -58,7 +59,7 @@
-
+
@@ -107,7 +108,7 @@
-
+
@@ -117,12 +118,12 @@
-
+
-
+
@@ -135,7 +136,7 @@
-
+
@@ -169,7 +170,7 @@
-
+
@@ -188,6 +189,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/tihwin/MainAppUi.java b/src/main/java/tihwin/MainAppUi.java
index 821d74c..6960abc 100644
--- a/src/main/java/tihwin/MainAppUi.java
+++ b/src/main/java/tihwin/MainAppUi.java
@@ -51,6 +51,7 @@ public class MainAppUi extends JFrame {
private JTextField titleField;
private JRadioButton CDRadioButton;
private JRadioButton DVDRadioButton;
+ private JButton ulCfgBtn;
private final ResourceBundle resourceBundle;
private String recentRomLocation;
@@ -71,6 +72,7 @@ public class MainAppUi extends JFrame {
diskImageSelectBtn.addActionListener(actionEvent -> diskImageSelectEventHandler());
destinationSelectBtn.addActionListener(actionEvent -> destinationSelectEventHandler());
convertBtn.addActionListener(actionEvent -> convertButtonAction());
+ ulCfgBtn.addActionListener(actionEvent -> ulConfigButtonAction());
((AbstractDocument) titleField.getDocument()).setDocumentFilter(new TitleFieldFilter());
if (Settings.INSTANCE.getDvdSelected())
DVDRadioButton.setSelected(true);
@@ -80,6 +82,7 @@ public class MainAppUi extends JFrame {
destinationDirectoryLbl.setText(FilesHelper.getRealFolder(Settings.INSTANCE.getDestination()));
addWindowListener(getWindowListener());
+ new UpdateUlTableUi(new File(destinationDirectoryLbl.getText() + File.separator + "ul.cfg"));
}
private WindowListener getWindowListener() {
@@ -215,6 +218,10 @@ public class MainAppUi extends JFrame {
convertBtn.setText(resourceBundle.getString("ConvertBtn"));
}
+ private void ulConfigButtonAction() {
+ new UpdateUlTableUi(new File(destinationDirectoryLbl.getText() + File.separator + "ul.cfg"));
+ }
+
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
@@ -231,21 +238,20 @@ public class MainAppUi extends JFrame {
*/
private void $$$setupUI$$$() {
mainPanel = new JPanel();
- mainPanel.setLayout(new FormLayout("fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,fill:max(d;4px):noGrow,fill:d:grow", "center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:p:grow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
+ mainPanel.setLayout(new FormLayout("fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,fill:max(d;4px):noGrow,fill:d:grow,left:4dlu:noGrow,fill:p:noGrow", "center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:p:grow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
diskImageSelectBtn = new JButton();
diskImageSelectBtn.setBackground(new Color(-2034433));
- diskImageSelectBtn.setIconTextGap(4);
this.$$$loadButtonText$$$(diskImageSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn"));
CellConstraints cc = new CellConstraints();
mainPanel.add(diskImageSelectBtn, new CellConstraints(1, 3, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0)));
titleField = new JTextField();
- mainPanel.add(titleField, new CellConstraints(7, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5)));
+ mainPanel.add(titleField, cc.xyw(7, 5, 3));
destinationDirectoryLbl = new JLabel();
destinationDirectoryLbl.setText("");
- mainPanel.add(destinationDirectoryLbl, new CellConstraints(7, 7, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5)));
+ mainPanel.add(destinationDirectoryLbl, cc.xyw(7, 7, 3));
diskImageNameLbl = new JLabel();
diskImageNameLbl.setText("");
- mainPanel.add(diskImageNameLbl, new CellConstraints(7, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5)));
+ mainPanel.add(diskImageNameLbl, cc.xy(7, 3));
destinationSelectBtn = new JButton();
destinationSelectBtn.setBackground(new Color(-2034433));
this.$$$loadButtonText$$$(destinationSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn"));
@@ -269,11 +275,11 @@ public class MainAppUi extends JFrame {
convertBtn = new JButton();
convertBtn.setBackground(new Color(-2034433));
this.$$$loadButtonText$$$(convertBtn, this.$$$getMessageFromBundle$$$("locale", "ConvertBtn"));
- mainPanel.add(convertBtn, new CellConstraints(1, 9, 7, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 5)));
+ mainPanel.add(convertBtn, new CellConstraints(1, 9, 9, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 5)));
statusJPanel = new JPanel();
statusJPanel.setLayout(new GridLayoutManager(1, 1, new Insets(5, 5, 5, 5), -1, -1));
statusJPanel.setBackground(new Color(-1));
- mainPanel.add(statusJPanel, cc.xyw(1, 12, 7));
+ mainPanel.add(statusJPanel, cc.xyw(1, 12, 9));
statusLbl = new JLabel();
this.$$$loadLabelText$$$(statusLbl, this.$$$getMessageFromBundle$$$("locale", "WelcomeText"));
statusJPanel.add(statusLbl, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@@ -285,11 +291,18 @@ public class MainAppUi extends JFrame {
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
panel1.setBackground(new Color(-9251843));
- mainPanel.add(panel1, cc.xyw(1, 1, 7));
+ mainPanel.add(panel1, cc.xyw(1, 1, 9));
final JLabel label4 = new JLabel();
label4.setIcon(new ImageIcon(getClass().getResource("/banner.png")));
label4.setText("");
panel1.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ ulCfgBtn = new JButton();
+ ulCfgBtn.setBackground(new Color(-2031648));
+ ulCfgBtn.setMargin(new Insets(1, 1, 1, 1));
+ ulCfgBtn.setMinimumSize(new Dimension(130, 30));
+ ulCfgBtn.setPreferredSize(new Dimension(140, 30));
+ this.$$$loadButtonText$$$(ulCfgBtn, this.$$$getMessageFromBundle$$$("locale", "editUlCfgBtn"));
+ mainPanel.add(ulCfgBtn, new CellConstraints(9, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5)));
ButtonGroup buttonGroup;
buttonGroup = new ButtonGroup();
buttonGroup.add(DVDRadioButton);
@@ -373,4 +386,5 @@ public class MainAppUi extends JFrame {
public JComponent $$$getRootComponent$$$() {
return mainPanel;
}
+
}
diff --git a/src/main/java/tihwin/UpdateUlTableUi.java b/src/main/java/tihwin/UpdateUlTableUi.java
new file mode 100644
index 0000000..60f2d4f
--- /dev/null
+++ b/src/main/java/tihwin/UpdateUlTableUi.java
@@ -0,0 +1,178 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin;
+
+import com.jgoodies.forms.layout.CellConstraints;
+import com.jgoodies.forms.layout.FormLayout;
+import tihwin.ui.*;
+import tihwin.ui.ulupdater.*;
+
+import javax.swing.*;
+import javax.swing.border.MatteBorder;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.JTableHeader;
+import javax.swing.text.AbstractDocument;
+import java.awt.*;
+import java.io.File;
+import java.util.Objects;
+import java.util.ResourceBundle;
+
+public class UpdateUlTableUi extends JFrame {
+ private JTable table;
+ private UlTableModel model;
+ private JButton saveChangesBtn;
+
+ private JLabel ulLocationLbl, statusLbl;
+ private String recentRomLocation;
+ private final ResourceBundle resourceBundle;
+
+ public UpdateUlTableUi(File ulCfgFile) {
+ super();
+ this.resourceBundle = ResourceBundle.getBundle("locale");
+ setupUlLocationLbl();
+ setupTable();
+ setupSaveButton();
+
+ FormLayout primaryPanelLayout = new FormLayout(
+ "75dlu, 4dlu, fill:pref:grow",
+ "fill:pref:grow, 25dlu:noGrow, 25dlu:noGrow, fill:pref:noGrow"
+ );
+ JPanel primaryPanel = new JPanel();
+ primaryPanel.setLayout(primaryPanelLayout);
+
+ primaryPanel.add(getScrollPane(), new CellConstraints(1, 1, 3, 1,
+ CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 0)));
+ primaryPanel.add(getSelectUlLocationButton(), new CellConstraints(1, 2, 1, 1,
+ CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(5, 5, 5, 5)));
+ primaryPanel.add(ulLocationLbl, new CellConstraints(3, 2, 1, 1,
+ CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 0)));
+ primaryPanel.add(saveChangesBtn, new CellConstraints(1, 3, 3, 1,
+ CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(5, 5, 5, 5)));
+ primaryPanel.add(getStatusPanel(), new CellConstraints(1, 4, 3, 1,
+ CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 0)));
+
+ setLocationRelativeTo(null);
+ setContentPane(primaryPanel);
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ Image img = new ImageIcon(Objects.requireNonNull(
+ MainAppUi.class.getClassLoader().getResource("tray_icon.gif"))).getImage();
+ setIconImage(img);
+ setMinimumSize(new Dimension(800, 500));
+ setVisible(true);
+ setTitle(resourceBundle.getString("ulManager"));
+ System.out.println(ulCfgFile.getAbsolutePath());
+ this.recentRomLocation = ulCfgFile.getParent();
+ if (ulCfgFile.exists())
+ showInTableUlCfgFile(ulCfgFile);
+ setAlwaysOnTop(true); // TODO:DELETE
+ //statusLbl.setText("TEST"); // TODO:DELETE
+ }
+
+ private void setupUlLocationLbl(){
+ ulLocationLbl = new JLabel(Settings.INSTANCE.getDestination());
+ }
+ private void setupSaveButton(){
+ saveChangesBtn = new JButton(resourceBundle.getString("ulManagerWindow_SaveBtn"));
+ saveChangesBtn.setBackground(Color.getHSBColor(0.5591398f, 0.12156863f, 1));
+ saveChangesBtn.addActionListener(actionEvent -> saveChangesAction());
+ saveChangesBtn.setEnabled(false);
+ }
+ private void setupTable(){
+ model = new UlTableModel();
+ table = new JTable(model);
+
+ JTableHeader header = table.getTableHeader();
+ header.setDefaultRenderer(new UlTableHeaderRenderer());
+ header.setPreferredSize(new Dimension(header.getHeight(), 25));
+
+ table.setDefaultRenderer(JButton.class, new UlTableContentJButtonRenderer());
+ table.setDefaultRenderer(JLabel.class, new UlTableContentJLabelRenderer());
+
+ table.setRowHeight(30);
+ UlTableColumnModel columnModel = new UlTableColumnModel((DefaultTableColumnModel) table.getColumnModel());
+ table.setColumnModel(columnModel);
+ table.setRowSelectionAllowed(false);
+
+ JTextField textField = new JTextField();
+ ((AbstractDocument) textField.getDocument()).setDocumentFilter(new TitleFieldFilter());
+ table.setDefaultEditor(JLabel.class, new DefaultCellEditor(textField));
+ }
+ private JScrollPane getScrollPane(){
+ JScrollPane scrollPane = new JScrollPane(table);
+ scrollPane.setPreferredSize(new Dimension(0,50));
+ return scrollPane;
+ }
+ private JButton getSelectUlLocationButton(){
+ JButton selectUlBtn = new JButton(resourceBundle.getString("ulManagerWindow_SelectUlCfgBtn"));
+ selectUlBtn.setBackground(Color.getHSBColor(0.5591398f, 0.12156863f, 1));
+ selectUlBtn.addActionListener(actionEvent -> selectUlCfgAction());
+ return selectUlBtn;
+ }
+ private JPanel getStatusPanel(){
+ statusLbl = new JLabel();
+ JPanel statusPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ statusPanel.setBackground(Color.white);
+ statusPanel.setBorder(new MatteBorder(1,0,0,0, Color.darkGray));
+ statusPanel.add(statusLbl);
+ return statusPanel;
+ }
+
+ private void showInTableUlCfgFile(File ulCfgFile){
+ for (int i=0; i<15; i++) {
+ model.addRow(
+ new UlTableRow(table.getRowCount() + 1, i + "_lent Hi11 **atter** ***ories1", "NORG_000.00", 5, true));
+ model.addRow(
+ new UlTableRow(table.getRowCount() + 1, "name"+i, "NORG_000.11", 5, false));
+ model.addRow(
+ new UlTableRow(table.getRowCount() + 1, i+"name", "NORG_000.99", 5, true));
+ }
+ /*-*-*-*-*-*-*-*-**/
+ if (ulCfgFile.length() < 64){
+ statusLbl.setText(resourceBundle.getString("ulManagerWindow_EmptyOrIncorrectText")+" "+ulCfgFile.getAbsolutePath());
+ return;
+ }
+ System.out.println("IMPLMENET ME"); // TODO
+
+ saveChangesBtn.setEnabled(true);
+ statusLbl.setText(ulCfgFile.getAbsolutePath());
+ }
+
+ private void saveChangesAction(){
+ System.out.println("IMPLMENET ME"); // TODO
+ }
+
+ private void selectUlCfgAction(){
+ try {
+ JFileChooser fileChooser = new JFileChooser(FilesHelper.getRealFolder(recentRomLocation));
+ fileChooser.setDialogTitle(resourceBundle.getString("ulManagerWindow_SelectUlCfgBtn"));
+ fileChooser.setFileFilter(new ulCfgFileFilter());
+ if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
+ File file = fileChooser.getSelectedFile();
+ recentRomLocation = file.getParent();
+ showInTableUlCfgFile(file);
+ }
+ } catch (Exception e) {
+ statusLbl.setText(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/tihwin/ui/IsoFileFilter.java b/src/main/java/tihwin/ui/IsoFileFilter.java
index 51ee0fc..6d70e8d 100644
--- a/src/main/java/tihwin/ui/IsoFileFilter.java
+++ b/src/main/java/tihwin/ui/IsoFileFilter.java
@@ -20,11 +20,11 @@
*/
package tihwin.ui;
+import javax.swing.filechooser.FileFilter;
import java.io.File;
-import java.io.FileFilter;
import java.util.ResourceBundle;
-public class IsoFileFilter extends javax.swing.filechooser.FileFilter implements FileFilter {
+public class IsoFileFilter extends FileFilter {
@Override
public boolean accept(File file) {
if (file.isDirectory())
diff --git a/src/main/java/tihwin/ui/ulupdater/UlButtonCellEditor.java b/src/main/java/tihwin/ui/ulupdater/UlButtonCellEditor.java
new file mode 100644
index 0000000..d29a7cf
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlButtonCellEditor.java
@@ -0,0 +1,43 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import javax.swing.table.TableCellEditor;
+import java.awt.*;
+
+public class UlButtonCellEditor extends AbstractCellEditor implements TableCellEditor {
+ public UlButtonCellEditor(){
+
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ return null;
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+
+ ((UlTableModel) table.getModel()).removeRow(row);
+ return null;
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlCdDvdCellEditor.java b/src/main/java/tihwin/ui/ulupdater/UlCdDvdCellEditor.java
new file mode 100644
index 0000000..79fd81f
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlCdDvdCellEditor.java
@@ -0,0 +1,36 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import java.util.ResourceBundle;
+
+public class UlCdDvdCellEditor extends DefaultCellEditor {
+ static {
+ ResourceBundle bundle = ResourceBundle.getBundle("locale");
+ CD_DVD = new String[]{bundle.getString("CD"), bundle.getString("DVD")};
+ }
+ private static final String[] CD_DVD;
+
+ public UlCdDvdCellEditor(){
+ super(new JComboBox<>(CD_DVD));
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlTableColumnModel.java b/src/main/java/tihwin/ui/ulupdater/UlTableColumnModel.java
new file mode 100644
index 0000000..4d19c7c
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlTableColumnModel.java
@@ -0,0 +1,94 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.event.TableColumnModelEvent;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableColumn;
+import java.util.Enumeration;
+
+public class UlTableColumnModel extends DefaultTableColumnModel {
+ public UlTableColumnModel(DefaultTableColumnModel parentModel){
+ Enumeration columns = parentModel.getColumns();
+ while (columns.hasMoreElements()){
+ addColumn(columns.nextElement());
+ }
+
+ getColumn(0).setMinWidth(20);
+ getColumn(0).setPreferredWidth(25);
+ getColumn(0).setMaxWidth(50);
+
+ getColumn(1).setMinWidth(200);
+ getColumn(1).setPreferredWidth(225);
+
+ getColumn(2).setMinWidth(100);
+ getColumn(2).setPreferredWidth(135);
+ getColumn(2).setMaxWidth(150);
+
+ getColumn(3).setMinWidth(75);
+ getColumn(3).setPreferredWidth(100);
+ getColumn(3).setMaxWidth(125);
+
+ getColumn(4).setMinWidth(50);
+ getColumn(4).setPreferredWidth(75);
+ getColumn(4).setMaxWidth(100);
+
+ getColumn(4).setCellEditor(new UlCdDvdCellEditor());
+
+ getColumn(5).setCellEditor(new UlButtonCellEditor());
+
+ setColumnSelectionAllowed(false);
+
+ }
+
+ @Override
+ public void addColumn(TableColumn aColumn) {
+ super.addColumn(aColumn);
+ }
+
+ @Override
+ public void removeColumn(TableColumn column) {
+ super.removeColumn(column);
+ }
+
+ @Override
+ public void moveColumn(int columnIndex, int newIndex) {}
+
+ @Override
+ protected void fireColumnAdded(TableColumnModelEvent e) {
+ super.fireColumnAdded(e);
+ }
+
+ @Override
+ protected void fireColumnRemoved(TableColumnModelEvent e) {
+ super.fireColumnRemoved(e);
+ }
+
+ @Override
+ protected void fireColumnMoved(TableColumnModelEvent e) {
+ super.fireColumnMoved(e);
+ }
+
+ @Override
+ protected void fireColumnMarginChanged() {
+ super.fireColumnMarginChanged();
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlTableContentJButtonRenderer.java b/src/main/java/tihwin/ui/ulupdater/UlTableContentJButtonRenderer.java
new file mode 100644
index 0000000..5a1152b
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlTableContentJButtonRenderer.java
@@ -0,0 +1,42 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.*;
+
+public class UlTableContentJButtonRenderer extends DefaultTableCellRenderer {
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus,
+ int row, int column){
+ JButton button = (JButton) value;
+ if (hasFocus)
+ button.setBackground(Color.getHSBColor(0.559524f, 0.119658f, 0.917647f));
+ else
+ button.setBackground(Color.getHSBColor(0.5591398f, 0.12156863f, 1));
+
+ return button;
+ }
+
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlTableContentJLabelRenderer.java b/src/main/java/tihwin/ui/ulupdater/UlTableContentJLabelRenderer.java
new file mode 100644
index 0000000..30a69a7
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlTableContentJLabelRenderer.java
@@ -0,0 +1,53 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.*;
+
+public class UlTableContentJLabelRenderer extends DefaultTableCellRenderer {
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus,
+ int row, int column){
+ JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ label.setBackground(Color.getHSBColor(0, 0, 0.9411765f));
+ label.setBorder(new EmptyBorder(0, 3, 0, 3));
+ switch (column){
+ case 0:
+ case 3:
+ label.setHorizontalAlignment(SwingConstants.CENTER);
+ label.setOpaque(true);
+ break;
+ case 2:
+ label.setHorizontalAlignment(SwingConstants.LEFT);
+ label.setOpaque(true);
+ break;
+ default:
+ label.setHorizontalAlignment(SwingConstants.LEFT);
+ label.setOpaque(false);
+ }
+ return label;
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlTableHeaderRenderer.java b/src/main/java/tihwin/ui/ulupdater/UlTableHeaderRenderer.java
new file mode 100644
index 0000000..9558dda
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlTableHeaderRenderer.java
@@ -0,0 +1,42 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.*;
+
+public class UlTableHeaderRenderer extends DefaultTableCellRenderer {
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus,
+ int row, int column){
+ JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ Font font = label.getFont();
+ label.setFont(new Font(font.getFontName(), Font.BOLD, font.getSize()));
+ label.setBorder(new LineBorder(Color.darkGray));
+ label.setHorizontalAlignment(SwingConstants.CENTER);
+ label.setBackground(Color.getHSBColor(0.33333334f, 0.12765957f, 0.92156863f));
+ return label;
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlTableModel.java b/src/main/java/tihwin/ui/ulupdater/UlTableModel.java
new file mode 100644
index 0000000..b70f7e0
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlTableModel.java
@@ -0,0 +1,78 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import java.util.ResourceBundle;
+
+public class UlTableModel extends DefaultTableModel {
+ static {
+ ResourceBundle bundle = ResourceBundle.getBundle("locale");
+ columns = new String[]{
+ bundle.getString("ulManagerWindow_ColumnNameNumber"),
+ bundle.getString("ulManagerWindow_ColumnNameTitle"),
+ bundle.getString("ulManagerWindow_ColumnNamePublisherTitle"),
+ bundle.getString("ulManagerWindow_ColumnNameChunksCount"),
+ bundle.getString("ulManagerWindow_ColumnCdDvdFlag"),
+ ""};
+ }
+ private static final String[] columns;
+
+ private int rowsCount;
+
+ public UlTableModel(){
+ super();
+ super.setColumnIdentifiers(columns);
+ }
+
+ public void addRow(UlTableRow row){
+ super.addRow(row.getRow());
+ this.rowsCount++;
+ }
+
+ @Override
+ public Class> getColumnClass(int column) {
+ if (column == 5)
+ return JButton.class;
+ return JLabel.class;
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int column) {
+ switch (column){
+ case 1:
+ case 4:
+ case 5:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void removeRow(int row) {
+ super.removeRow(row);
+ --rowsCount;
+ for (int i = row; i < rowsCount; i++)
+ setValueAt(i+1, i, 0);
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/UlTableRow.java b/src/main/java/tihwin/ui/ulupdater/UlTableRow.java
new file mode 100644
index 0000000..b7fdca4
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/UlTableRow.java
@@ -0,0 +1,63 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.*;
+import java.util.ResourceBundle;
+
+public class UlTableRow {
+ static {
+ ResourceBundle bundle = ResourceBundle.getBundle("locale");
+ REMOVE_ME_BUTTON_TEXT = bundle.getString("ulManagerWindow_Row_RemoveRowBtn");
+ CD_TEXT = bundle.getString("CD");
+ DVD_TEXT = bundle.getString("DVD");
+ }
+ private static final String REMOVE_ME_BUTTON_TEXT;
+ private static final String CD_TEXT;
+ private static final String DVD_TEXT;
+
+ private final int rowNumber;
+ private final String name;
+ private final String publisherTitle;
+ private final int chunksCount;
+ private final String cdDvdFlag;
+ private final JButton removeRowButton;
+
+ public UlTableRow(int rowNumber, String name, String publisherTitle, int chunksCount, boolean isDvd){
+ this.rowNumber = rowNumber;
+ this.name = name;
+ this.publisherTitle = publisherTitle;
+ this.chunksCount = chunksCount;
+ this.cdDvdFlag = isDvd? DVD_TEXT : CD_TEXT;
+ this.removeRowButton = new JButton(REMOVE_ME_BUTTON_TEXT);
+ }
+
+ public Object[] getRow(){
+ return new Object[]{
+ rowNumber,
+ name,
+ publisherTitle,
+ chunksCount,
+ cdDvdFlag,
+ removeRowButton
+ };
+ }
+}
diff --git a/src/main/java/tihwin/ui/ulupdater/ulCfgFileFilter.java b/src/main/java/tihwin/ui/ulupdater/ulCfgFileFilter.java
new file mode 100644
index 0000000..084eae4
--- /dev/null
+++ b/src/main/java/tihwin/ui/ulupdater/ulCfgFileFilter.java
@@ -0,0 +1,38 @@
+/*
+
+ Copyright "2022" Dmitry Isaenko
+
+ This file is part of Tihwin.
+
+ Tihwin is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Tihwin is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Tihwin. If not, see .
+
+ */
+package tihwin.ui.ulupdater;
+
+import javax.swing.filechooser.FileFilter;
+import java.io.File;
+
+public class ulCfgFileFilter extends FileFilter {
+ @Override
+ public boolean accept(File file) {
+ if (file.isDirectory())
+ return true;
+ return file.getName().equalsIgnoreCase("ul.cfg");
+ }
+
+ @Override
+ public String getDescription() {
+ return "ul.cfg";
+ }
+}
diff --git a/src/main/java/tihwin/ul/UlConfiguration.java b/src/main/java/tihwin/ul/UlConfiguration.java
index 27f5578..5710ef0 100644
--- a/src/main/java/tihwin/ul/UlConfiguration.java
+++ b/src/main/java/tihwin/ul/UlConfiguration.java
@@ -26,6 +26,9 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays;
public class UlConfiguration {
+ private static final byte DVD_FLAG = 0x14;
+ private static final byte CD_FLAG = 0x12;
+
private final String title;
private final String publisherTitle;
private final String crc32;
@@ -38,9 +41,9 @@ public class UlConfiguration {
this.crc32 = Integer.toHexString(OplCRC32(title)).toUpperCase();
this.chunksCount = chunksCount;
if (isDVD)
- cdDvdFlag = 0x14;
+ cdDvdFlag = DVD_FLAG;
else
- cdDvdFlag = 0x12;
+ cdDvdFlag = CD_FLAG;
}
private int OplCRC32(String string) throws Exception{
diff --git a/src/main/resources/locale.properties b/src/main/resources/locale.properties
index e61e29a..40aac92 100644
--- a/src/main/resources/locale.properties
+++ b/src/main/resources/locale.properties
@@ -22,3 +22,16 @@ ISO_CantReadRootDescriptor=Can't read CD/DVD directory entry for the root direct
ISO_NoSystemCnf=SYSTEM.CNF not found in this CD/DVD. Is it a PS2 Disk?
ISO_PublisherTitleNotFound=Title not found. SYSTEM.CNF file is next:
PleaseWaitText=Please wait while useless file fragments removing...
+editUlCfgBtn=Edit ul.cfg
+ulManager=ul.cfg manager
+ulManagerWindow_ColumnNameNumber=#
+ulManagerWindow_ColumnNameTitle=Name
+ulManagerWindow_ColumnNamePublisherTitle=Publisher title
+ulManagerWindow_ColumnNameChunksCount=Chunks count
+ulManagerWindow_ColumnCdDvdFlag=CD/DVD
+ulManagerWindow_Row_RemoveRowBtn=Remove
+CD=CD
+DVD=DVD
+ulManagerWindow_SaveBtn=Save changes
+ulManagerWindow_SelectUlCfgBtn=Select ul.cfg
+ulManagerWindow_EmptyOrIncorrectText=Empty or incorrect ul.cfg size
diff --git a/src/main/resources/locale_ko_KO.properties b/src/main/resources/locale_ko_KO.properties
index 7c61790..17775fc 100644
--- a/src/main/resources/locale_ko_KO.properties
+++ b/src/main/resources/locale_ko_KO.properties
@@ -22,3 +22,4 @@ ISO_CantReadRootDescriptor=\uB8E8\uD2B8 \uB514\uB809\uD1A0\uB9AC\uC5D0 \uB300\uD
ISO_NoSystemCnf=\uC774 CD/DVD\uC5D0\uC11C SYSTEM.CNF\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PS2 \uB514\uC2A4\uD06C\uAC00 \uB9DE\uB098\uC694?
ISO_PublisherTitleNotFound=\uC81C\uBAA9\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. SYSTEM.CNF \uD30C\uC77C\uC740 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4:
PleaseWaitText=\uC4F8\uBAA8\uC5C6\uB294 \uD30C\uC77C \uC870\uAC01\uC744 \uC81C\uAC70\uD558\uB294 \uB3D9\uC548 \uC7A0\uC2DC \uAE30\uB2E4\uB824 \uC8FC\uC138\uC694...
+ulManagerWindow_SelectUlCfgBtn=\uC120\uD0DD ul.cfg
diff --git a/src/main/resources/locale_ru_RU.properties b/src/main/resources/locale_ru_RU.properties
index 918be85..eb99e6f 100644
--- a/src/main/resources/locale_ru_RU.properties
+++ b/src/main/resources/locale_ru_RU.properties
@@ -22,3 +22,16 @@ ISO_CantReadRootDescriptor=\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043
ISO_NoSystemCnf=\u041D\u0430 \u044D\u0442\u043E\u043C CD/DVD \u043D\u0435\u0442 \u0444\u0430\u0439\u043B\u0430 SYSTEM.CNF. \u042D\u0442\u043E \u0442\u043E\u0447\u043D\u043E \u0434\u0438\u0441\u043A \u0434\u043B\u044F PS2?
ISO_PublisherTitleNotFound=\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E. SYSTEM.CNF \u0432\u044B\u0433\u043B\u044F\u0434\u0438\u0442 \u0442\u0430\u043A:
PleaseWaitText=\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u043E\u0434\u043E\u0436\u0434\u0438\u0442\u0435 \u043F\u043E\u043A\u0430 \u0443\u0434\u0430\u043B\u044F\u044E\u0442\u0441\u044F \u043D\u0435\u043D\u0443\u0436\u043D\u044B\u0435 \u0444\u0440\u0430\u0433\u043C\u0435\u043D\u0442\u044B \u0444\u0430\u0439\u043B\u0430...
+editUlCfgBtn=\u0420\u0435\u0434\u0430\u043A\u0442\u043E\u0440 ul.cfg
+ulManager=\u041C\u0435\u043D\u0435\u0434\u0436\u0435\u0440 ul.cnf
+ulManagerWindow_ColumnNameNumber=\u2116
+ulManagerWindow_ColumnNameTitle=\u0418\u043C\u044F
+ulManagerWindow_ColumnNamePublisherTitle=\u0418\u043C\u044F \u043E\u0442 \u0438\u0437\u0434\u0430\u0442\u0435\u043B\u044F
+ulManagerWindow_ColumnNameChunksCount=\u0412\u0441\u0435\u0433\u043E \u0447\u0430\u0441\u0442\u0435\u0439
+ulManagerWindow_ColumnCdDvdFlag=CD/DVD
+ulManagerWindow_Row_RemoveRowBtn=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
+CD=CD
+DVD=DVD
+ulManagerWindow_SaveBtn=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F
+ulManagerWindow_SelectUlCfgBtn=\u0412\u044B\u0431\u0440\u0430\u0442\u044C ul.cfg
+ulManagerWindow_EmptyOrIncorrectText=\u041F\u0443\u0441\u0442\u043E\u0439 \u0438\u043B\u0438 \u043D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430 ul.cfg