Example usage for javax.swing JScrollPane setSize

List of usage examples for javax.swing JScrollPane setSize

Introduction

In this page you can find the example usage for javax.swing JScrollPane setSize.

Prototype

public void setSize(Dimension d) 

Source Link

Document

Resizes this component so that it has width d.width and height d.height .

Usage

From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.dialogs.DownloadNotice.java

public DownloadNotice(HashMap<JSONObject, URL> downloads) {

    this.setDownloads(downloads);
    JPanel basic = new JPanel();
    basic.setLayout(new BoxLayout(basic, BoxLayout.Y_AXIS));
    add(basic);/*from w w w. j a va2s .c o m*/

    JPanel topPanel = new JPanel(new BorderLayout(0, 0));
    topPanel.setMaximumSize(new Dimension(450, 0));
    JLabel hint = new JLabel("CHGManager Download Manager");
    hint.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
    topPanel.add(hint);

    JSeparator separator = new JSeparator();
    separator.setForeground(Color.gray);

    topPanel.add(separator, BorderLayout.SOUTH);

    basic.add(topPanel);

    JPanel textPanel = new JPanel(new BorderLayout());
    textPanel.setBorder(BorderFactory.createEmptyBorder(15, 25, 15, 25));
    this.setTextPanel(new JTextPane());

    this.getTextPanel().setContentType("text/html");
    String text = "<p><b>Some files are missing from your CHGManager install. Don't worry. We're trying to download them. Please don't close this panel!</b></p>";
    this.getText().add(text);
    this.getTextPanel().setText(text);
    this.getTextPanel().setEditable(false);
    JScrollPane sp = new JScrollPane();
    sp.setSize(this.getTextPanel().getSize());
    basic.add(sp);

    //basic.add(textPanel);

    JPanel boxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0));
    basic.add(boxPanel);

    JPanel bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton close = new JButton("Close");

    bottom.add(close);
    basic.add(bottom);

    bottom.setMaximumSize(new Dimension(450, 0));

    this.setTitle("CHGManager Download Manager");
    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    try {

        Thread.sleep(2000);

    } catch (InterruptedException e) {

    }

    this.startDownload();

}

From source file:org.cytoscape.dyn.internal.graphMetrics.GraphMetricsPanel.java

public GraphMetricsPanel(org.cytoscape.dyn.internal.CyActivator<T, C> cyActivator,
        DynNetwork<T> dynamicNetwork) {

    this.cyactivator = cyActivator;
    this.dynamicNetwork = dynamicNetwork;
    attributesTable = new JTable(new MyTableModel(dynamicNetwork.getNodeAttributes()));
    attributesTable.setPreferredScrollableViewportSize(new Dimension(300, 400));
    attributesTable.setFillsViewportHeight(true);
    attributesTable.setShowGrid(false);//from  w w w  . j  av  a2s  .  com
    JScrollPane tablePanel = new JScrollPane(attributesTable);
    tablePanel.setSize(new Dimension(250, 400));

    edgeAttributesTable = new JTable(new MyTableModel(dynamicNetwork.getEdgeAttributes()));
    edgeAttributesTable.setPreferredScrollableViewportSize(new Dimension(300, 400));
    edgeAttributesTable.setFillsViewportHeight(true);
    edgeAttributesTable.setShowGrid(false);
    JScrollPane edgeTablePanel = new JScrollPane(edgeAttributesTable);
    edgeTablePanel.setSize(new Dimension(250, 400));

    plotChartButton = new JButton("Plot Selected Attributes");
    closeTab = new JButton("Close Tab");

    plotChartButton.addActionListener(this);
    closeTab.addActionListener(this);

    buttonPanel = new JPanel();

    buttonPanel.setLayout(new FlowLayout());

    buttonPanel.add(plotChartButton);
    buttonPanel.add(closeTab);
    buttonPanel.setBorder(BorderFactory.createTitledBorder(null, "Options", TitledBorder.DEFAULT_JUSTIFICATION,
            TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray));

    tablePanel.setBorder(
            BorderFactory.createTitledBorder(null, "Node Attributes", TitledBorder.DEFAULT_JUSTIFICATION,
                    TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray));

    edgeTablePanel.setBorder(
            BorderFactory.createTitledBorder(null, "Edge Attributes", TitledBorder.DEFAULT_JUSTIFICATION,
                    TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray));

    GroupLayout cytoLayout = new GroupLayout(this);
    this.setLayout(cytoLayout);
    this.add(tablePanel);
    this.add(buttonPanel);

    cytoLayout.setHorizontalGroup(cytoLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(tablePanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
            .addComponent(edgeTablePanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
            .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE));
    cytoLayout.setVerticalGroup(
            cytoLayout.createSequentialGroup().addComponent(tablePanel, 200, GroupLayout.DEFAULT_SIZE, 300)
                    .addComponent(edgeTablePanel, 200, GroupLayout.DEFAULT_SIZE, 300)
                    .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE));

    this.setVisible(true);
}

