Modified log output
This commit is contained in:
parent
5ba4cfabe7
commit
f86b125dc1
3 changed files with 41 additions and 10 deletions
|
@ -157,11 +157,11 @@ public class DialogHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showWarningMessage(XComponentContext context, XDialog dialog, String message) {
|
public static void showWarningMessage(XComponentContext context, XDialog dialog, String message) {
|
||||||
showMessageBox(context, dialog, MessageBoxType.WARNINGBOX, "Warnung", message);
|
showMessageBox(context, dialog, MessageBoxType.WARNINGBOX, "Warning", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showErrorMessage(XComponentContext context, XDialog dialog, String message) {
|
public static void showErrorMessage(XComponentContext context, XDialog dialog, String message) {
|
||||||
showMessageBox(context, dialog, MessageBoxType.ERRORBOX, "Fehler", message);
|
showMessageBox(context, dialog, MessageBoxType.ERRORBOX, "Error", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showMessageBox(XComponentContext context, XDialog dialog, MessageBoxType type, String sTitle, String sMessage) {
|
public static void showMessageBox(XComponentContext context, XDialog dialog, MessageBoxType type, String sTitle, String sMessage) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import javax.swing.UIManager;
|
||||||
|
|
||||||
import com.sun.star.uno.XComponentContext;
|
import com.sun.star.uno.XComponentContext;
|
||||||
|
|
||||||
import pro.litvinovg.w2phtml.DialogHelper;
|
import pro.litvinovg.xml.Debug;
|
||||||
|
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
|
@ -54,6 +54,7 @@ public class ConfigurationWindow extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
private XComponentContext context;
|
private XComponentContext context;
|
||||||
|
private JTextField tf_FilePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the application.
|
* Create the application.
|
||||||
|
@ -345,6 +346,7 @@ public class ConfigurationWindow extends JFrame {
|
||||||
private JPanel createConfigHTMLPanel() {
|
private JPanel createConfigHTMLPanel() {
|
||||||
JPanel panel_configHTML = new JPanel();
|
JPanel panel_configHTML = new JPanel();
|
||||||
|
|
||||||
|
|
||||||
JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax");
|
JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax");
|
||||||
|
|
||||||
JCheckBox cb_IgnoreEmptyParagraphs_2 = new JCheckBox("Split on whole pages only");
|
JCheckBox cb_IgnoreEmptyParagraphs_2 = new JCheckBox("Split on whole pages only");
|
||||||
|
@ -382,12 +384,21 @@ public class ConfigurationWindow extends JFrame {
|
||||||
tf_MaxWidth.setColumns(10);
|
tf_MaxWidth.setColumns(10);
|
||||||
|
|
||||||
JCheckBox cb_ConversionToRem = new JCheckBox("Convert dimensions to REM");
|
JCheckBox cb_ConversionToRem = new JCheckBox("Convert dimensions to REM");
|
||||||
|
|
||||||
|
JLabel lb_FilePath = new JLabel("File path");
|
||||||
|
|
||||||
|
tf_FilePath = new JTextField();
|
||||||
|
tf_FilePath.setColumns(10);
|
||||||
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
||||||
gl_panel_configHTML.setHorizontalGroup(
|
gl_panel_configHTML.setHorizontalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGap(40)
|
.addGap(40)
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(18)
|
||||||
|
.addComponent(tf_FilePath, GroupLayout.DEFAULT_SIZE, 755, Short.MAX_VALUE))
|
||||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
@ -413,12 +424,19 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addGap(42)
|
.addGap(42)
|
||||||
.addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
.addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs_2, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE))
|
.addComponent(cb_IgnoreEmptyParagraphs_2, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE))
|
||||||
.addContainerGap(332, Short.MAX_VALUE))
|
.addGap(40))
|
||||||
);
|
);
|
||||||
gl_panel_configHTML.setVerticalGroup(
|
gl_panel_configHTML.setVerticalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGap(38)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGap(17)
|
||||||
|
.addComponent(lb_FilePath))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGap(15)
|
||||||
|
.addComponent(tf_FilePath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGap(2)
|
.addGap(2)
|
||||||
|
@ -460,7 +478,7 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs_2)
|
.addComponent(cb_IgnoreEmptyParagraphs_2)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
.addComponent(cb_UseMathJax)
|
.addComponent(cb_UseMathJax)
|
||||||
.addContainerGap(310, Short.MAX_VALUE))
|
.addContainerGap(364, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
panel_configHTML.setLayout(gl_panel_configHTML);
|
panel_configHTML.setLayout(gl_panel_configHTML);
|
||||||
return panel_configHTML;
|
return panel_configHTML;
|
||||||
|
@ -521,8 +539,8 @@ public class ConfigurationWindow extends JFrame {
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
DialogHelper.showErrorMessage(context, null, e.getLocalizedMessage());
|
String message = e.getLocalizedMessage();
|
||||||
e.printStackTrace();
|
Debug.printLog(message, context);
|
||||||
}
|
}
|
||||||
EventQueue.invokeLater(new Runnable() {
|
EventQueue.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -534,8 +552,9 @@ public class ConfigurationWindow extends JFrame {
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
DialogHelper.showErrorMessage(context, null, e.getLocalizedMessage());
|
String message = e.getLocalizedMessage();
|
||||||
e.printStackTrace();
|
|
||||||
|
Debug.printLog(message, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,10 @@ import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.ls.DOMImplementationLS;
|
import org.w3c.dom.ls.DOMImplementationLS;
|
||||||
import org.w3c.dom.ls.LSSerializer;
|
import org.w3c.dom.ls.LSSerializer;
|
||||||
|
|
||||||
|
import com.sun.star.uno.XComponentContext;
|
||||||
|
|
||||||
|
import pro.litvinovg.w2phtml.DialogHelper;
|
||||||
|
|
||||||
|
|
||||||
public class Debug {
|
public class Debug {
|
||||||
public static void printNode(Node node){
|
public static void printNode(Node node){
|
||||||
|
@ -21,4 +25,12 @@ public class Debug {
|
||||||
System.out.println(ste);
|
System.out.println(ste);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void printLog(String message, XComponentContext context) {
|
||||||
|
if (context != null) {
|
||||||
|
DialogHelper.showErrorMessage(context, null, message);
|
||||||
|
} else {
|
||||||
|
System.out.println(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue