Skip to content
This repository has been archived by the owner on Oct 14, 2018. It is now read-only.

Commit

Permalink
Added custom action button.
Browse files Browse the repository at this point in the history
  • Loading branch information
dteoh committed Nov 16, 2010
1 parent 708a7a4 commit efdc907
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/main/java/com/dteoh/heartrate/HRDataViewer.java
Expand Up @@ -12,13 +12,17 @@
import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;

import org.openshapa.models.db.Datastore;
import org.openshapa.models.id.Identifier;

import org.openshapa.plugins.CustomActions;
import org.openshapa.plugins.CustomActionsAdapter;
import org.openshapa.plugins.DataViewer;
import org.openshapa.plugins.ViewerStateListener;

Expand Down Expand Up @@ -58,6 +62,16 @@ public class HRDataViewer implements DataViewer {
/** Data viewer state listeners. */
private List<ViewerStateListener> stateListeners;

/** Action button for demo purposes. */
private JButton sampleButton;

/** Supported custom actions. */
private CustomActions actions = new CustomActionsAdapter() {
@Override public AbstractButton getActionButton1() {
return sampleButton;
}
};

public HRDataViewer(final Frame parent, final boolean modal) {
Runnable edtTask = new Runnable() {
@Override public void run() {
Expand All @@ -73,6 +87,12 @@ public HRDataViewer(final Frame parent, final boolean modal) {
c.add(hrPanel, BorderLayout.CENTER);

hrDialog.setVisible(true);

sampleButton = new JButton();
sampleButton.setIcon(new ImageIcon(
HRDataViewer.class.getResource("heart.png")));
sampleButton.setBorderPainted(false);
sampleButton.setContentAreaFilled(false);
}
};

Expand Down Expand Up @@ -232,17 +252,14 @@ public HRDataViewer(final Frame parent, final boolean modal) {
}
}

@Override public void clearDataFeed() {
// TODO Auto-generated method stub
}

@Override public CustomActions getCustomActions() {
return actions;
}

@Override public void clearDataFeed() {
// TODO Auto-generated method stub
return null;
}


@Override public void setDatastore(final Datastore sDB) {
// TODO Auto-generated method stub
}
Expand Down
Binary file added src/main/resources/com/dteoh/heartrate/heart.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit efdc907

Please sign in to comment.