-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Strandkrabbe
committed
Dec 27, 2019
1 parent
a91f22b
commit 818c30f
Showing
13 changed files
with
572 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre11"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre11"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry combineaccessrules="false" kind="src" path="/LibSWA"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,54 @@ | ||
package strandkrabbe.ts3.viewer.ui; | ||
|
||
import java.awt.Color; | ||
import java.awt.Graphics; | ||
import java.awt.Toolkit; | ||
import java.awt.datatransfer.Clipboard; | ||
import java.awt.datatransfer.StringSelection; | ||
import java.awt.image.BufferedImage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import javax.imageio.ImageIO; | ||
|
||
public class CopyUIDAction implements EntryButtonAction { | ||
|
||
private final UI ui; | ||
private BufferedImage icon; | ||
|
||
public CopyUIDAction(UI u) { | ||
this.ui = u; | ||
try { | ||
InputStream ii = this.getClass().getResourceAsStream("/strandkrabbe/ts3/viewer/res/copy.png"); | ||
if (ii == null) | ||
throw new IOException(); | ||
this.icon = ImageIO.read(ii); | ||
} catch (IOException ex) { | ||
this.icon = new BufferedImage(64, 64, BufferedImage.TYPE_INT_RGB); | ||
Graphics g = this.icon.createGraphics(); | ||
g.setColor(new Color(10,250,250)); | ||
g.fillRect(0, 0, 64, 64); | ||
g.dispose(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onClick(String value) { | ||
int sepindex = value.indexOf(UI.UID_SEPERATOR); | ||
if (sepindex >= 0) { | ||
String uid = value.substring(0, sepindex).strip(); | ||
StringSelection sel = new StringSelection(uid); | ||
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); | ||
c.setContents(sel, null); | ||
this.ui.setMessage("Copied UID"); | ||
} | ||
} | ||
|
||
@Override | ||
public BufferedImage getIcon() { | ||
return this.icon; | ||
} | ||
|
||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package strandkrabbe.ts3.viewer.ui; | ||
|
||
import java.awt.image.BufferedImage; | ||
|
||
public interface EntryButtonAction { | ||
|
||
public void onClick(String value); | ||
public BufferedImage getIcon(); | ||
|
||
} |
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,52 @@ | ||
package strandkrabbe.ts3.viewer.ui; | ||
|
||
import java.awt.Color; | ||
import java.awt.Graphics; | ||
import java.awt.image.BufferedImage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import javax.imageio.ImageIO; | ||
|
||
import strandkrabbe.ts3.viewer.UserDB; | ||
|
||
public class ItemDeleteAction implements EntryButtonAction { | ||
|
||
private final UserDB db; | ||
private final UI ui; | ||
private BufferedImage icon; | ||
|
||
public ItemDeleteAction(UI u,UserDB db) { | ||
this.ui = u; | ||
this.db = db; | ||
try { | ||
InputStream ii = this.getClass().getResourceAsStream("/strandkrabbe/ts3/viewer/res/del.png"); | ||
if (ii == null) | ||
throw new IOException(); | ||
this.icon = ImageIO.read(ii); | ||
} catch (IOException ex) { | ||
this.icon = new BufferedImage(64, 64, BufferedImage.TYPE_INT_RGB); | ||
Graphics g = this.icon.createGraphics(); | ||
g.setColor(new Color(250,10,10)); | ||
g.fillRect(0, 0, 64, 64); | ||
g.dispose(); | ||
} | ||
} | ||
|
||
@Override | ||
public BufferedImage getIcon() { | ||
return this.icon; | ||
} | ||
@Override | ||
public void onClick(String value) { | ||
int sep = value.indexOf(UI.UID_SEPERATOR); | ||
if (sep >= 0) { | ||
String uid = value.substring(0, sep).strip(); | ||
if (uid.length() == 28 && uid.endsWith("=")) { | ||
db.remove(uid); | ||
ui.setMessage("Removed " + uid); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.