Skip to content

Commit

Permalink
String extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Aug 15, 2024
1 parent 34ac29f commit b6dd21f
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public AnatomicRegionView(AnatomicRegion region, boolean selectSeries) {
}

void jbInit() {
setLayout(new MigLayout("wrap 2", "[right][grow]", "[]10[]10[]20[]"));
setLayout(new MigLayout("wrap 2", "[right][grow]", "[]10[]10[]20[]")); // NON-NLS

setBorder(GuiUtils.getEmptyBorder(10, 15, 10, 15));

Expand Down Expand Up @@ -122,18 +122,18 @@ void jbInit() {
ratioGroup.add(radioButtonSeries);
ratioGroup.add(radioButtonImage);

add(new JLabel("Category" + StringUtil.COLON), "right");
add(comboBox1, "growx");
add(new JLabel("Category" + StringUtil.COLON), "right"); // NON-NLS
add(comboBox1, "growx"); // NON-NLS

add(new JLabel("Region" + StringUtil.COLON), "right");
add(comboBox2, "growx 500");
add(new JLabel("Region" + StringUtil.COLON), "right"); // NON-NLS
add(comboBox2, "growx 500"); // NON-NLS

List<Object> list = Stream.of(AnatomicModifier.values()).collect(Collectors.toList());
modifierGroup.setModel(list, false, false);
modifiersDropdown.setToolTipText("Select modifiers");
add(modifiersDropdown, "cell 1 2, span");
modifiersDropdown.setToolTipText("Select modifiers"); // NON-NLS
add(modifiersDropdown, "cell 1 2, span"); // NON-NLS

add(lblApplyTo, "span, split 3, right, gaptop 20");
add(lblApplyTo, "span, split 3, right, gaptop 20"); // NON-NLS
add(radioButtonSeries);
add(radioButtonImage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,24 @@ public void windowClosing(WindowEvent we) {
}

private JPanel initContent() {
JPanel contentPane = new JPanel(new MigLayout("fill, insets 10", "[grow]", "[][][grow][]"));
JPanel contentPane =
new JPanel(new MigLayout("fill, insets 10", "[grow]", "[][][grow][]")); // NON-NLS

JLabel questionLabel = new JLabel(Messages.getString("AcquirePublishDialog.select_pub"));
questionLabel.setFont(FontItem.DEFAULT_SEMIBOLD.getFont());

contentPane.add(questionLabel, "wrap");
contentPane.add(questionLabel, "wrap"); // NON-NLS
publishTree = new PublishTree();
publishTree.addTreeCheckingListener(
evt -> {
resolutionCombo.setEnabled(!getOversizedSelected(publishTree).isEmpty());
});
contentPane.add(publishTree, "grow, wrap");
contentPane.add(publishTree, "grow, wrap"); // NON-NLS

contentPane.add(
new JLabel(
Messages.getString("AcquirePublishDialog.resolution") + StringUtil.COLON_AND_SPACE),
"split 2, span");
"split 2, span"); // NON-NLS
resolutionCombo = new JComboBox<>(Resolution.values());
Preferences prefs =
BundlePreferences.getDefaultPreferences(AppProperties.getBundleContext(this.getClass()));
Expand All @@ -168,15 +169,15 @@ private JPanel initContent() {
Resolution.getInstance(p.get(P_LAST_RESOLUTION, Resolution.ORIGINAL.name())));
}
resolutionCombo.setEnabled(false);
contentPane.add(resolutionCombo, "wrap");
contentPane.add(resolutionCombo, "wrap"); // NON-NLS

JLabel lblDestination =
new JLabel(
Messages.getString("AcquirePublishDialog.lblDestination.text") + StringUtil.COLON);
AbstractDicomNode.addTooltipToComboList(comboNode);
loadDicomNodes();
contentPane.add(lblDestination, "split 2, span");
contentPane.add(comboNode, " wrap");
contentPane.add(lblDestination, "split 2, span"); // NON-NLS
contentPane.add(comboNode, " wrap"); // NON-NLS

publishButton = new JButton(Messages.getString("AcquirePublishDialog.publish"));
publishButton.addActionListener(e -> publishAction());
Expand All @@ -188,9 +189,9 @@ private JPanel initContent() {
progressBar = new JProgressBar();
progressBar.setStringPainted(true);
progressBar.setVisible(false);
contentPane.add(progressBar, "split 3, span, growx, gaptop 20");
contentPane.add(progressBar, "split 3, span, growx, gaptop 20"); // NON-NLS
contentPane.add(publishButton);
contentPane.add(cancelButton, "wrap");
contentPane.add(cancelButton, "wrap"); // NON-NLS
return contentPane;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ public void popupMenuWillBecomeVisible() {
menuFile.add(exportMenu);

DynamicMenu launcherMenu =
new DynamicMenu("Launcher") {
new DynamicMenu(Messages.getString("launcher")) {

@Override
public void popupMenuWillBecomeVisible() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ open.logging.folder=Open the logging folder

LicencesDialog.title=Plugin licenses
LicencesDialog.no.licence=No license found
launcher=Launcher
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public FileCache(MediaReader reader) {
}

public boolean isLocalFile() {
return reader.getUri().getScheme().startsWith("file");
return reader.getUri().getScheme().startsWith("file"); // NON-NLS
}

public boolean isElementInMemory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static void registerToolBar(Insertable instance, SeriesViewerUI ui) {
List<Toolbar> toolBars = ui.getToolBars();
if (instance instanceof Toolbar bar && !toolBars.contains(instance)) {
toolBars.add(bar);
if (ui.clazz.getPackageName().contains("dicom")) {
if (ui.clazz.getPackageName().contains("dicom")) { // NON-NLS
notifyDicomModel(ObservableEvent.BasicAction.UPDATE_TOOLBARS, ui);
} else {
notifyDefaultDataModel(ObservableEvent.BasicAction.UPDATE_TOOLBARS, ui);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ConfigurationDialog extends JDialog {

public ConfigurationDialog(Window parent, Launcher launcher, Launcher.Type type) {
super(parent, Messages.getString("launcher.type"), ModalityType.APPLICATION_MODAL);
setLayout(new MigLayout("insets 10lp 15lp 10lp 15lp", "[][grow]", "[][]"));
setLayout(new MigLayout("insets 10lp 15lp 10lp 15lp", "[][grow]", "[][]")); // NON-NLS

ButtonGroup group = new ButtonGroup();
group.add(uriRadioButton);
Expand All @@ -49,43 +49,48 @@ public ConfigurationDialog(Window parent, Launcher launcher, Launcher.Type type)
this.launcher = launcher;
initialize(launcher);

add(uriRadioButton, "cell 0 0");
add(appRadioButton, "cell 1 0");
add(uriRadioButton, "cell 0 0"); // NON-NLS
add(appRadioButton, "cell 1 0"); // NON-NLS

cardPanel = new JPanel(new CardLayout());
cardPanel.setBorder(BorderFactory.createTitledBorder(Messages.getString("configuration")));

JPanel uriPanel = new JPanel(new MigLayout("", "[][grow]", "[]")); // NON-NLS
uriPanel.add(new JLabel(Messages.getString("uri") + StringUtil.COLON), "cell 0 0");
uriPanel.add(uriField, "cell 1 0, growx");
uriPanel.add(new JLabel(Messages.getString("uri") + StringUtil.COLON), "cell 0 0"); // NON-NLS
uriPanel.add(uriField, "cell 1 0, growx"); // NON-NLS

JPanel appPanel = new JPanel(new MigLayout("", "[][grow]", "[][][][][]")); // NON-NLS
appPanel.add(new JLabel(Messages.getString("binary.path") + StringUtil.COLON), "cell 0 0");
appPanel.add(binaryPathField, "cell 1 0, growx");
appPanel.add(
new JLabel(Messages.getString("binary.path") + StringUtil.COLON), "cell 0 0"); // NON-NLS
appPanel.add(binaryPathField, "cell 1 0, growx"); // NON-NLS

appPanel.add(new JLabel(Messages.getString("working.dir") + StringUtil.COLON), "cell 0 1");
appPanel.add(workingDirectoryField, "cell 1 1, growx");
appPanel.add(
new JLabel(Messages.getString("working.dir") + StringUtil.COLON), "cell 0 1"); // NON-NLS
appPanel.add(workingDirectoryField, "cell 1 1, growx"); // NON-NLS

appPanel.add(new JLabel(Messages.getString("parameters") + StringUtil.COLON), "cell 0 2");
appPanel.add(new JScrollPane(parametersArea), "cell 1 2, growx");
appPanel.add(
new JLabel(Messages.getString("parameters") + StringUtil.COLON), "cell 0 2"); // NON-NLS
appPanel.add(new JScrollPane(parametersArea), "cell 1 2, growx"); // NON-NLS

appPanel.add(new JLabel(Messages.getString("env.variables") + StringUtil.COLON), "cell 0 3");
appPanel.add(new JScrollPane(environmentVariablesArea), "cell 1 3, growx");
appPanel.add(
new JLabel(Messages.getString("env.variables") + StringUtil.COLON), "cell 0 3"); // NON-NLS
appPanel.add(new JScrollPane(environmentVariablesArea), "cell 1 3, growx"); // NON-NLS

appPanel.add(new JLabel(Messages.getString("compatibility") + StringUtil.COLON), "cell 0 4");
appPanel.add(compatibilityField, "cell 1 4, growx");
appPanel.add(
new JLabel(Messages.getString("compatibility") + StringUtil.COLON), "cell 0 4"); // NON-NLS
appPanel.add(compatibilityField, "cell 1 4, growx"); // NON-NLS

cardPanel.add(uriPanel, uriRadioButton.getText());
cardPanel.add(appPanel, appRadioButton.getText());

add(cardPanel, "cell 0 1 2 1, grow");
add(cardPanel, "cell 0 1 2 1, grow"); // NON-NLS

uriRadioButton.addActionListener(_ -> showCard());
appRadioButton.addActionListener(_ -> showCard());

JButton saveButton = new JButton(Messages.getString("save"));
saveButton.addActionListener(_ -> saveConfiguration());
add(saveButton, "cell 1 3, split 2, align right, gapright 15, gaptop 15");
add(saveButton, "cell 1 3, split 2, align right, gapright 15, gaptop 15"); // NON-NLS
JButton cancelButton = new JButton(Messages.getString("cancel"));
cancelButton.addActionListener(_ -> dispose());
add(cancelButton);
Expand Down Expand Up @@ -151,7 +156,7 @@ private ApplicationConfiguration setApplicationConfiguration(Configuration confi
appConfig.setWorkingDirectory(workingDirectoryField.getText());
appConfig.setParameters(
new ArrayList<>(
Arrays.stream(parametersArea.getText().split("\\n"))
Arrays.stream(parametersArea.getText().split("\\n")) // NON-NLS
.filter(StringUtil::hasText)
.toList()));
appConfig.setEnvironmentVariables(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ public void launch(ImageViewerEventManager<?> eventManager) {
return;
}
boolean isMac = compatibility == Compatibility.MAC;
List<String> command = new ArrayList<>(Arrays.asList(binaryPath.trim().split("\\s+")));
List<String> command =
new ArrayList<>(Arrays.asList(binaryPath.trim().split("\\s+"))); // NON-NLS
if (!isMac && parameters != null && !parameters.isEmpty()) {
for (String param : parameters) {
command.add(resolvePlaceholders(param, eventManager));
Expand Down Expand Up @@ -584,7 +585,7 @@ static void saveLaunchers(Type type) {
Set<SeriesViewerUI> uiSet =
viewerPlugins.stream().map(ViewerPlugin::getSeriesViewerUI).collect(Collectors.toSet());
for (SeriesViewerUI ui : uiSet) {
if (ui.clazz.getPackageName().contains("dicom")) {
if (ui.clazz.getPackageName().contains("dicom")) { // NON-NLS
BundleTools.notifyDicomModel(ObservableEvent.BasicAction.UPDATE_TOOLBARS, ui);
} else {
BundleTools.notifyDefaultDataModel(ObservableEvent.BasicAction.UPDATE_TOOLBARS, ui);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class LauncherDialog extends JDialog {
public LauncherDialog(
Window parent, Launcher.Type type, Launcher launcher, JComboBox<Launcher> nodeComboBox) {
super(parent, type.toString(), ModalityType.APPLICATION_MODAL);
setLayout(new MigLayout("insets 10lp 15lp 10lp 15lp, wrap 2", "[][grow]", "[][][][]"));
setLayout(
new MigLayout("insets 10lp 15lp 10lp 15lp, wrap 2", "[][grow]", "[][][][]")); // NON-NLS
this.type = Objects.requireNonNull(type);
this.nodesComboBox = nodeComboBox;
if (launcher == null) {
Expand All @@ -46,23 +47,23 @@ public LauncherDialog(
buttonCheckBox.setSelected(launcher.isButton());
}

add(new JLabel(Messages.getString("name") + StringUtil.COLON), "align right");
add(nameField, "growx");
add(new JLabel(Messages.getString("name") + StringUtil.COLON), "align right"); // NON-NLS
add(nameField, "growx"); // NON-NLS

add(new JLabel(Messages.getString("icon.path") + StringUtil.COLON), "align right");
add(iconNameField, "growx");
add(new JLabel(Messages.getString("icon.path") + StringUtil.COLON), "align right"); // NON-NLS
add(iconNameField, "growx"); // NON-NLS

add(enableCheckBox, "span, split 3");
add(buttonCheckBox, "growx");
add(enableCheckBox, "span, split 3"); // NON-NLS
add(buttonCheckBox, "growx"); // NON-NLS

JButton configurationButton = new JButton(Messages.getString("configure"));
configurationButton.addActionListener(
_ -> new ConfigurationDialog(LauncherDialog.this, this.launcher, type).setVisible(true));
add(configurationButton, "align right");
add(configurationButton, "align right"); // NON-NLS

JButton saveButton = new JButton(Messages.getString("save"));
saveButton.addActionListener(_ -> saveLauncher());
add(saveButton, "cell 1 4, split 2, align right, gapright 15, gaptop 15");
add(saveButton, "cell 1 4, split 2, align right, gapright 15, gaptop 15"); // NON-NLS
JButton cancelButton = new JButton(Messages.getString("cancel"));
cancelButton.addActionListener(_ -> dispose());
add(cancelButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ private static float parseScaleFactor(String s) {
if (s == null) return -1;

float units = 1;
if (s.endsWith("x")) s = s.substring(0, s.length() - 1);
else if (s.endsWith("dpi")) {
if (s.endsWith("x")) s = s.substring(0, s.length() - 1); // NON-NLS
else if (s.endsWith("dpi")) { // NON-NLS
units = 96;
s = s.substring(0, s.length() - 3);
} else if (s.endsWith("%")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static String buildScreenItem(Monitor monitor) {
Rectangle b = monitor.getBounds();
buf.append(".");
buf.append(b.width);
buf.append("x");
buf.append("x"); // NON-NLS
buf.append(b.height);
buf.append(".pitch");
return buf.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static String getCode(String name) {

public static int readSource(String name, final StringBuilder result, int lineno)
throws IOException {
InputStream stream = ShaderManager.class.getResourceAsStream("/shader/" + name);
InputStream stream = ShaderManager.class.getResourceAsStream("/shader/" + name); // NON-NLS
if (stream == null) {
throw new IllegalStateException("Cannot load " + name);
}
Expand All @@ -54,7 +54,7 @@ public static int readSource(String name, final StringBuilder result, int lineno
String line;
while ((line = reader.readLine()) != null) {
lineno++;
if (line.startsWith("#include ")) {
if (line.startsWith("#include ")) { // NON-NLS
String file = line.substring(9).trim();
if (file.startsWith("\"") && file.endsWith("\"")) {
file = file.substring(1, file.length() - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ List<StudyPane> getStudyPaneList() {
private void refreshLayout() {
this.setLayout(
verticalLayout
? new MigLayout("fillx, flowy, insets 0", "[fill]")
: new MigLayout("fillx, flowx, insets 0", "[fill]"));
? new MigLayout("fillx, flowy, insets 0", "[fill]") // NON-NLS
: new MigLayout("fillx, flowx, insets 0", "[fill]")); // NON-NLS
List<StudyPane> studies = getStudyPaneList();
super.removeAll();
for (StudyPane studyPane : studies) {
Expand Down Expand Up @@ -714,7 +714,7 @@ public StudyPane(MediaSeriesGroup dicomStudy) {
this.setBorder(
BorderFactory.createCompoundBorder(GuiUtils.getEmptyBorder(0, 3, 0, 3), title));
this.setFocusable(false);
this.add(sub, "shrinky 100");
this.add(sub, "shrinky 100"); // NON-NLS
this.addComponentListener(
new ComponentAdapter() {
@Override
Expand Down Expand Up @@ -805,7 +805,7 @@ class SeriesPane extends JPanel {

public SeriesPane(MediaSeriesGroup sequence) {
this.sequence = Objects.requireNonNull(sequence);
this.setLayout(new MigLayout("wrap 1", "[center]"));
this.setLayout(new MigLayout("wrap 1", "[center]")); // NON-NLS
this.setBackground(FlatUIUtils.getUIColor(SeriesSelectionModel.BACKGROUND, Color.LIGHT_GRAY));
int thumbnailSize =
GuiUtils.getUICore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,12 @@ private void writeItems(DicomData dicomData, TagReadable group, StyledDocument d
Object val = TagUtil.getTagValue(tag, group, currentMedia);
if (val != null) {
exist = true;
doc.insertString(doc.getLength(), tag.getDisplayedName(), doc.getStyle("normal"));
doc.insertString(
doc.getLength(), tag.getDisplayedName(), doc.getStyle("normal")); // NON-NLS
doc.insertString(
doc.getLength(),
StringUtil.COLON_AND_SPACE + tag.getFormattedTagValue(val, null) + "\n",
doc.getStyle("bold"));
doc.getStyle("bold")); // NON-NLS
break;
}
} catch (BadLocationException e) {
Expand All @@ -408,7 +409,7 @@ private void writeItems(DicomData dicomData, TagReadable group, StyledDocument d
try {
String formatTitle =
insertTitle < 3 ? dicomData.title + "\n" : "\n" + dicomData.title + "\n";
doc.insertString(insertTitle, formatTitle, doc.getStyle("h3"));
doc.insertString(insertTitle, formatTitle, doc.getStyle("h3")); // NON-NLS
} catch (BadLocationException e) {
LOGGER.error("Writing text issue", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ private void dicomQuery() {
});
}
};
process = new QueryProcess(runnable, "DICOM C-FIND", running);
process = new QueryProcess(runnable, "DICOM C-FIND", running); // NON-NLS
process.start();
} else if (selectedItem instanceof final DicomWebNode node) {
AuthMethod auth = AuthenticationPersistence.getAuthMethod(node.getAuthMethodUid());
Expand Down Expand Up @@ -806,7 +806,7 @@ private void dicomQuery() {
LOGGER.error("", e);
}
};
process = new QueryProcess(runnable, "QIDO-RS", running);
process = new QueryProcess(runnable, "QIDO-RS", running); // NON-NLS
process.start();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.formdev.flatlaf.IntelliJTheme.ThemeLaf;
import com.formdev.flatlaf.util.LoggingFacade;
import java.io.IOException;
import java.util.Objects;

public class FlatWeasisTheme extends ThemeLaf {
public static boolean setup() {
Expand All @@ -31,7 +32,8 @@ public String getName() {
static IntelliJTheme loadTheme(String name) {
try {
return new IntelliJTheme(
FlatWeasisTheme.class.getResourceAsStream("/org/weasis/theme/" + name));
Objects.requireNonNull(
FlatWeasisTheme.class.getResourceAsStream("/org/weasis/theme/" + name))); // NON-NLS
} catch (IOException var3) {
String msg = "FlatLaf: Failed to load Weasis theme"; // NON-NLS
LoggingFacade.INSTANCE.logSevere(msg, var3);
Expand Down
Loading

0 comments on commit b6dd21f

Please sign in to comment.