From source file:net.sf.firemox.ui.component.SplashScreen.java

/**
 * Create a new instance of this class./*  w  w w.ja  va  2s  .  com*/
 * 
 * @param filename
 *          the picture filename.
 * @param parent
 *          the splash screen's parent.
 * @param waitTime
 *          the maximum time before the screen is hidden.
 */
public SplashScreen(String filename, Frame parent, int waitTime) {
    super(parent);
    getContentPane().setLayout(null);
    toFront();
    final JLabel l = new JLabel(new ImageIcon(filename));
    final Dimension labelSize = l.getPreferredSize();
    l.setLocation(0, 0);
    l.setSize(labelSize);
    setSize(labelSize);

    final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(screenSize.width / 2 - labelSize.width / 2, screenSize.height / 2 - labelSize.height / 2);

    final JLabel mp = new JLabel(IdConst.PROJECT_DISPLAY_NAME);
    mp.setLocation(30, 305);
    mp.setSize(new Dimension(300, 30));

    final JLabel version = new JLabel(IdConst.VERSION);
    version.setLocation(235, 418);
    version.setSize(new Dimension(300, 30));

    final JTextArea disclaimer = new JTextArea();
    disclaimer.setEditable(false);
    disclaimer.setLineWrap(true);
    disclaimer.setWrapStyleWord(true);
    disclaimer.setAutoscrolls(true);
    disclaimer.setFont(MToolKit.defaultFont);
    disclaimer.setTabSize(2);

    // Then try and read it locally
    Reader inGPL = null;
    try {
        inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE)));
        disclaimer.read(inGPL, "");
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(inGPL);
    }

    final JScrollPane disclaimerSPanel = new JScrollPane();
    disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    disclaimerSPanel.setViewportView(disclaimer);
    disclaimerSPanel.setLocation(27, 340);
    disclaimerSPanel.setPreferredSize(new Dimension(283, 80));
    disclaimerSPanel.setSize(disclaimerSPanel.getPreferredSize());

    getContentPane().add(disclaimerSPanel);
    getContentPane().add(version);
    getContentPane().add(mp);
    getContentPane().add(l);

    final int pause = waitTime;
    final Runnable waitRunner = new Runnable() {
        public void run() {
            try {
                Thread.sleep(pause);
                while (!bKilled) {
                    Thread.sleep(200);
                }
            } catch (InterruptedException e) {
                // Ignore this error
            }
            setVisible(false);
            dispose();
            MagicUIComponents.magicForm.toFront();
        }
    };

    // setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            setVisible(false);
            dispose();
            if (MagicUIComponents.magicForm != null)
                MagicUIComponents.magicForm.toFront();
        }
    });
    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_SPACE) {
                setVisible(false);
                dispose();
                MagicUIComponents.magicForm.toFront();
            }
        }
    });
    setVisible(true);
    start(waitRunner);
}

From source file:sk.uniza.fri.pds.spotreba.energie.gui.MainGui.java

private void showJTable(Class clazz, List data) throws HeadlessException {
    JScrollPane jScrollPane = new JScrollPane();
    Dimension dimension = new Dimension(1200, 400);
    jScrollPane.setSize(dimension);
    jScrollPane.setPreferredSize(dimension);
    final BeanTableModel beanTableModel = new BeanTableModel(clazz, data);
    beanTableModel.sortColumnNames();/*  w  ww  .j  ava2 s  .  c o  m*/
    JTable jTable = new JTable(beanTableModel);
    jScrollPane.getViewport().add(jTable);
    JOptionPane.showMessageDialog(null, jScrollPane);
}

From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java

/**
 * Constructor./*from  w w  w . j  ava  2s. com*/
 */
