File | Line |
---|
org\fosstrak\hal\impl\sim\GraphicSimulator.java | 621 |
org\fosstrak\hal\impl\sim\multi\GraphicSimulatorServer.java | 618 |
}
/**
* removes the tag from the layered pane
*
* @param tag which will be removed
*/
public void removeTag(Tag tag) {
tags.remove(tag);
jLayeredPane.remove(tag);
jLayeredPane.repaint();
}
/**
* creates a new tag and adds it to the layered pane
*
* @param name of the new tag
* @param epc of the new tag
*/
private void createNewTag(String id) {
Point pos = new Point(getProperty("FramePadding"), tags.size() * (getProperty("TagHeight") + getProperty("InterTagPadding")) + getProperty("FramePadding"));
createNewTag(id, pos);
}
/**
* creates a new tag and adds it to the layered pane
*
* @param name of the new tag
* @param epc of the new tag
* @param pos position on the pane of the new tag
*/
private void createNewTag(String id, Point pos) {
if(!"".equals(id)) {
Tag newTag = new Tag(id, pos, this);
tags.add(newTag);
jLayeredPane.add(newTag, new Integer(1));
jLayeredPane.repaint();
}
}
/**
* returns the translation listener
*
* @return translation listener
*/
public TranslationListener getTranslationListener() {
return translationListener;
}
/**
* returns the gui text resource bundle
*
* @return gui text resource bundle
*/
public XMLConfiguration getGuiText() {
return guiTextConfig;
}
/**
* returns the simulator properties
*
* @return properties
*/
public XMLConfiguration getProperties() {
return propsConfig;
}
/**
* adds an enter event to the simulator controller
*
* @param antennaId
* @param epc of the tag
*/
public void enterEvent(String readerId, String antennaId, String epc) { |
File | Line |
---|
org\fosstrak\hal\impl\sim\GraphicSimulator.java | 384 |
org\fosstrak\hal\impl\sim\multi\GraphicSimulatorServer.java | 359 |
contextMenu.setVisible(false);
if(e.getButton() == MouseEvent.BUTTON1) {
selection.select(tags);
}
}
}
// selection
public void mousePressed(final MouseEvent e) {
hideActiveContextMenuAndSelection();
if(e.getButton() == MouseEvent.BUTTON1) {
selection.setBounds(0, 0, getProperty("WindowWidth"), getProperty("WindowHeight"));
selection.setStartPoint(e.getPoint());
jLayeredPane.add(selection, new Integer(2));
}
}
});
// add drag listener
jLayeredPane.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
if(selection.isActive()) {
selection.setCurrentPoint(e.getPoint());
}
}
});
}
return jLayeredPane;
}
/**
* update the layered pane with new reader information
*
* @return layered pane
*/
private void updateJLayeredPane() { |
File | Line |
---|
org\fosstrak\hal\impl\sim\GraphicSimulator.java | 296 |
org\fosstrak\hal\impl\sim\multi\GraphicSimulatorServer.java | 275 |
}
/**
* creates the tag menu item
*
* @return tag menu
*/
private JMenu getTagMenu() {
JMenu tagMenu = new JMenu(guiTextConfig.getString("TagMenuItem"));
// new tag
JMenuItem newTagMenuItem = new JMenuItem();
newTagMenuItem.setText(guiTextConfig.getString("AddNewTagMenuItem"));
newTagMenuItem.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
showAddTagDialog();
}
});
tagMenu.add(newTagMenuItem);
return tagMenu;
}
/**
* creates the help menu item
*
* @return help menu
*/
private JMenu getHelpMenu() {
JMenu helpMenu = new JMenu(guiTextConfig.getString("HelpMenuItem"));
// about
JMenuItem aboutMenuItem = new JMenuItem();
aboutMenuItem.setText(guiTextConfig.getString("AboutMenuItem"));
aboutMenuItem.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
JDialog aboutDialog = new JDialog(GraphicSimulatorServer.this, guiTextConfig.getString("AboutDialogTitle"), true); |
File | Line |
---|
org\fosstrak\hal\impl\sim\GraphicSimulator.java | 728 |
org\fosstrak\hal\impl\sim\multi\GraphicSimulatorServer.java | 741 |
}
/**
* gets a property value as integer
*
* @param key of the property
* @return property as integer value
*/
public int getProperty(String key) {
String error;
if(!propsConfig.containsKey(key)) {
error = "Value '" + key + "' not found in properties !";
} else {
try {
return propsConfig.getInt(key);
} catch (Exception e) {
error = "Value '" + key + "' is not an integer !";
}
}
throw new NumberFormatException(error);
}
/**
* sets active context menu
*
* @param contextMenu which is active
*/
public void setActiveContextMenu(JPopupMenu contextMenu) {
activeContextMenu = contextMenu;
}
/**
* hide active context menu
*/
public void hideActiveContextMenu() {
if(activeContextMenu != null) {
activeContextMenu.setVisible(false);
activeContextMenu = null;
}
}
/**
* hide active context menu and hide selection
*/
public void hideActiveContextMenuAndSelection() {
hideActiveContextMenu();
selection.unselect(tags);
} |