Ignore:
Timestamp:
2009-10-04T12:07:16+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3650: Double-click on items in history dialog should open history
fixed #3649: History dialog does not show moved nodes
fixed #3383: changeset tags in history dialog (partial fix, there's now a link to the server page for browsing changesets)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r2242 r2243  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.BorderLayout;
    7 import java.awt.event.ActionEvent;
    8 import java.awt.event.MouseEvent;
     6import java.awt.FlowLayout;
     7import java.awt.GridBagConstraints;
     8import java.awt.GridBagLayout;
    99import java.text.SimpleDateFormat;
    1010import java.util.Observable;
     
    1616import org.openstreetmap.josm.actions.AbstractInfoAction;
    1717import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive;
    18 import org.openstreetmap.josm.tools.ImageProvider;
     18import org.openstreetmap.josm.tools.UrlLabel;
    1919
    2020/**
    2121 * VersionInfoPanel is an UI component which displays the basic properties of a version
    2222 * of a {@see OsmPrimitive}.
    23  *
     23 * 
    2424 */
    2525public class VersionInfoPanel extends JPanel implements Observer{
     
    2828    private HistoryBrowserModel model;
    2929    private JLabel lblInfo;
     30    private UrlLabel lblUser;
     31    private UrlLabel lblChangeset;
    3032
    3133    protected void build() {
    32         setLayout(new BorderLayout());
     34        JPanel pnl1 = new JPanel();
     35        pnl1.setLayout(new FlowLayout(FlowLayout.LEFT));
    3336        lblInfo = new JLabel();
    3437        lblInfo.setHorizontalAlignment(JLabel.LEFT);
    35         add(lblInfo, BorderLayout.CENTER);
     38        pnl1.add(lblInfo);
     39
     40        JPanel pnl2 = new JPanel();
     41        pnl2.setLayout(new FlowLayout(FlowLayout.LEFT));
     42        lblUser = new UrlLabel();
     43        pnl2.add(new JLabel(tr("User")));
     44        pnl2.add(lblUser);
     45        pnl2.add(new JLabel(tr("Changeset")));
     46        lblChangeset = new UrlLabel();
     47        pnl2.add(lblChangeset);
     48
     49        setLayout(new GridBagLayout());
     50        GridBagConstraints gc = new GridBagConstraints();
     51        gc.anchor = GridBagConstraints.NORTHWEST;
     52        gc.fill = GridBagConstraints.HORIZONTAL;
     53        gc.weightx = 1.0;
     54        gc.weighty = 0.0;
     55        add(pnl1, gc);
     56        gc.gridy = 1;
     57        add(pnl2, gc);
    3658    }
    3759
     
    4668        if (primitive == null)
    4769            return "";
    48         String url = AbstractInfoAction.getBaseBrowseUrl() + "/changeset/" + primitive.getChangesetId();
    4970        String text = tr(
    50                 "<html>Version <strong>{0}</strong> created on <strong>{1}</strong> by <strong>{2}</strong> in changeset <strong>{3}</strong></html>",
     71                "<html>Version <strong>{0}</strong> created on <strong>{1}</strong>",
    5172                Long.toString(primitive.getVersion()),
    52                 new SimpleDateFormat().format(primitive.getTimestamp()),
    53                 primitive.getUser().replace("<", "&lt;").replace(">", "&gt;"),
    54                 primitive.getChangesetId()
     73                new SimpleDateFormat().format(primitive.getTimestamp())
    5574        );
    5675        return text;
     
    6584    /**
    6685     * constructor
    67      *
     86     * 
    6887     * @param model  the model (must not be null)
    6988     * @param pointInTimeType the point in time this panel visualizes (must not be null)
     
    86105    public void update(Observable o, Object arg) {
    87106        lblInfo.setText(getInfoText());
     107
     108        String url = AbstractInfoAction.getBaseBrowseUrl() + "/changeset/" + getPrimitive().getChangesetId();
     109        lblChangeset.setUrl(url);
     110        lblChangeset.setDescription(tr("{0}", getPrimitive().getChangesetId()));
     111
     112        url = AbstractInfoAction.getBaseUserUrl() + "/" + getPrimitive().getUser();
     113        lblUser.setUrl(url);
     114        lblUser.setDescription(tr("{0}", getPrimitive().getUser()));
    88115    }
    89116}
Note: See TracChangeset for help on using the changeset viewer.