public GapFillingFrame(final AbstractTabView atv, final Instances dataSet, final Attribute attr,
        final int dateIdx, final int valuesBeforeAndAfter, final int position, final int gapsize,
        final StationsDataProvider gcp, final boolean inBatchMode) {
    super();

    setTitle("Gap filling for " + attr.name() + " ("
            + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position).value(dateIdx)) + " -> "
            + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position + gapsize).value(dateIdx)) + ")");
    LogoHelper.setLogo(this);

    this.atv = atv;

    this.dataSet = dataSet;
    this.attr = attr;
    this.dateIdx = dateIdx;
    this.valuesBeforeAndAfter = valuesBeforeAndAfter;
    this.position = position;
    this.gapsize = gapsize;

    this.gcp = gcp;

    final Instances testds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0,
            dataSet.numAttributes() - 1, Math.max(0, position - valuesBeforeAndAfter),
            Math.min(position + gapsize + valuesBeforeAndAfter, dataSet.numInstances() - 1));

    this.attrNames = WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(testds);

    this.isGapSimulated = (this.attrNames.contains(attr.name()));
    this.originaldataSet = new Instances(dataSet);
    if (this.isGapSimulated) {
        setTitle(getTitle() + " [SIMULATED GAP]");
        /*final JXLabel fictiveGapLabel=new JXLabel("                                                                        FICTIVE GAP");
        fictiveGapLabel.setForeground(Color.RED);
        fictiveGapLabel.setFont(new Font(fictiveGapLabel.getFont().getName(), Font.PLAIN,fictiveGapLabel.getFont().getSize()*2));
        final JXPanel fictiveGapPanel=new JXPanel();
        fictiveGapPanel.setLayout(new BorderLayout());
        fictiveGapPanel.add(fictiveGapLabel,BorderLayout.CENTER);
        getContentPane().add(fictiveGapPanel,BorderLayout.NORTH);*/
        this.attrNames.remove(attr.name());
        this.originalDataBeforeGapSimulation = dataSet.attributeToDoubleArray(attr.index());
        for (int i = position; i < position + gapsize; i++)
            dataSet.instance(i).setMissing(attr);
    }

    final Object[] attrNamesObj = this.attrNames.toArray();

    this.centerPanel = new JXPanel();
    this.centerPanel.setLayout(new BorderLayout());
    getContentPane().add(this.centerPanel, BorderLayout.CENTER);

    //final JXPanel algoPanel=new JXPanel();
    //getContentPane().add(algoPanel,BorderLayout.NORTH);
    final JXPanel filterPanel = new JXPanel();
    //filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS));      
    filterPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(10, 10, 10, 10);
    getContentPane().add(filterPanel, BorderLayout.WEST);

    final JXComboBox algoCombo = new JXComboBox(Algo.values());
    algoCombo.setBorder(new TitledBorder("Algorithm"));
    filterPanel.add(algoCombo, gbc);
    gbc.gridy++;

    final JXLabel infoLabel = new JXLabel("Usable = with no missing values on the period");
    //infoLabel.setBorder(new TitledBorder(""));
    filterPanel.add(infoLabel, gbc);
    gbc.gridy++;

    final JList<Object> timeSeriesList = new JList<Object>(attrNamesObj);
    timeSeriesList.setBorder(new TitledBorder("Usable time series"));
    timeSeriesList.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    final JScrollPane jcpMap = new JScrollPane(timeSeriesList);
    jcpMap.setPreferredSize(new Dimension(225, 150));
    jcpMap.setMinimumSize(new Dimension(225, 150));
    filterPanel.add(jcpMap, gbc);
    gbc.gridy++;

    final JXPanel mapPanel = new JXPanel();
    mapPanel.setBorder(new TitledBorder(""));
    mapPanel.setLayout(new BorderLayout());
    mapPanel.add(gcp.getMapPanel(Arrays.asList(attr.name()), this.attrNames, true), BorderLayout.CENTER);
    filterPanel.add(mapPanel, gbc);
    gbc.gridy++;

    final JXLabel mssLabel = new JXLabel(
            "<html>Most similar usable serie: <i>[... computation ...]</i></html>");
    mssLabel.setBorder(new TitledBorder(""));
    filterPanel.add(mssLabel, gbc);
    gbc.gridy++;

    final JXLabel nsLabel = new JXLabel("<html>Nearest usable serie: <i>[... computation ...]</i></html>");
    nsLabel.setBorder(new TitledBorder(""));
    filterPanel.add(nsLabel, gbc);
    gbc.gridy++;

    final JXLabel ussLabel = new JXLabel("<html>Upstream serie: <i>[... computation ...]</i></html>");
    ussLabel.setBorder(new TitledBorder(""));
    filterPanel.add(ussLabel, gbc);
    gbc.gridy++;

    final JXLabel dssLabel = new JXLabel("<html>Downstream serie: <i>[... computation ...]</i></html>");
    dssLabel.setBorder(new TitledBorder(""));
    filterPanel.add(dssLabel, gbc);
    gbc.gridy++;

    final JCheckBox hideOtherSeriesCB = new JCheckBox("Hide the others series");
    hideOtherSeriesCB.setSelected(DEFAULT_HIDE_OTHER_SERIES_OPTION);
    filterPanel.add(hideOtherSeriesCB, gbc);
    gbc.gridy++;

    final JCheckBox showErrorCB = new JCheckBox("Show error on plot");
    filterPanel.add(showErrorCB, gbc);
    gbc.gridy++;

    final JCheckBox zoomCB = new JCheckBox("Auto-adjusted size");
    zoomCB.setSelected(DEFAULT_ZOOM_OPTION);
    filterPanel.add(zoomCB, gbc);
    gbc.gridy++;

    final JCheckBox multAxisCB = new JCheckBox("Multiple axis");
    filterPanel.add(multAxisCB, gbc);
    gbc.gridy++;

    final JCheckBox showEnvelopeCB = new JCheckBox("Show envelope (all algorithms, SLOW)");
    filterPanel.add(showEnvelopeCB, gbc);
    gbc.gridy++;

    final JXButton showModelButton = new JXButton("Show the model");
    filterPanel.add(showModelButton, gbc);
    gbc.gridy++;

    showModelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            final JXFrame dialog = new JXFrame();
            dialog.setTitle("Model");
            LogoHelper.setLogo(dialog);
            dialog.getContentPane().removeAll();
            dialog.getContentPane().setLayout(new BorderLayout());
            final JTextPane modelTxtPane = new JTextPane();
            modelTxtPane.setText(gapFiller.getModel());
            modelTxtPane.setBackground(Color.WHITE);
            modelTxtPane.setEditable(false);
            final JScrollPane jsp = new JScrollPane(modelTxtPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            jsp.setSize(new Dimension(400 - 20, 400 - 20));
            dialog.getContentPane().add(jsp, BorderLayout.CENTER);
            dialog.setSize(new Dimension(400, 400));
            dialog.setLocationRelativeTo(centerPanel);
            dialog.pack();
            dialog.setVisible(true);
        }
    });

    algoCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
                showModelButton.setEnabled(gapFiller.hasExplicitModel());
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    timeSeriesList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(final ListSelectionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
                mapPanel.removeAll();
                final List<String> currentlySelected = new ArrayList<String>();
                currentlySelected.add(attr.name());
                for (final Object sel : timeSeriesList.getSelectedValues())
                    currentlySelected.add(sel.toString());
                mapPanel.add(gcp.getMapPanel(currentlySelected, attrNames, true), BorderLayout.CENTER);
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    hideOtherSeriesCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    showErrorCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    zoomCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    showEnvelopeCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    multAxisCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    this.inBatchMode = inBatchMode;

    if (!inBatchMode) {
        try {
            refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), new int[0],
                    DEFAULT_HIDE_OTHER_SERIES_OPTION, false, DEFAULT_ZOOM_OPTION, false, false);
            showModelButton.setEnabled(gapFiller.hasExplicitModel());
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    if (!inBatchMode) {
        /* automatically select computed series */
        new AbstractSimpleAsync<Void>(true) {
            @Override
            public Void execute() throws Exception {
                mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames,
                        false);
                mssLabel.setText("<html>Most similar usable serie: <b>" + mostSimilar + "</b></html>");

                nearest = gcp.findNearestStation(attr.name(), attrNames);
                nsLabel.setText("<html>Nearest usable serie: <b>" + nearest + "</b></html>");

                upstream = gcp.findUpstreamStation(attr.name(), attrNames);
                if (upstream != null) {
                    ussLabel.setText("<html>Upstream usable serie: <b>" + upstream + "</b></html>");
                } else {
                    ussLabel.setText("<html>Upstream usable serie: <b>N/A</b></html>");
                }

                downstream = gcp.findDownstreamStation(attr.name(), attrNames);
                if (downstream != null) {
                    dssLabel.setText("<html>Downstream usable serie: <b>" + downstream + "</b></html>");
                } else {
                    dssLabel.setText("<html>Downstream usable serie: <b>N/A</b></html>");
                }

                timeSeriesList.setSelectedIndices(
                        new int[] { attrNames.indexOf(mostSimilar), attrNames.indexOf(nearest),
                                attrNames.indexOf(upstream), attrNames.indexOf(downstream) });

                return null;
            }

            @Override
            public void onSuccess(final Void result) {
            }

            @Override
            public void onFailure(final Throwable caught) {
                caught.printStackTrace();
            }
        }.start();
    } else {
        try {
            mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        nearest = gcp.findNearestStation(attr.name(), attrNames);
        upstream = gcp.findUpstreamStation(attr.name(), attrNames);
        downstream = gcp.findDownstreamStation(attr.name(), attrNames);
    }
}

