Modified log output
This commit is contained in:
parent
5ba4cfabe7
commit
f86b125dc1
3 changed files with 41 additions and 10 deletions
src/main/java/pro/litvinovg
|
@ -157,11 +157,11 @@ public class DialogHelper {
|
|||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import javax.swing.UIManager;
|
|||
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
||||
import pro.litvinovg.w2phtml.DialogHelper;
|
||||
import pro.litvinovg.xml.Debug;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.GridLayout;
|
||||
|
@ -54,6 +54,7 @@ public class ConfigurationWindow extends JFrame {
|
|||
}
|
||||
|
||||
private XComponentContext context;
|
||||
private JTextField tf_FilePath;
|
||||
|
||||
/**
|
||||
* Create the application.
|
||||
|
@ -345,6 +346,7 @@ public class ConfigurationWindow extends JFrame {
|
|||
private JPanel createConfigHTMLPanel() {
|
||||
JPanel panel_configHTML = new JPanel();
|
||||
|
||||
|
||||
JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax");
|
||||
|
||||
JCheckBox cb_IgnoreEmptyParagraphs_2 = new JCheckBox("Split on whole pages only");
|
||||
|
@ -382,12 +384,21 @@ public class ConfigurationWindow extends JFrame {
|
|||
tf_MaxWidth.setColumns(10);
|
||||
|
||||
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);
|
||||
gl_panel_configHTML.setHorizontalGroup(
|
||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.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)
|
||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||
|
@ -413,12 +424,19 @@ public class ConfigurationWindow extends JFrame {
|
|||
.addGap(42)
|
||||
.addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, 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.createParallelGroup(Alignment.LEADING)
|
||||
.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.createSequentialGroup()
|
||||
.addGap(2)
|
||||
|
@ -460,7 +478,7 @@ public class ConfigurationWindow extends JFrame {
|
|||
.addComponent(cb_IgnoreEmptyParagraphs_2)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(cb_UseMathJax)
|
||||
.addContainerGap(310, Short.MAX_VALUE))
|
||||
.addContainerGap(364, Short.MAX_VALUE))
|
||||
);
|
||||
panel_configHTML.setLayout(gl_panel_configHTML);
|
||||
return panel_configHTML;
|
||||
|
@ -521,8 +539,8 @@ public class ConfigurationWindow extends JFrame {
|
|||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Throwable e) {
|
||||
DialogHelper.showErrorMessage(context, null, e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
String message = e.getLocalizedMessage();
|
||||
Debug.printLog(message, context);
|
||||
}
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -534,8 +552,9 @@ public class ConfigurationWindow extends JFrame {
|
|||
frame.setVisible(true);
|
||||
|
||||
} catch (Throwable e) {
|
||||
DialogHelper.showErrorMessage(context, null, e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
String message = e.getLocalizedMessage();
|
||||
|
||||
Debug.printLog(message, context);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,6 +6,10 @@ import org.w3c.dom.Node;
|
|||
import org.w3c.dom.ls.DOMImplementationLS;
|
||||
import org.w3c.dom.ls.LSSerializer;
|
||||
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
||||
import pro.litvinovg.w2phtml.DialogHelper;
|
||||
|
||||
|
||||
public class Debug {
|
||||
public static void printNode(Node node){
|
||||
|
@ -21,4 +25,12 @@ public class Debug {
|
|||
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