Skip to content

Commit

Permalink
Merge pull request #22 from jpage4500/feature/10-18
Browse files Browse the repository at this point in the history
- search env variables
  • Loading branch information
jpage4500 authored Oct 20, 2024
2 parents e688f75 + 6f0e53c commit 1641c3c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/jdeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
run: mvn -B package --file pom.xml

# deploy to github
- name: Build App Installer Bundles
uses: shannah/jdeploy@master
with:
github_token: ${{ github.token }}
# - name: Build App Installer Bundles
# uses: shannah/jdeploy@master
# with:
# github_token: ${{ github.token }}

# deploy to npm:
# - get app version
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/com/jpage4500/devicemanager/ui/DeviceScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -1383,11 +1383,25 @@ public void mouseClicked(MouseEvent evt) {
}
}
});

HintTextField filter = new HintTextField("Filter", text -> {
listModel.clear();
for (Map.Entry<String, String> entry : sortedEnvMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (TextUtils.isEmpty(text) || TextUtils.containsAny(key, true, text) ||
TextUtils.containsAny(value, true, text)) {
listModel.addElement(key + " : " + value);
}
}
});
panel.add(filter, "width 25%, wrap");
filter.addAncestorListener(new RequestFocusListener());

JScrollPane scroll = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
int w = (Utils.getScreenWidth() / 2);
panel.add(scroll, "width " + w + "px");
panel.add(scroll, "width " + (Utils.getScreenWidth() / 2) + "px");

JOptionPane.showOptionDialog(this, panel, "Device Info", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
JOptionPane.showOptionDialog(this, panel, "Environment Variables", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
}

private void handleVersionClicked(MouseEvent e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ public void keyTyped(KeyEvent e) {
public void keyPressed(KeyEvent e) {
super.keyPressed(e);
switch (e.getExtendedKeyCode()) {
case KeyEvent.VK_ESCAPE -> setText(null);
case KeyEvent.VK_ESCAPE -> {
setText(null);
e.consume();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.jpage4500.devicemanager.utils;

import javax.swing.*;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;

public class RequestFocusListener implements AncestorListener {
public void ancestorAdded(final AncestorEvent e) {
final AncestorListener al = this;
SwingUtilities.invokeLater(new Runnable() {

@Override
public void run() {
JComponent component = (JComponent) e.getComponent();
component.requestFocusInWindow();
component.removeAncestorListener(al);
}
});
}

public void ancestorMoved(AncestorEvent e) {
}

public void ancestorRemoved(AncestorEvent e) {
}
}

0 comments on commit 1641c3c

Please sign in to comment.