Changeset 5888 in josm for trunk


Ignore:
Timestamp:
2013-04-20T02:41:08+02:00 (7 years ago)
Author:
Don-vip
Message:

code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/actionsupport/DeleteFromRelationConfirmationDialog.java

    r5886 r5888  
    99import java.awt.Dimension;
    1010import java.awt.FlowLayout;
    11 import java.awt.Font;
    1211import java.awt.event.ActionEvent;
    1312import java.awt.event.WindowAdapter;
    1413import java.awt.event.WindowEvent;
    15 import java.text.MessageFormat;
    1614import java.util.ArrayList;
    1715import java.util.Collection;
     
    2220
    2321import javax.swing.AbstractAction;
    24 import javax.swing.BorderFactory;
    2522import javax.swing.JDialog;
    2623import javax.swing.JOptionPane;
     
    2825import javax.swing.JScrollPane;
    2926import javax.swing.JTable;
    30 import javax.swing.UIManager;
    3127import javax.swing.event.TableModelEvent;
    3228import javax.swing.event.TableModelListener;
     
    3430import javax.swing.table.DefaultTableModel;
    3531import javax.swing.table.TableColumn;
    36 import javax.swing.text.html.HTMLEditorKit;
    37 import javax.swing.text.html.StyleSheet;
    3832
    3933import org.openstreetmap.josm.Main;
     
    4640import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
    4741import org.openstreetmap.josm.gui.help.HelpUtil;
    48 import org.openstreetmap.josm.gui.widgets.JosmEditorPane;
     42import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    4943import org.openstreetmap.josm.tools.ImageProvider;
    5044import org.openstreetmap.josm.tools.WindowGeometry;
     
    7367    /** the data model */
    7468    private RelationMemberTableModel model;
    75     private JosmEditorPane jepMessage;
     69    private HtmlPanel htmlPanel;
    7670    private boolean canceled;
    7771    private SideButton btnOK;
    78 
    79     protected JPanel buildMessagePanel() {
    80         JPanel pnl = new JPanel(new BorderLayout());
    81         jepMessage = new JosmEditorPane("text/html", "");
    82         jepMessage.setOpaque(false);
    83         jepMessage.setEditable(false);
    84         Font f = UIManager.getFont("Label.font");
    85         StyleSheet ss = new StyleSheet();
    86         String rule = MessageFormat.format(
    87                 "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
    88                 f.getName(),
    89                 f.getSize(),
    90                 f.isBold() ? "bold" : "normal",
    91                         f.isItalic() ? "italic" : "normal"
    92         );
    93         rule = "body {" + rule + "}";
    94         rule = MessageFormat.format(
    95                 "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
    96                 f.getName(),
    97                 f.getSize(),
    98                 "bold",
    99                 f.isItalic() ? "italic" : "normal"
    100         );
    101         rule = "strong {" + rule + "}";
    102         ss.addRule(rule);
    103         ss.addRule("a {text-decoration: underline; color: blue}");
    104         HTMLEditorKit kit = new HTMLEditorKit();
    105         kit.setStyleSheet(ss);
    106         jepMessage.setEditorKit(kit);
    107 
    108         pnl.setLayout(new BorderLayout());
    109         pnl.add(jepMessage, BorderLayout.CENTER);
    110         pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    111         return pnl;
    112     }
    11372
    11473    protected JPanel buildRelationMemberTablePanel() {
     
    13493        model.addTableModelListener(this);
    13594        getContentPane().setLayout(new BorderLayout());
    136         getContentPane().add(buildMessagePanel(), BorderLayout.NORTH);
     95        getContentPane().add(htmlPanel = new HtmlPanel(), BorderLayout.NORTH);
    13796        getContentPane().add(buildRelationMemberTablePanel(), BorderLayout.CENTER);
    13897        getContentPane().add(buildButtonPanel(), BorderLayout.SOUTH);
     
    156115            msg = tr("<html>Please confirm to remove <strong>{0} objects</strong> from <strong>{1} relations</strong>.</html>", numObjectsToDelete,numParentRelations);
    157116        }
    158         jepMessage.setText(msg);
     117        htmlPanel.getEditorPane().setText(msg);
    159118        invalidate();
    160119    }
Note: See TracChangeset for help on using the changeset viewer.