Package shadowrun.actions

Source Code of shadowrun.actions.ShowCharacter

package shadowrun.actions;

import java.awt.Dimension;

import javax.swing.JDialog;

import net.alteiar.beans.map.elements.IAction;
import net.alteiar.campaign.player.gui.MainFrame;
import net.alteiar.campaign.player.gui.documents.PanelViewDocument;
import net.alteiar.campaign.player.plugin.PluginSystem;
import net.alteiar.documents.BeanDocument;

public class ShowCharacter extends IAction {

  private final BeanDocument character;

  public ShowCharacter(BeanDocument character) {
    this.character = character;
  }

  @Override
  public String getName() {
    return "Voir le personnage";
  }

  @Override
  public Boolean canDoAction() {
    return true;
  }

  @Override
  public void doAction(int xOnScreen, int yOnScreen) throws Exception {
    PanelViewDocument panelView = PluginSystem.getInstance().getViewPanel(
        character);

    if (panelView != null) {
      JDialog dlg = new JDialog(MainFrame.FRAME,
          character.getDocumentName(), false);
      dlg.add(panelView);
      dlg.setPreferredSize(new Dimension(800, 600));
      dlg.pack();
      dlg.setLocationRelativeTo(null);
      dlg.setVisible(true);
    }
  }

}
TOP

Related Classes of shadowrun.actions.ShowCharacter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.