Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;

/**
Expand Down Expand Up @@ -356,6 +357,10 @@ public LocalDateTime asLocalDateTime() {
return LocalDateTime.of(y, m, d, h, min, sec);
}

public long toEpochSecond() {
return asLocalDateTime().atZone(ZoneId.systemDefault()).toEpochSecond();
}

/**
* Utility mehtod for parsing Adobe standard date format,
* (D:YYYYMMDDHHmmSSOHH'mm').
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5086,7 +5086,7 @@ public void actionPerformed(ActionEvent event) {
"viewer.dialog.error.exception.msg",
message);
SwingUtilities.invokeLater(doSwingWork);
logger.log(Level.FINE, "Error processing action event.", e);
logger.log(Level.SEVERE, "Error processing action event.", e);
}

if (!cancelSetFocus) {
Expand Down Expand Up @@ -5760,7 +5760,7 @@ public void propertyChange(PropertyChangeEvent evt) {
}
if (annotationSummaryFrame != null &&
annotationSummaryFrame.getAnnotationSummaryPanel() != null) {
annotationSummaryFrame.getAnnotationSummaryPanel().refreshDocumentInstance();
annotationSummaryFrame.refreshDocumentInstance();
}
break;
case PropertyConstants.DESTINATION_ADDED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,9 @@ private void checkGroupLabelChange(MarkupAnnotationPanel.SortColumn sortColumn,
}

private String findColor(Color color) {
if (colorLabels != null) {
for (DragDropColorList.ColorLabel colorLabel : colorLabels) {
if (color.equals(colorLabel.getColor())) {
return colorLabel.getLabel();
}
for (DragDropColorList.ColorLabel colorLabel : colorLabels) {
if (color.equals(colorLabel.getColor())) {
return colorLabel.getLabel();
}
}
// see if we can't return a hex color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,10 @@ protected void applyAnnotationStatusLabel(Annotation annotation) {

ArrayList<DragDropColorList.ColorLabel> colorLabels = DragDropColorList.retrieveColorLabels();
String colorLabelString = null;
if (colorLabels != null) {
for (DragDropColorList.ColorLabel colorLabel : colorLabels) {
if (annotation.getColor() != null && colorLabel.getColor().equals(annotation.getColor())) {
colorLabelString = colorLabel.getLabel();
break;
}
for (DragDropColorList.ColorLabel colorLabel : colorLabels) {
if (annotation.getColor() != null && colorLabel.getColor().equals(annotation.getColor())) {
colorLabelString = colorLabel.getLabel();
break;
}
}
StringBuilder statusLabel = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.awt.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.InputStream;
import java.net.URL;
import java.util.ResourceBundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
import org.icepdf.core.SecurityCallback;
import org.icepdf.core.pobjects.Destination;
import org.icepdf.core.pobjects.Document;
import org.icepdf.ri.common.views.annotations.AbstractAnnotationComponent;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyListener;
import java.beans.PropertyChangeSupport;
import java.util.Collection;
import java.util.Set;


/**
Expand Down Expand Up @@ -234,5 +233,10 @@ public interface DocumentViewController {

void firePropertyChange(String event, Object oldValue, Object newValue);

/**
* @return The property change support for this controller
*/
PropertyChangeSupport getPropertyChangeSupport();

void deleteAnnotations(Collection<AnnotationComponent> annotations);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,11 @@ public void firePropertyChange(String event, Object oldValue,
changes.firePropertyChange(event, oldValue, newValue);
}

@Override
public PropertyChangeSupport getPropertyChangeSupport() {
return changes;
}

public void addPropertyChangeListener(PropertyChangeListener l) {
changes.addPropertyChangeListener(l);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public class PopupAnnotationComponent extends AbstractAnnotationComponent<PopupA
public static final int DEFAULT_WIDTH = 215;
public static final int DEFAULT_HEIGHT = 150;
public static final Color backgroundColor = new Color(252, 253, 227);

public static final Dimension BUTTON_SIZE = new Dimension(22, 22);

// layouts constraint
Expand Down Expand Up @@ -264,11 +265,6 @@ public void setBounds(int x, int y, int width, int height) {
super.setBounds(x, y, width, height);
}

@Override
public void setBounds(Rectangle r) {
setBounds(r.x, r.y, r.width, r.height);
}

@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Expand Down Expand Up @@ -370,7 +366,7 @@ private void buildGUI() {
String contents = selectedMarkupAnnotation != null ?
selectedMarkupAnnotation.getContents() : "";
textArea = new JTextArea(contents != null ? contents : "");
textArea.setFont(new JLabel().getFont());
textArea.setFont(new JLabel().getFont().deriveFont(annotation.getTextAreaFontsize()));
textArea.setWrapStyleWord(true);
textArea.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(PopupAnnotation.BORDER_COLOR),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
Expand All @@ -383,20 +379,23 @@ private void buildGUI() {

// creation date
creationLabel = new JLabel();
creationLabel.setFont(new JLabel().getFont().deriveFont(annotation.getHeaderLabelsFontSize()));
refreshCreationLabel();
// title, user name.
String title = selectedMarkupAnnotation != null ?
selectedMarkupAnnotation.getFormattedTitleText() : "";
titleLabel = new JLabel(title);

// Setup color appearance values.
resetComponentColors();
titleLabel.setFont(new JLabel().getFont().deriveFont(annotation.getHeaderLabelsFontSize()));

// main layout panel
GridBagLayout layout = new GridBagLayout();
commentPanel = new JPanel(layout);
commentPanel.setBackground(popupBackgroundColor);
this.setLayout(new GridBagLayout());

// Setup color appearance values.
resetComponentColors();

/*
* Build search GUI
*/
Expand Down Expand Up @@ -1246,6 +1245,14 @@ public void setFontSize(float size) {
setHeaderLabelsFontSize(size);
}

public void setFontFamily(String family) {
final Font curFont = textArea.getFont();
final Font newFont = new Font(family, curFont.getStyle(), curFont.getSize());
textArea.setFont(newFont);
titleLabel.setFont(newFont);
creationLabel.setFont(newFont);
}

public int getTextAreaFontSize() {
return textArea.getFont().getSize();
}
Expand Down
Loading