コード例 #1
0
public class HandlerSequenceId extends HandlerGenomeId {

  boolean inLink = false;
  boolean inLinkId = false;
  private static IMediatorGUI mediatorGUI = MediatorGUI.getInstance();

  List<String> sequenceIdList = new ArrayList<String>();

  public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException {

    if (qName.equalsIgnoreCase("LINK")) {
      inLink = true;
    }

    if (inLink == true) {
      if (qName.equalsIgnoreCase("ID")) {
        inLinkId = true;
      }
    }
  }

  public void endElement(String uri, String localName, String qName) throws SAXException {

    // System.out.println("End Element :" + qName);
    if (qName.equalsIgnoreCase("LINK")) {
      inLink = false;
    }
  }

  public void characters(char ch[], int start, int length) throws SAXException {

    if (inLinkId) {
      sequenceIdList.add(new String(ch, start, length));
      mediatorGUI.updateAquisitionPanel("   _ sequenceId : " + new String(ch, start, length));
      inLinkId = false;
    }
  }

  public List<String> getSequenceIdList() {
    return sequenceIdList;
  }
}
コード例 #2
0
  /** Build the GUI: add app icon, tree icons, the 3 main panels. */
  public JFrameGUI() {
    super("jSQL Injection");

    MediatorGUI.register(this);
    MediatorModel.model().addObserver(this);

    // Define a small and large app icon
    this.setIconImages(HelperGUI.getIcons());

    // Load UI before any component
    HelperGUI.prepareGUI();
    ShadowPopupFactory.install();

    // Save controller
    MediatorGUI.register(new Menubar());
    this.setJMenuBar(MediatorGUI.menubar());

    // Define the default panel: each component on a vertical line
    this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));

    // Textfields at the top
    MediatorGUI.register(new PanelTop());
    this.add(MediatorGUI.top());

    // Main panel for tree ans tables in the middle
    JPanel mainPanel = new JPanel(new GridLayout(1, 0));
    this.outputPanel = new PanelLeftRightBottom();
    mainPanel.add(this.outputPanel);
    this.add(mainPanel);

    MediatorGUI.gui()
        .addWindowListener(
            new WindowAdapter() {
              @Override
              public void windowClosing(WindowEvent e) {
                Preferences prefs = Preferences.userRoot().node(InjectionModel.class.getName());
                prefs.putInt(
                    PanelLeftRightBottom.VERTICALSPLITTER_PREFNAME,
                    JFrameGUI.this.outputPanel.leftRight.getDividerLocation());
                prefs.putInt(
                    PanelLeftRightBottom.HORIZONTALSPLITTER_PREFNAME,
                    JFrameGUI.this.outputPanel.getHeight()
                        - JFrameGUI.this.outputPanel.getDividerLocation());

                prefs.putBoolean(HelperGUI.BINARY_VISIBLE, false);
                prefs.putBoolean(HelperGUI.CHUNK_VISIBLE, false);
                prefs.putBoolean(HelperGUI.NETWORK_VISIBLE, false);
                prefs.putBoolean(HelperGUI.JAVA_VISIBLE, false);

                for (int i = 0; i < MediatorGUI.bottom().getTabCount(); i++) {
                  if ("Binary".equals(MediatorGUI.bottom().getTitleAt(i))) {
                    prefs.putBoolean(HelperGUI.BINARY_VISIBLE, true);
                  } else if ("Chunk".equals(MediatorGUI.bottom().getTitleAt(i))) {
                    prefs.putBoolean(HelperGUI.CHUNK_VISIBLE, true);
                  } else if ("Network".equals(MediatorGUI.bottom().getTitleAt(i))) {
                    prefs.putBoolean(HelperGUI.NETWORK_VISIBLE, true);
                  } else if ("Java".equals(MediatorGUI.bottom().getTitleAt(i))) {
                    prefs.putBoolean(HelperGUI.JAVA_VISIBLE, true);
                  }
                }
              }
            });

    // Info on the bottom
    MediatorGUI.register(new PanelStatusbar());
    this.add(MediatorGUI.status());

    // Reduce size of components
    this.pack(); // nécessaire après le masquage des param proxy

    // Size of window
    this.setSize(1024, 768);
    this.setVisible(true);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Center the window
    this.setLocationRelativeTo(null);

    // Define the keyword shortcuts for tabs #Need to work even if the focus is not on tabs
    ActionHandler.addShortcut(this.getRootPane(), MediatorGUI.right());
    ActionHandler.addTextFieldShortcutSelectAll();
  }
コード例 #3
0
  /** Empty the interface. */
  public void resetInterface() {
    // Empty tree objects
    this.treeNodeModels.clear();
    this.consoles.clear();

    /*
     * TODO : clear properly paused processes remaining when another new
     * injection is run.
     */
    // GUIMediator.model().suspendables.clear();

    MediatorGUI.bottomPanel().listHTTPHeader.clear();

    // Tree model for refreshing the tree
    DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGUI.databaseTree().getModel();
    // The tree root
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();

    // Delete tabs
    MediatorGUI.right().removeAll();
    // Remove tree nodes
    root.removeAllChildren();
    // Refresh the root
    treeModel.nodeChanged(root);
    // Refresh the tree
    treeModel.reload();
    MediatorGUI.databaseTree().setRootVisible(true);

    // Empty infos tabs
    MediatorGUI.bottomPanel().chunkTab.setText("");
    MediatorGUI.bottomPanel().binaryTab.setText("");
    ((DefaultTableModel) MediatorGUI.bottomPanel().networkTable.getModel()).setRowCount(0);
    MediatorGUI.bottomPanel().javaTab.getProxy().setText("");

    MediatorGUI.bottomPanel().networkTabHeader.setText("");
    MediatorGUI.bottomPanel().networkTabParam.setText("");
    MediatorGUI.bottomPanel().networkTabResponse.setText("");
    MediatorGUI.bottomPanel().networkTabTiming.setText("");
    MediatorGUI.bottomPanel().networkTabSource.setText("");
    MediatorGUI.bottomPanel().networkTabPreview.setText("");

    for (int i = 0; i < MediatorGUI.bottom().getTabCount(); i++) {
      Component tabComponent = MediatorGUI.bottom().getTabComponentAt(i);
      if (tabComponent != null) {
        tabComponent.setFont(tabComponent.getFont().deriveFont(Font.PLAIN));
      }
    }

    MediatorGUI.left().fileManager.setButtonEnable(false);
    MediatorGUI.left().shellManager.setButtonEnable(false);
    MediatorGUI.left().sqlShellManager.setButtonEnable(false);

    // Default status info
    MediatorGUI.status().reset();

    MediatorGUI.left().fileManager.changePrivilegeIcon(HelperGUI.SQUARE_GREY);
    MediatorGUI.left().shellManager.changePrivilegeIcon(HelperGUI.SQUARE_GREY);
    MediatorGUI.left().sqlShellManager.changePrivilegeIcon(HelperGUI.SQUARE_GREY);
    MediatorGUI.left().uploadManager.changePrivilegeIcon(HelperGUI.SQUARE_GREY);
  }