From source file:org.simmi.GeneSetHead.java

License:asdf

public void blastn(boolean show) {
    String dbname = null;/*  w  w w.j a v  a  2 s. c o  m*/

    final JTextArea ta = new JTextArea();
    JScrollPane sp = new JScrollPane(ta);
    Dimension dim = new Dimension(400, 300);
    sp.setSize(dim);
    sp.setPreferredSize(dim);
    JTextField tf = new JTextField();
    tf.setText("0.00001");
    Object[] objs = new Object[] { sp, tf };
    JOptionPane.showMessageDialog(GeneSetHead.this, objs);

    doBlastn(ta.getText(), tf.getText(), false, null, show);
}

From source file:org.simmi.GeneSetHead.java

License:asdf

public void blast(boolean x) {
    //String dbname = null;

    /*try {/*from w w  w .j a v a  2 s . co  m*/
       Map<String,String> env = new HashMap<String,String>();
       Path path = zipfile.toPath();
       String uristr = "jar:" + path.toUri();
       geneset.zipuri = URI.create( uristr /*.replace("file://", "file:")* );
       geneset.zipfilesystem = FileSystems.newFileSystem( geneset.zipuri, env );
               
       final PathMatcher pm = geneset.zipfilesystem.getPathMatcher("*.p??");
       for( Path p : zipfilesystem.getRootDirectories() ) {
    Files.walkFileTree( p, new SimpleFileVisitor<Path>() {
       @Override
       public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
          if( pm.matches( file ) ) {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             byte[] bb = new byte[1024];
             int r = zipm.read( bb );
             while( r > 0 ) {
                baos.write(bb, 0, r);
                r = zipm.read( bb );
             }
             Files.write( new File("c:/"+file.getFileName().).toPath(), baos.toByteArray(), StandardOpenOption.CREATE);
             //unresolvedmap = loadunresolvedmap( new InputStreamReader( zipm ) );
                     
             dbname = zname.substring(0, zname.length()-4);
          }
          return null;*
       }
    });
       }*/
    //Path nf = zipfilesystem.getPath("/unresolved.blastout");
    //unresolvedmap = loadunresolvedmap( new InputStreamReader( Files.newInputStream(nf, StandardOpenOption.READ) ) );

    /*ZipInputStream zipm = new ZipInputStream( new ByteArrayInputStream( zipf ) );
    ZipEntry ze = zipm.getNextEntry();
    while( ze != null ) {
    String zname = ze.getName();
    if( zname.endsWith(".phr") || zname.endsWith(".pin") || zname.endsWith(".psq") ) {
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       byte[] bb = new byte[1024];
       int r = zipm.read( bb );
       while( r > 0 ) {
          baos.write(bb, 0, r);
          r = zipm.read( bb );
       }
       Files.write( new File("c:/"+zname).toPath(), baos.toByteArray(), StandardOpenOption.CREATE);
       //unresolvedmap = loadunresolvedmap( new InputStreamReader( zipm ) );
               
       dbname = zname.substring(0, zname.length()-4);
    }
    ze = zipm.getNextEntry();
    }*
    } catch (IOException e1) {
    e1.printStackTrace();
    }*/

    final JTextArea ta = new JTextArea();
    JScrollPane sp = new JScrollPane(ta);
    Dimension dim = new Dimension(400, 300);
    sp.setSize(dim);
    sp.setPreferredSize(dim);
    JTextField tf = new JTextField();
    tf.setText("0.00001");
    Object[] objs = new Object[] { sp, tf };
    JOptionPane.showMessageDialog(GeneSetHead.this, objs);

    doBlast(ta.getText(), tf.getText(), true, null, x);
}