Начало
This commit is contained in:
10
settings.ini
Normal file
10
settings.ini
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[main]
|
||||||
|
db_url = jdbc\:postgresql\://10.1.7.74\:5432/pilot
|
||||||
|
db_user = translate
|
||||||
|
db_password = translate
|
||||||
|
[path0]
|
||||||
|
path=O:\\projects\\Workspace_PHP\\transit.istt.kz
|
||||||
|
check=[0-9|a-z|A-Z|_]+
|
||||||
|
extensions=*.php
|
||||||
|
pattern=trt(
|
||||||
|
type=5
|
||||||
@ -29,13 +29,12 @@
|
|||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="textArea1" alignment="0" max="32767" attributes="0"/>
|
<Component id="textArea1" alignment="0" max="32767" attributes="0"/>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<Component id="jButton3" min="-2" pref="298" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="jPanel4" max="32767" attributes="0"/>
|
<Component id="jPanel4" max="32767" attributes="0"/>
|
||||||
@ -48,12 +47,14 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
|
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="textArea1" min="-2" pref="143" max="-2" attributes="0"/>
|
<Component id="textArea1" min="-2" pref="380" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jCheckBox1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -73,10 +74,7 @@
|
|||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
|
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
@ -89,21 +87,15 @@
|
|||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Component id="jTabbedPane1" max="32767" attributes="0"/>
|
||||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" pref="200" max="-2" attributes="0"/>
|
|
||||||
<Component id="jButton3" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jTabbedPane1" pref="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="textArea2" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
<Component id="jBSaveSettings" min="-2" max="-2" attributes="0"/>
|
<Component id="jBSaveSettings" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
@ -111,15 +103,8 @@
|
|||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jTabbedPane1" max="32767" attributes="0"/>
|
<Component id="jTabbedPane1" max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="textArea2" min="-2" pref="118" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jBSaveSettings" min="-2" max="-2" attributes="0"/>
|
<Component id="jBSaveSettings" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -141,12 +126,12 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jScrollPane1" alignment="0" pref="746" max="32767" attributes="0"/>
|
<Component id="jScrollPane1" alignment="0" pref="915" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jScrollPane1" alignment="0" pref="179" max="32767" attributes="0"/>
|
<Component id="jScrollPane1" alignment="0" pref="149" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
@ -161,11 +146,12 @@
|
|||||||
<Component class="javax.swing.JTable" name="jTable1">
|
<Component class="javax.swing.JTable" name="jTable1">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||||
<Table columnCount="4" rowCount="4">
|
<Table columnCount="5" rowCount="0">
|
||||||
<Column editable="true" title="Файл/Путь" type="java.lang.String"/>
|
<Column editable="true" title="Файл/Путь" type="java.lang.String"/>
|
||||||
<Column editable="true" title="Расширения файлов" type="java.lang.String"/>
|
<Column editable="true" title="Расширения файлов" type="java.lang.String"/>
|
||||||
<Column editable="true" title="Шаблон поиска" type="java.lang.String"/>
|
<Column editable="true" title="Шаблон поиска" type="java.lang.String"/>
|
||||||
<Column editable="true" title="Шаблон проверки" type="java.lang.String"/>
|
<Column editable="true" title="Шаблон проверки" type="java.lang.String"/>
|
||||||
|
<Column editable="true" title="ID типа слов" type="java.lang.Integer"/>
|
||||||
</Table>
|
</Table>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
@ -199,7 +185,7 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jTFDBPassword" max="32767" attributes="0"/>
|
<Component id="jTFDBPassword" max="32767" attributes="0"/>
|
||||||
<Component id="jTFDBUser" max="32767" attributes="0"/>
|
<Component id="jTFDBUser" max="32767" attributes="0"/>
|
||||||
<Component id="jTFDBURL" pref="621" max="32767" attributes="0"/>
|
<Component id="jTFDBURL" pref="790" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
@ -231,7 +217,7 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jButton5" min="-2" max="-2" attributes="0"/>
|
<Component id="jButton5" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="66" max="32767" attributes="0"/>
|
<EmptySpace pref="36" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -276,21 +262,6 @@
|
|||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Пути для сканирования"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="jButton3">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Экспорт PO или XML файла"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="java.awt.TextArea" name="textArea2">
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="jBSaveSettings">
|
<Component class="javax.swing.JButton" name="jBSaveSettings">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Сохранить настройки"/>
|
<Property name="text" type="java.lang.String" value="Сохранить настройки"/>
|
||||||
@ -314,9 +285,17 @@
|
|||||||
</Component>
|
</Component>
|
||||||
<Component class="java.awt.TextArea" name="textArea1">
|
<Component class="java.awt.TextArea" name="textArea1">
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
<Component class="javax.swing.JButton" name="jButton3">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Перебираем файлы и создаём единый PHP файлик с _(“слово”)."/>
|
<Property name="text" type="java.lang.String" value="Экспорт PO или XML файла"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Экспортировать в базу при сканировании"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
|||||||
@ -37,21 +37,31 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
{
|
{
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
//Загружаем настройки из текстового файла
|
setTitle("GettextDB");
|
||||||
BufferedReader reader;
|
|
||||||
try
|
try {
|
||||||
{
|
File file = new File("settings.ini");
|
||||||
reader = new BufferedReader(new FileReader("settings.txt"));
|
if(file.exists()){
|
||||||
String line = null;
|
Ini ini = new Ini(file);
|
||||||
while ((line = reader.readLine()) != null)
|
jTFDBURL.setText(ini.get("main", "db_url"));
|
||||||
{
|
jTFDBUser.setText(ini.get("main", "db_user"));
|
||||||
textArea2.append(line + "\n");
|
jTFDBPassword.setText(ini.get("main", "db_password"));
|
||||||
|
|
||||||
|
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
|
||||||
|
for(int i=0;i<100;i++){
|
||||||
|
if(ini.get("path"+i)!=null){
|
||||||
|
String path = ini.get("path"+i, "path");
|
||||||
|
String check = ini.get("path"+i, "check");
|
||||||
|
String extensions = ini.get("path"+i, "extensions");
|
||||||
|
String pattern = ini.get("path"+i, "pattern");
|
||||||
|
String type = ini.get("path"+i, "type");
|
||||||
|
model.addRow(new Object[]{path, extensions, pattern, check, type });
|
||||||
|
System.out.print(path);
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException ex)
|
}
|
||||||
{
|
//ini.store();
|
||||||
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
}
|
||||||
} catch (IOException ex)
|
} catch (IOException ex) {
|
||||||
{
|
|
||||||
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,13 +89,11 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
jLabel6 = new javax.swing.JLabel();
|
jLabel6 = new javax.swing.JLabel();
|
||||||
jTFDBPassword = new javax.swing.JTextField();
|
jTFDBPassword = new javax.swing.JTextField();
|
||||||
jButton5 = new javax.swing.JButton();
|
jButton5 = new javax.swing.JButton();
|
||||||
jLabel2 = new javax.swing.JLabel();
|
|
||||||
jButton3 = new javax.swing.JButton();
|
|
||||||
textArea2 = new java.awt.TextArea();
|
|
||||||
jBSaveSettings = new javax.swing.JButton();
|
jBSaveSettings = new javax.swing.JButton();
|
||||||
jButton1 = new javax.swing.JButton();
|
jButton1 = new javax.swing.JButton();
|
||||||
textArea1 = new java.awt.TextArea();
|
textArea1 = new java.awt.TextArea();
|
||||||
jLabel1 = new javax.swing.JLabel();
|
jButton3 = new javax.swing.JButton();
|
||||||
|
jCheckBox1 = new javax.swing.JCheckBox();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||||
@ -96,17 +104,14 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
|
|
||||||
jTable1.setModel(new javax.swing.table.DefaultTableModel(
|
jTable1.setModel(new javax.swing.table.DefaultTableModel(
|
||||||
new Object [][] {
|
new Object [][] {
|
||||||
{null, null, null, null},
|
|
||||||
{null, null, null, null},
|
|
||||||
{null, null, null, null},
|
|
||||||
{null, null, null, null}
|
|
||||||
},
|
},
|
||||||
new String [] {
|
new String [] {
|
||||||
"Файл/Путь", "Расширения файлов", "Шаблон поиска", "Шаблон проверки"
|
"Файл/Путь", "Расширения файлов", "Шаблон поиска", "Шаблон проверки", "ID типа слов"
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Class[] types = new Class [] {
|
Class[] types = new Class [] {
|
||||||
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
|
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class
|
||||||
};
|
};
|
||||||
|
|
||||||
public Class getColumnClass(int columnIndex) {
|
public Class getColumnClass(int columnIndex) {
|
||||||
@ -119,11 +124,11 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
jPanel2.setLayout(jPanel2Layout);
|
jPanel2.setLayout(jPanel2Layout);
|
||||||
jPanel2Layout.setHorizontalGroup(
|
jPanel2Layout.setHorizontalGroup(
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 746, Short.MAX_VALUE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 915, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
jPanel2Layout.setVerticalGroup(
|
jPanel2Layout.setVerticalGroup(
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
jTabbedPane1.addTab("Настройки путей сканирования", jPanel2);
|
jTabbedPane1.addTab("Настройки путей сканирования", jPanel2);
|
||||||
@ -158,7 +163,7 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jTFDBPassword)
|
.addComponent(jTFDBPassword)
|
||||||
.addComponent(jTFDBUser)
|
.addComponent(jTFDBUser)
|
||||||
.addComponent(jTFDBURL, javax.swing.GroupLayout.DEFAULT_SIZE, 621, Short.MAX_VALUE)))
|
.addComponent(jTFDBURL, javax.swing.GroupLayout.DEFAULT_SIZE, 790, Short.MAX_VALUE)))
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
.addComponent(jButton5)))
|
.addComponent(jButton5)))
|
||||||
@ -181,20 +186,11 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
.addComponent(jLabel6))
|
.addComponent(jLabel6))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jButton5)
|
.addComponent(jButton5)
|
||||||
.addContainerGap(66, Short.MAX_VALUE))
|
.addContainerGap(36, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
jTabbedPane1.addTab("Настройки соединения с базой", jPanel3);
|
jTabbedPane1.addTab("Настройки соединения с базой", jPanel3);
|
||||||
|
|
||||||
jLabel2.setText("Пути для сканирования");
|
|
||||||
|
|
||||||
jButton3.setText("Экспорт PO или XML файла");
|
|
||||||
jButton3.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButton3ActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jBSaveSettings.setText("Сохранить настройки");
|
jBSaveSettings.setText("Сохранить настройки");
|
||||||
jBSaveSettings.addActionListener(new java.awt.event.ActionListener() {
|
jBSaveSettings.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
@ -209,16 +205,11 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jTabbedPane1)
|
||||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||||
.addComponent(jLabel2)
|
|
||||||
.addGap(200, 200, 200)
|
|
||||||
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
|
||||||
.addComponent(textArea2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addContainerGap())
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
.addComponent(jBSaveSettings))
|
.addComponent(jBSaveSettings)))
|
||||||
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
jPanel5Layout.setVerticalGroup(
|
jPanel5Layout.setVerticalGroup(
|
||||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
@ -226,12 +217,6 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(jTabbedPane1)
|
.addComponent(jTabbedPane1)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(jButton3)
|
|
||||||
.addComponent(jLabel2))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(textArea2, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jBSaveSettings)
|
.addComponent(jBSaveSettings)
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
@ -246,9 +231,7 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
);
|
);
|
||||||
jPanel4Layout.setVerticalGroup(
|
jPanel4Layout.setVerticalGroup(
|
||||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
|
||||||
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 0, Short.MAX_VALUE))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
jButton1.setText("Сканировать");
|
jButton1.setText("Сканировать");
|
||||||
@ -259,7 +242,14 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
jLabel1.setText("Перебираем файлы и создаём единый PHP файлик с _(“слово”).");
|
jButton3.setText("Экспорт PO или XML файла");
|
||||||
|
jButton3.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
jButton3ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jCheckBox1.setText("Экспортировать в базу при сканировании");
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@ -268,12 +258,12 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE))
|
|
||||||
.addComponent(textArea1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(textArea1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 298, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(jCheckBox1)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jButton1))
|
.addComponent(jButton1))
|
||||||
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
@ -282,28 +272,29 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(textArea1, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(textArea1, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jButton1)
|
.addComponent(jButton1)
|
||||||
|
.addComponent(jButton3)
|
||||||
|
.addComponent(jCheckBox1))
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void parse(String rootDir,String file)
|
private void parse(String rootDir,String extensions,String pattern,String check,String type)
|
||||||
{
|
{
|
||||||
// Просматриваем каталоги
|
// Просматриваем каталоги
|
||||||
FileFinder finder = new FileFinder();
|
FileFinder finder = new FileFinder();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Буферный файл для записи идентификаторов
|
// Буферный файл для записи идентификаторов
|
||||||
FileWriter fileWriter = new FileWriter(file);
|
//FileWriter fileWriter = new FileWriter(file);
|
||||||
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
|
//BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
|
||||||
bufferedWriter.write("<?\n");
|
//bufferedWriter.write("<?\n");
|
||||||
|
|
||||||
List searchRes = null;
|
List searchRes = null;
|
||||||
//searchRes = finder.findAll(rootDir,"(.*\\.as$)||(.*\\.mxml$)||(.*\\.xml$)");
|
//searchRes = finder.findAll(rootDir,"(.*\\.as$)||(.*\\.mxml$)||(.*\\.xml$)");
|
||||||
@ -331,34 +322,63 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
while((line = bufferedReader.readLine()) != null)
|
while((line = bufferedReader.readLine()) != null)
|
||||||
{
|
{
|
||||||
int from=0;
|
int from=0;
|
||||||
|
int to=0;
|
||||||
while(true) //Если несколько значений в строке
|
while(true) //Если несколько значений в строке
|
||||||
{
|
{
|
||||||
String pattern="trt(";
|
|
||||||
//int s=line.indexOf("_(", from);
|
|
||||||
int s=line.indexOf(pattern, from);
|
int s=line.indexOf(pattern, from);
|
||||||
if(s>=0)
|
if(s>=0)
|
||||||
{
|
{
|
||||||
from=s+pattern.length();
|
from=s+pattern.length();
|
||||||
int e=-1;
|
to=line.indexOf(")", from);
|
||||||
if(line.charAt(s+pattern.length()) == '"') { e=line.indexOf("\")", from); }
|
//int e=-1;
|
||||||
if(line.charAt(s+pattern.length()) == '\'') { e = line.indexOf("')", from); }
|
//if(line.charAt(s+pattern.length()) == '"') { e=line.indexOf("\")", from); }
|
||||||
if(e>=0)
|
//if(line.charAt(s+pattern.length()) == '\'') { e = line.indexOf("')", from); }
|
||||||
|
if(to>=0)
|
||||||
{
|
{
|
||||||
textArea1.append(line.substring(s, e + 2)+";\n");
|
String text = line.substring(from, to);
|
||||||
bufferedWriter.write(" "+line.substring(s, e + 2)+";\n");
|
if(text.indexOf("\"")>=0){ //Если строка с "
|
||||||
from=e+2;
|
int pos1 = text.indexOf("\"");
|
||||||
|
int pos2 = text.indexOf("\"",pos1+1);
|
||||||
|
if(pos2>pos1+1){
|
||||||
|
text = text.substring(pos1+1, pos2);
|
||||||
|
}else{
|
||||||
|
text="";
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
if(text.indexOf("'")>=0){ //Если строка с '
|
||||||
|
int pos1 = text.indexOf("'");
|
||||||
|
int pos2 = text.indexOf("'",pos1+1);
|
||||||
|
if(pos2>pos1+1){
|
||||||
|
text = text.substring(pos1+1, pos2);
|
||||||
|
}else{
|
||||||
|
text="";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
text="";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(text.length()>0){
|
||||||
|
if(text.matches("[0-9|a-z|A-Z|_]+")){
|
||||||
|
textArea1.append(text+"\n");
|
||||||
|
}else{
|
||||||
|
textArea1.append("NO VALUD = "+text+"\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
from+=to-from;
|
||||||
|
}
|
||||||
|
from+=1;
|
||||||
}else { break; }
|
}else { break; }
|
||||||
|
//line=line.substring(to); //Остатки строки на обработку
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bufferedReader.close();
|
bufferedReader.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Найдено " + finder.getFilesNumber() + " файлов и " + finder.getDirectoriesNumber() + " папок.");
|
//System.out.println("Найдено " + finder.getFilesNumber() + " файлов и " + finder.getDirectoriesNumber() + " папок.");
|
||||||
textArea1.append("Найдено " + finder.getFilesNumber() + " файлов и " + finder.getDirectoriesNumber() + " папок.\n");
|
textArea1.append("Найдено " + finder.getFilesNumber() + " файлов и " + finder.getDirectoriesNumber() + " папок.\n");
|
||||||
|
|
||||||
bufferedWriter.write("?>\n");
|
//bufferedWriter.write("?>\n");
|
||||||
bufferedWriter.close();
|
//bufferedWriter.close();
|
||||||
|
|
||||||
} catch (Exception err)
|
} catch (Exception err)
|
||||||
{
|
{
|
||||||
@ -381,22 +401,16 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new StringReader(textArea2.getText()));
|
//Перебираю значения таблицы и пускаю на сканирование каждое поле
|
||||||
String line1;
|
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
|
||||||
String line2;
|
for(int row=0;row<model.getRowCount();row++){
|
||||||
try
|
parse(
|
||||||
{
|
model.getValueAt(row,0).toString(),
|
||||||
while (true)
|
model.getValueAt(row,1).toString(),
|
||||||
{
|
model.getValueAt(row,2).toString(),
|
||||||
line1 = reader.readLine();
|
model.getValueAt(row,3).toString(),
|
||||||
line2 = reader.readLine();
|
model.getValueAt(row,4).toString()
|
||||||
if(line1==null || line2 == null) break;
|
);
|
||||||
//Парсим файлы и выписываем идентификаторы для перевода
|
|
||||||
parse(line1, line2); //Перезаписывает файл
|
|
||||||
}
|
|
||||||
} catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//GEN-LAST:event_jButton1ActionPerformed
|
}//GEN-LAST:event_jButton1ActionPerformed
|
||||||
@ -404,31 +418,16 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
|
|
||||||
private void jBSaveSettingsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jBSaveSettingsActionPerformed
|
private void jBSaveSettingsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jBSaveSettingsActionPerformed
|
||||||
{//GEN-HEADEREND:event_jBSaveSettingsActionPerformed
|
{//GEN-HEADEREND:event_jBSaveSettingsActionPerformed
|
||||||
FileWriter fileWriter = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Ini ini = new Ini(new File("O:\\temp\\settings.ini"));
|
Ini ini = new Ini(new File("settings.ini"));
|
||||||
ini.put("main", "db_url", jTFDBURL.getText());
|
ini.put("main", "db_url", jTFDBURL.getText());
|
||||||
ini.put("main", "db_user", jTFDBUser.getText());
|
ini.put("main", "db_user", jTFDBUser.getText());
|
||||||
ini.put("main", "db_password", jTFDBPassword.getText());
|
ini.put("main", "db_password", jTFDBPassword.getText());
|
||||||
ini.store();
|
ini.store();
|
||||||
|
|
||||||
fileWriter = new FileWriter("settings.txt");
|
|
||||||
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
|
|
||||||
bufferedWriter.write(textArea2.getText());
|
|
||||||
bufferedWriter.close();
|
|
||||||
} catch (IOException ex)
|
} catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
} finally
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fileWriter.close();
|
|
||||||
} catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_jBSaveSettingsActionPerformed
|
}//GEN-LAST:event_jBSaveSettingsActionPerformed
|
||||||
|
|
||||||
@ -440,30 +439,8 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
|
|
||||||
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
|
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
|
||||||
|
|
||||||
try {
|
|
||||||
File file = new File("O:\\temp\\settings.ini");
|
|
||||||
if(file.exists()){
|
|
||||||
Ini ini = new Ini(file);
|
|
||||||
jTFDBURL.setText(ini.get("main", "db_url"));
|
|
||||||
jTFDBUser.setText(ini.get("main", "db_user"));
|
|
||||||
jTFDBPassword.setText(ini.get("main", "db_password"));
|
|
||||||
|
|
||||||
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
|
|
||||||
for(int i=0;i<100;i++){
|
|
||||||
if(ini.get("path"+i)!=null){
|
|
||||||
String path = ini.get("path"+i, "path");
|
|
||||||
String check = ini.get("path"+i, "check");
|
|
||||||
String extensions = ini.get("path"+i, "extensions");
|
|
||||||
model.addRow(new Object[]{path, extensions, check});
|
|
||||||
|
|
||||||
System.out.print(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//ini.store();
|
|
||||||
}
|
|
||||||
} catch (IOException ex) {
|
|
||||||
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//GEN-LAST:event_formWindowActivated
|
}//GEN-LAST:event_formWindowActivated
|
||||||
|
|
||||||
@ -516,8 +493,7 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
private javax.swing.JButton jButton1;
|
private javax.swing.JButton jButton1;
|
||||||
private javax.swing.JButton jButton3;
|
private javax.swing.JButton jButton3;
|
||||||
private javax.swing.JButton jButton5;
|
private javax.swing.JButton jButton5;
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JCheckBox jCheckBox1;
|
||||||
private javax.swing.JLabel jLabel2;
|
|
||||||
private javax.swing.JLabel jLabel4;
|
private javax.swing.JLabel jLabel4;
|
||||||
private javax.swing.JLabel jLabel5;
|
private javax.swing.JLabel jLabel5;
|
||||||
private javax.swing.JLabel jLabel6;
|
private javax.swing.JLabel jLabel6;
|
||||||
@ -532,6 +508,5 @@ public class NewJFrame extends javax.swing.JFrame
|
|||||||
private javax.swing.JTabbedPane jTabbedPane1;
|
private javax.swing.JTabbedPane jTabbedPane1;
|
||||||
private javax.swing.JTable jTable1;
|
private javax.swing.JTable jTable1;
|
||||||
private java.awt.TextArea textArea1;
|
private java.awt.TextArea textArea1;
|
||||||
private java.awt.TextArea textArea2;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user