Implement front end for ul.cfg manager. ul.cfg manager needed to safely rename or remove existing split-files.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5cd6d98ff9
commit
939ca2a7bd
17 changed files with 748 additions and 23 deletions
|
@ -20,6 +20,8 @@
|
||||||
<colspec value="fill:p:noGrow"/>
|
<colspec value="fill:p:noGrow"/>
|
||||||
<colspec value="fill:max(d;4px):noGrow"/>
|
<colspec value="fill:max(d;4px):noGrow"/>
|
||||||
<colspec value="fill:d:grow"/>
|
<colspec value="fill:d:grow"/>
|
||||||
|
<colspec value="left:4dlu:noGrow"/>
|
||||||
|
<colspec value="fill:p:noGrow"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="0" y="0" width="729" height="288"/>
|
<xy x="0" y="0" width="729" height="288"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -33,23 +35,22 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<background color="-2034433"/>
|
<background color="-2034433"/>
|
||||||
<iconTextGap value="4"/>
|
|
||||||
<text resource-bundle="locale" key="SelectBtn"/>
|
<text resource-bundle="locale" key="SelectBtn"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="8e185" class="javax.swing.JTextField" binding="titleField">
|
<component id="8e185" class="javax.swing.JTextField" binding="titleField">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
<grid row="4" column="6" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
<forms top="0" left="0" bottom="0" right="5"/>
|
<forms/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
<component id="b32ec" class="javax.swing.JLabel" binding="destinationDirectoryLbl">
|
<component id="b32ec" class="javax.swing.JLabel" binding="destinationDirectoryLbl">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="6" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="6" column="6" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
<forms top="0" left="0" bottom="0" right="5"/>
|
<forms/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value=""/>
|
<text value=""/>
|
||||||
|
@ -58,7 +59,7 @@
|
||||||
<component id="43fa" class="javax.swing.JLabel" binding="diskImageNameLbl">
|
<component id="43fa" class="javax.swing.JLabel" binding="diskImageNameLbl">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
<forms top="0" left="0" bottom="0" right="5"/>
|
<forms/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value=""/>
|
<text value=""/>
|
||||||
|
@ -107,7 +108,7 @@
|
||||||
<forms/>
|
<forms/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="CD"/>
|
<text resource-bundle="locale" key="CD"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="1dd66" class="javax.swing.JRadioButton" binding="DVDRadioButton" default-binding="true">
|
<component id="1dd66" class="javax.swing.JRadioButton" binding="DVDRadioButton" default-binding="true">
|
||||||
|
@ -117,12 +118,12 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<selected value="true"/>
|
<selected value="true"/>
|
||||||
<text value="DVD"/>
|
<text resource-bundle="locale" key="DVD"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="308a4" class="javax.swing.JButton" binding="convertBtn">
|
<component id="308a4" class="javax.swing.JButton" binding="convertBtn">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="8" column="0" row-span="1" col-span="7" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
<grid row="8" column="0" row-span="1" col-span="9" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||||
<minimum-size width="-1" height="50"/>
|
<minimum-size width="-1" height="50"/>
|
||||||
</grid>
|
</grid>
|
||||||
<forms top="0" left="5" bottom="0" right="5"/>
|
<forms top="0" left="5" bottom="0" right="5"/>
|
||||||
|
@ -135,7 +136,7 @@
|
||||||
<grid id="8b0eb" binding="statusJPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="8b0eb" binding="statusJPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="5" left="5" bottom="5" right="5"/>
|
<margin top="5" left="5" bottom="5" right="5"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="11" column="0" row-span="1" col-span="7" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="11" column="0" row-span="1" col-span="9" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
<forms/>
|
<forms/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -169,7 +170,7 @@
|
||||||
<grid id="a5cce" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="a5cce" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="7" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="9" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
<forms/>
|
<forms/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -188,6 +189,19 @@
|
||||||
</component>
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
|
<component id="824ea" class="javax.swing.JButton" binding="ulCfgBtn">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="8" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
<forms top="0" left="0" bottom="0" right="5"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<background color="-2031648"/>
|
||||||
|
<margin top="1" left="1" bottom="1" right="1"/>
|
||||||
|
<minimumSize width="130" height="30"/>
|
||||||
|
<preferredSize width="140" height="30"/>
|
||||||
|
<text resource-bundle="locale" key="editUlCfgBtn"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<buttonGroups>
|
<buttonGroups>
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class MainAppUi extends JFrame {
|
||||||
private JTextField titleField;
|
private JTextField titleField;
|
||||||
private JRadioButton CDRadioButton;
|
private JRadioButton CDRadioButton;
|
||||||
private JRadioButton DVDRadioButton;
|
private JRadioButton DVDRadioButton;
|
||||||
|
private JButton ulCfgBtn;
|
||||||
private final ResourceBundle resourceBundle;
|
private final ResourceBundle resourceBundle;
|
||||||
|
|
||||||
private String recentRomLocation;
|
private String recentRomLocation;
|
||||||
|
@ -71,6 +72,7 @@ public class MainAppUi extends JFrame {
|
||||||
diskImageSelectBtn.addActionListener(actionEvent -> diskImageSelectEventHandler());
|
diskImageSelectBtn.addActionListener(actionEvent -> diskImageSelectEventHandler());
|
||||||
destinationSelectBtn.addActionListener(actionEvent -> destinationSelectEventHandler());
|
destinationSelectBtn.addActionListener(actionEvent -> destinationSelectEventHandler());
|
||||||
convertBtn.addActionListener(actionEvent -> convertButtonAction());
|
convertBtn.addActionListener(actionEvent -> convertButtonAction());
|
||||||
|
ulCfgBtn.addActionListener(actionEvent -> ulConfigButtonAction());
|
||||||
((AbstractDocument) titleField.getDocument()).setDocumentFilter(new TitleFieldFilter());
|
((AbstractDocument) titleField.getDocument()).setDocumentFilter(new TitleFieldFilter());
|
||||||
if (Settings.INSTANCE.getDvdSelected())
|
if (Settings.INSTANCE.getDvdSelected())
|
||||||
DVDRadioButton.setSelected(true);
|
DVDRadioButton.setSelected(true);
|
||||||
|
@ -80,6 +82,7 @@ public class MainAppUi extends JFrame {
|
||||||
destinationDirectoryLbl.setText(FilesHelper.getRealFolder(Settings.INSTANCE.getDestination()));
|
destinationDirectoryLbl.setText(FilesHelper.getRealFolder(Settings.INSTANCE.getDestination()));
|
||||||
|
|
||||||
addWindowListener(getWindowListener());
|
addWindowListener(getWindowListener());
|
||||||
|
new UpdateUlTableUi(new File(destinationDirectoryLbl.getText() + File.separator + "ul.cfg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private WindowListener getWindowListener() {
|
private WindowListener getWindowListener() {
|
||||||
|
@ -215,6 +218,10 @@ public class MainAppUi extends JFrame {
|
||||||
convertBtn.setText(resourceBundle.getString("ConvertBtn"));
|
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
|
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||||
// >>> IMPORTANT!! <<<
|
// >>> IMPORTANT!! <<<
|
||||||
|
@ -231,21 +238,20 @@ public class MainAppUi extends JFrame {
|
||||||
*/
|
*/
|
||||||
private void $$$setupUI$$$() {
|
private void $$$setupUI$$$() {
|
||||||
mainPanel = new JPanel();
|
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 = new JButton();
|
||||||
diskImageSelectBtn.setBackground(new Color(-2034433));
|
diskImageSelectBtn.setBackground(new Color(-2034433));
|
||||||
diskImageSelectBtn.setIconTextGap(4);
|
|
||||||
this.$$$loadButtonText$$$(diskImageSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn"));
|
this.$$$loadButtonText$$$(diskImageSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn"));
|
||||||
CellConstraints cc = new CellConstraints();
|
CellConstraints cc = new CellConstraints();
|
||||||
mainPanel.add(diskImageSelectBtn, new CellConstraints(1, 3, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0)));
|
mainPanel.add(diskImageSelectBtn, new CellConstraints(1, 3, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0)));
|
||||||
titleField = new JTextField();
|
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 = new JLabel();
|
||||||
destinationDirectoryLbl.setText("");
|
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 = new JLabel();
|
||||||
diskImageNameLbl.setText("");
|
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 = new JButton();
|
||||||
destinationSelectBtn.setBackground(new Color(-2034433));
|
destinationSelectBtn.setBackground(new Color(-2034433));
|
||||||
this.$$$loadButtonText$$$(destinationSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn"));
|
this.$$$loadButtonText$$$(destinationSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn"));
|
||||||
|
@ -269,11 +275,11 @@ public class MainAppUi extends JFrame {
|
||||||
convertBtn = new JButton();
|
convertBtn = new JButton();
|
||||||
convertBtn.setBackground(new Color(-2034433));
|
convertBtn.setBackground(new Color(-2034433));
|
||||||
this.$$$loadButtonText$$$(convertBtn, this.$$$getMessageFromBundle$$$("locale", "ConvertBtn"));
|
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 = new JPanel();
|
||||||
statusJPanel.setLayout(new GridLayoutManager(1, 1, new Insets(5, 5, 5, 5), -1, -1));
|
statusJPanel.setLayout(new GridLayoutManager(1, 1, new Insets(5, 5, 5, 5), -1, -1));
|
||||||
statusJPanel.setBackground(new Color(-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();
|
statusLbl = new JLabel();
|
||||||
this.$$$loadLabelText$$$(statusLbl, this.$$$getMessageFromBundle$$$("locale", "WelcomeText"));
|
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));
|
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();
|
final JPanel panel1 = new JPanel();
|
||||||
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
panel1.setBackground(new Color(-9251843));
|
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();
|
final JLabel label4 = new JLabel();
|
||||||
label4.setIcon(new ImageIcon(getClass().getResource("/banner.png")));
|
label4.setIcon(new ImageIcon(getClass().getResource("/banner.png")));
|
||||||
label4.setText("");
|
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));
|
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 buttonGroup;
|
||||||
buttonGroup = new ButtonGroup();
|
buttonGroup = new ButtonGroup();
|
||||||
buttonGroup.add(DVDRadioButton);
|
buttonGroup.add(DVDRadioButton);
|
||||||
|
@ -373,4 +386,5 @@ public class MainAppUi extends JFrame {
|
||||||
public JComponent $$$getRootComponent$$$() {
|
public JComponent $$$getRootComponent$$$() {
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
178
src/main/java/tihwin/UpdateUlTableUi.java
Normal file
178
src/main/java/tihwin/UpdateUlTableUi.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,11 +20,11 @@
|
||||||
*/
|
*/
|
||||||
package tihwin.ui;
|
package tihwin.ui;
|
||||||
|
|
||||||
|
import javax.swing.filechooser.FileFilter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class IsoFileFilter extends javax.swing.filechooser.FileFilter implements FileFilter {
|
public class IsoFileFilter extends FileFilter {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
if (file.isDirectory())
|
if (file.isDirectory())
|
||||||
|
|
43
src/main/java/tihwin/ui/ulupdater/UlButtonCellEditor.java
Normal file
43
src/main/java/tihwin/ui/ulupdater/UlButtonCellEditor.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
36
src/main/java/tihwin/ui/ulupdater/UlCdDvdCellEditor.java
Normal file
36
src/main/java/tihwin/ui/ulupdater/UlCdDvdCellEditor.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
94
src/main/java/tihwin/ui/ulupdater/UlTableColumnModel.java
Normal file
94
src/main/java/tihwin/ui/ulupdater/UlTableColumnModel.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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<TableColumn> 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
42
src/main/java/tihwin/ui/ulupdater/UlTableHeaderRenderer.java
Normal file
42
src/main/java/tihwin/ui/ulupdater/UlTableHeaderRenderer.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
78
src/main/java/tihwin/ui/ulupdater/UlTableModel.java
Normal file
78
src/main/java/tihwin/ui/ulupdater/UlTableModel.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
63
src/main/java/tihwin/ui/ulupdater/UlTableRow.java
Normal file
63
src/main/java/tihwin/ui/ulupdater/UlTableRow.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
38
src/main/java/tihwin/ui/ulupdater/ulCfgFileFilter.java
Normal file
38
src/main/java/tihwin/ui/ulupdater/ulCfgFileFilter.java
Normal file
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,6 +26,9 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class UlConfiguration {
|
public class UlConfiguration {
|
||||||
|
private static final byte DVD_FLAG = 0x14;
|
||||||
|
private static final byte CD_FLAG = 0x12;
|
||||||
|
|
||||||
private final String title;
|
private final String title;
|
||||||
private final String publisherTitle;
|
private final String publisherTitle;
|
||||||
private final String crc32;
|
private final String crc32;
|
||||||
|
@ -38,9 +41,9 @@ public class UlConfiguration {
|
||||||
this.crc32 = Integer.toHexString(OplCRC32(title)).toUpperCase();
|
this.crc32 = Integer.toHexString(OplCRC32(title)).toUpperCase();
|
||||||
this.chunksCount = chunksCount;
|
this.chunksCount = chunksCount;
|
||||||
if (isDVD)
|
if (isDVD)
|
||||||
cdDvdFlag = 0x14;
|
cdDvdFlag = DVD_FLAG;
|
||||||
else
|
else
|
||||||
cdDvdFlag = 0x12;
|
cdDvdFlag = CD_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OplCRC32(String string) throws Exception{
|
private int OplCRC32(String string) throws Exception{
|
||||||
|
|
|
@ -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_NoSystemCnf=SYSTEM.CNF not found in this CD/DVD. Is it a PS2 Disk?
|
||||||
ISO_PublisherTitleNotFound=Title not found. SYSTEM.CNF file is next:
|
ISO_PublisherTitleNotFound=Title not found. SYSTEM.CNF file is next:
|
||||||
PleaseWaitText=Please wait while useless file fragments removing...
|
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
|
||||||
|
|
|
@ -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_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:
|
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...
|
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
|
||||||
|
|
|
@ -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_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:
|
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...
|
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
|
||||||
|
|
Loading…
Reference in a new issue