commit 087a5ccf5be0e9c24f2f47c6af31d4f525293e3e Author: Dmitry Isaenko Date: Tue Jul 11 04:09:28 2017 +0300 init commit diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..2c55e21 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b76f400 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..a008589 --- /dev/null +++ b/README @@ -0,0 +1,8 @@ + Author: Dmitry Isaenko + License: GPL v.3 + Version: 1.0 + Site: https://developersu.blogspot.com/ + 2017, Russia + + Purpose: + Prepare xml text to be added into your site. diff --git a/XMLtoWeb.iml b/XMLtoWeb.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/XMLtoWeb.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/general/AppGui.form b/src/general/AppGui.form new file mode 100644 index 0000000..7d346e1 --- /dev/null +++ b/src/general/AppGui.form @@ -0,0 +1,131 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/general/AppGui.java b/src/general/AppGui.java new file mode 100644 index 0000000..168beeb --- /dev/null +++ b/src/general/AppGui.java @@ -0,0 +1,82 @@ +package general; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class AppGui { + private JTextArea outputTextArea; + private JTextArea intutTextArea; + private JButton updateBtn; + private JPanel myPanel; + private JCheckBox cCRLF; + private JCheckBox cSpaces; + private JCheckBox cPreCode; + private JRadioButton cPre; + private JRadioButton cCode; + private JLabel copylefts; + private JScrollBar scrollBarOutpVert; + + private String parcer(String text){ + // Deal with spaces at first + if (cSpaces.isSelected()){ + text = text.replace(" "," "); + text = text.replace("\t","    "); // deal with tabs + } + + text = text.replace("<","<"); + text = text.replace(">",">"); + if (cCRLF.isSelected()){ + text = text.replace("\n","
\n"); + } + + if (cPreCode.isSelected()){ + if (cPre.isSelected()){ + text = "
\n" + text + "\n
"; + }else if (cCode.isSelected()){ + text = "\n" + text + "\n"; + } + } + return text; + } + + public static void main(String[] args){ + JFrame frame = new JFrame("XMLtoWeb"); + frame.setContentPane(new AppGui().myPanel); + frame.pack(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setMinimumSize(new Dimension(1024, 480)); + frame.setVisible(true); + } + + public AppGui(){ + + ButtonGroup btnGrp = new ButtonGroup(); + btnGrp.add(cPre); + btnGrp.add(cCode); + + cPreCode.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + if (cPreCode.isSelected()) { + cPre.setEnabled(true); + cCode.setEnabled(true); + }else{ + cPre.setEnabled(false); + cCode.setEnabled(false); + } + } + }); + + updateBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + String textReturned = parcer(intutTextArea.getText()); + outputTextArea.setText(textReturned); + } + }); + + } + +}