generated from runelite/example-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dismiss screen marker notification
- Loading branch information
1 parent
dcd910e
commit f5f7bcf
Showing
9 changed files
with
144 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/adamk33n3r/runelite/watchdog/notifications/DismissScreenMarker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.adamk33n3r.runelite.watchdog.notifications; | ||
|
||
import com.adamk33n3r.runelite.watchdog.WatchdogPlugin; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.experimental.Accessors; | ||
|
||
@Getter @Setter | ||
@Accessors(chain = true) | ||
public class DismissScreenMarker extends Notification { | ||
private String dismissId; | ||
|
||
@Override | ||
protected void fireImpl(String[] triggerValues) { | ||
WatchdogPlugin.getInstance().getScreenMarkerUtil().removeScreenMarkerById(this.dismissId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...33n3r/runelite/watchdog/ui/notifications/panels/DismissScreenMarkerNotificationPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.adamk33n3r.runelite.watchdog.ui.notifications.panels; | ||
|
||
import com.adamk33n3r.runelite.watchdog.LengthLimitFilter; | ||
import com.adamk33n3r.runelite.watchdog.SimpleDocumentListener; | ||
import com.adamk33n3r.runelite.watchdog.notifications.DismissScreenMarker; | ||
import com.adamk33n3r.runelite.watchdog.ui.FlatTextArea; | ||
import com.adamk33n3r.runelite.watchdog.ui.panels.NotificationsPanel; | ||
import com.adamk33n3r.runelite.watchdog.ui.panels.PanelUtils; | ||
|
||
import javax.swing.text.AbstractDocument; | ||
import java.awt.event.FocusEvent; | ||
import java.awt.event.FocusListener; | ||
|
||
public class DismissScreenMarkerNotificationPanel extends NotificationPanel { | ||
public DismissScreenMarkerNotificationPanel(DismissScreenMarker notification, NotificationsPanel parentPanel, Runnable onChangeListener, PanelUtils.OnRemove onRemove) { | ||
super(notification, parentPanel, onChangeListener, onRemove); | ||
|
||
FlatTextArea flatTextArea = new FlatTextArea("Enter the ID of the screen marker...", true); | ||
flatTextArea.setText(notification.getDismissId()); | ||
((AbstractDocument) flatTextArea.getDocument()).setDocumentFilter(new LengthLimitFilter(200)); | ||
flatTextArea.getDocument().addDocumentListener((SimpleDocumentListener) ev -> { | ||
notification.setDismissId(flatTextArea.getText()); | ||
}); | ||
flatTextArea.getTextArea().addFocusListener(new FocusListener() { | ||
@Override | ||
public void focusGained(FocusEvent e) { | ||
flatTextArea.getTextArea().selectAll(); | ||
} | ||
|
||
@Override | ||
public void focusLost(FocusEvent e) { | ||
onChangeListener.run(); | ||
} | ||
}); | ||
this.settings.add(flatTextArea); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters