Ignore:
Timestamp:
2018-07-04T06:15:49+02:00 (6 years ago)
Author:
renerr18
Message:

Merged ImageInfoPanel - removed unintentionally checked-in 'placeholders'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java

    r34390 r34394  
    55import java.awt.GridBagConstraints;
    66import java.awt.GridBagLayout;
     7import java.awt.Image;
    78import java.awt.Insets;
    89import java.awt.datatransfer.StringSelection;
     
    1112
    1213import javax.swing.ImageIcon;
     14import javax.swing.JCheckBox;
    1315import javax.swing.JLabel;
    1416import javax.swing.JPanel;
     
    1820import org.openstreetmap.josm.data.osm.DataSelectionListener;
    1921import org.openstreetmap.josm.data.osm.OsmPrimitive;
     22import org.openstreetmap.josm.data.osm.Tag;
    2023import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    2124import org.openstreetmap.josm.data.preferences.AbstractProperty.ValueChangeListener;
     
    2629import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.SelectableLabel;
    2730import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton;
     31import org.openstreetmap.josm.plugins.streetside.model.UserProfile;
    2832import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    2933import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL;
     
    3943
    4044  private final JLabel numDetectionsLabel;
    41   //private final JCheckBox showDetectionsCheck;
    42   private final JLabel placeholder1Label;
     45  private final JCheckBox showDetectionsCheck;
    4346  private final JLabel usernameLabel;
    4447  private final JTextPane imgKeyValue;
    4548  private final WebLinkAction imgLinkAction;
    4649  private final ClipboardAction copyImgKeyAction;
    47   //private final AddTagToPrimitiveAction addStreetsideTagAction;
     50  private final AddTagToPrimitiveAction addStreetsideTagAction;
    4851  private final JTextPane seqKeyValue;
    4952
     
    6366    numDetectionsLabel.setFont(numDetectionsLabel.getFont().deriveFont(Font.PLAIN));
    6467
    65     placeholder1Label = new JLabel();
    66 
    67     //showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image"));
    68     //showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get());
    69     /*showDetectionsCheck.addActionListener(
     68    showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image"));
     69     showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get());
     70     showDetectionsCheck.addActionListener(
    7071      action -> StreetsideProperties.SHOW_DETECTED_SIGNS.put(showDetectionsCheck.isSelected())
    7172    );
    7273    StreetsideProperties.SHOW_DETECTED_SIGNS.addListener(
    7374      valueChange -> showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get())
    74     );*/
     75    );
    7576
    7677    usernameLabel = new JLabel();
     
    8586    copyImgKeyAction.setPopupParent(copyButton);
    8687
    87     //addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag"));
     88    addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag"));
    8889
    8990    JPanel imgKey = new JPanel();
     
    9293    JPanel imgButtons = new JPanel();
    9394    imgButtons.add(new StreetsideButton(imgLinkAction, true));
    94     //imgButtons.add(new StreetsideButton(addStreetsideTagAction, true));
     95    imgButtons.add(new StreetsideButton(null/*addStreetsideTagAction*/, true));
    9596    seqKeyValue = new SelectableLabel();
    9697
     
    105106    gbc.gridwidth = 1;
    106107    gbc.gridheight = 2;
    107     root.add(new JLabel(("Placeholder2 label")), gbc);
     108    root.add(new JLabel(I18n.tr("Image detections")), gbc);
    108109    gbc.gridy += 2;
    109110    gbc.gridheight = 1;
    110     root.add(new JLabel(("Blah")), gbc);
    111     gbc.gridy++;
    112     root.add(new JLabel(("Blee")), gbc);
     111    root.add(new JLabel(I18n.tr("User")), gbc);
     112    gbc.gridy++;
     113    root.add(new JLabel(I18n.tr("Image actions")), gbc);
    113114    gbc.gridy++;
    114115    root.add(new JLabel(I18n.tr("Image key")), gbc);
     
    123124    root.add(numDetectionsLabel, gbc);
    124125    gbc.gridy++;
    125     //root.add(showDetectionsCheck, gbc);
    126     //gbc.gridy++;
    127     root.add(placeholder1Label, gbc);
    128      gbc.gridy++;
     126    root.add(showDetectionsCheck, gbc);
     127    gbc.gridy++;
    129128    root.add(usernameLabel, gbc);
    130129    gbc.gridy++;
     
    185184    ));
    186185
    187     //numDetectionsLabel.setText(I18n.tr("{0} detections", newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getDetections().size() : 0));
     186    numDetectionsLabel.setText(I18n.tr("{0} detections", newImage instanceof StreetsideImage ? /*((StreetsideImage) newImage).getDetections().size()*/0 : 0));
    188187    imgKeyValue.setEnabled(newImage instanceof StreetsideImage);
    189188    final String newImageKey = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getId(): null;
     
    199198      imgKeyValue.setText(newImageKey);
    200199      copyImgKeyAction.setContents(new StringSelection(newImageKey));
    201       //addStreetsideTagAction.setTag(new Tag("streetside", newImageKey));
     200      addStreetsideTagAction.setTag(new Tag("streetside", newImageKey));
    202201    } else {
    203202      if (imageLinkChangeListener != null) {
     
    209208      imgKeyValue.setText('‹' + I18n.tr("image has no key") + '›');
    210209      copyImgKeyAction.setContents(null);
    211       //addStreetsideTagAction.setTag(null);
    212     }
    213 
    214     /*final UserProfile user = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getUser() : null;
     210      addStreetsideTagAction.setTag(null);
     211    }
     212
     213    final UserProfile user = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getUser() : null;
    215214    usernameLabel.setEnabled(user != null);
    216215    if (user != null) {
     
    220219      usernameLabel.setText("‹" + I18n.tr("unknown user") + "›");
    221220      usernameLabel.setIcon(EMPTY_USER_AVATAR);
    222     }*/
     221    }
    223222
    224223    final boolean partOfSequence = newImage != null && newImage.getSequence() != null && newImage.getSequence().getId() != null;
     
    240239      logger.debug(String.format("Selection changed. %d primitives are selected.", sel == null ? 0 : sel.size()));
    241240    }
    242     //addStreetsideTagAction.setTarget(sel != null && sel.size() == 1 ? sel.iterator().next() : null);
     241    addStreetsideTagAction.setTarget(sel != null && sel.size() == 1 ? sel.iterator().next() : null);
    243242  }
    244243}
Note: See TracChangeset for help on using the changeset viewer.