Skip to content

Commit

Permalink
Merge pull request #78 from paginagmbh/development
Browse files Browse the repository at this point in the history
Merge development into master / integrate accessibility features
  • Loading branch information
br-pagina authored Nov 22, 2022
2 parents d61ab2f + 1468ae6 commit 75c51aa
Show file tree
Hide file tree
Showing 8 changed files with 619 additions and 227 deletions.
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>de.paginagmbh</groupId>
<artifactId>EPUB-Checker</artifactId>
<version>2.0.6</version>
<version>2.0.7-SNAPSHOT</version>

<packaging>jar</packaging>

Expand Down Expand Up @@ -36,6 +36,12 @@
<email>kai.weber@pagina.gmbh</email>
<organization>pagina GmbH</organization>
</developer>
<developer>
<name>Dr. Björn Rudzewitz</name>
<id>br-pagina</id>
<email>bjoern.rudzewitz@pagina.gmbh</email>
<organization>pagina GmbH</organization>
</developer>
</developers>
<scm>
<url>https://github.com/paginagmbh/EPUB-Checker</url>
Expand Down
33 changes: 32 additions & 1 deletion src/main/java/de/paginagmbh/common/gui/StatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import de.paginagmbh.epubchecker.GuiManager;

/**
* generates a status bar at the bottom of a border
*
Expand All @@ -36,10 +39,19 @@ public StatusBar(Icon icon, String text, Boolean draggableCorner) {
setLayout(new BorderLayout());
// set dimensions - only the height ("22") is important
setPreferredSize(new Dimension(10, 22));


// set focusable so that it can be accessed via screen readers
setFocusable(true);
// add name for screen readers
getAccessibleContext().setAccessibleName(__("Status bar"));

// create text label
lbl_text = new JLabel(text);
// if the label is empty, make it explicit in the parent widget for screen readers
if(text == null || text.trim().equals("")) {
getAccessibleContext().setAccessibleDescription(__("empty"));
}

lbl_text.setFont(lbl_text.getFont().deriveFont(lbl_text.getFont().getSize() - 2f));
// border as padding
lbl_text.setBorder(BorderFactory.createEmptyBorder(3,10,0,10));
Expand Down Expand Up @@ -68,6 +80,13 @@ public StatusBar(Icon icon, String text, Boolean draggableCorner) {
public void update(Icon icon, String text) {
lbl_text.setIcon(icon);
lbl_text.setText(text);

// update accessible description for screen readers
if(text == null || text.trim().equals("")) {
getAccessibleContext().setAccessibleDescription(__("empty"));
}else {
getAccessibleContext().setAccessibleDescription(text);
}
}


Expand All @@ -78,6 +97,8 @@ public void update(Icon icon, String text) {
public void reset() {
lbl_text.setIcon(null);
lbl_text.setText(null);
// update accessible description for screen readers
getAccessibleContext().setAccessibleDescription(__("empty"));
}


Expand Down Expand Up @@ -109,7 +130,16 @@ protected void paintComponent(Graphics g) {
g.drawLine(0, y, getWidth(), y);

}

public JLabel getTextLabel() {
return lbl_text;
}

/* ********************************************************************************************************** */

private String __(String s) {
return GuiManager.getInstance().getCurrentLocalizationObject().getString(s);
}
}


Expand Down Expand Up @@ -151,4 +181,5 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
g.drawLine(10, 12, 12, 10);

}

}
3 changes: 3 additions & 0 deletions src/main/java/de/paginagmbh/epubchecker/EpubValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ private void runValidation() {
// disable validation button && "save" menuItem
gui.disableButtonsDuringValidation();

// focus the status bar so that when using a screen reader it is clear what is going on
gui.focusStatusBar();

// set the loading icon and update the statusbar
gui.getStatusBar().update(FileManager.iconLoading, __("Checking file"));

Expand Down
Loading

0 comments on commit 75c51aa

Please sign in to comment.