Search in sources :

Example 1 with RowFindPanel

use of com.ramussoft.pb.frames.components.RowFindPanel in project ramus by Vitaliy-Yakovchuk.

the class Options method saveOptions.

public static void saveOptions(final String name, final Container component, final Properties properties) {
    if (component == null)
        return;
    if (ResourceLoader.isParent(JFrame.class, component.getClass())) {
        setRectangle(name, ((JFrame) component).getBounds(), properties);
    }
    if (ResourceLoader.isParent(RowFindPanel.class, component.getClass())) {
        setBoolean(name + ".Visible", component.isVisible(), properties);
        setBoolean(name + ".WO", ((RowFindPanel) component).getJCheckBox().isSelected(), properties);
    }
    if (ResourceLoader.isParent(JDialog.class, component.getClass())) {
        setRectangle(name, ((JDialog) component).getBounds(), properties);
    }
    for (int i = 0; i < component.getComponentCount(); i++) {
        if (ResourceLoader.isParent(JTable.class, component.getComponent(i).getClass()))
            setJTableOptions(name + "_" + i, (JTable) component.getComponent(i), properties);
        if (ResourceLoader.isParent(JSplitPane.class, component.getComponent(i).getClass())) {
            setInteger(name + "__" + i, ((JSplitPane) component.getComponent(i)).getDividerLocation(), properties);
        }
        if (ResourceLoader.isParent(Container.class, component.getComponent(i).getClass()))
            saveOptions(name + "X" + i, (Container) component.getComponent(i), properties);
    }
}
Also used : Container(java.awt.Container) JTable(javax.swing.JTable) RowFindPanel(com.ramussoft.pb.frames.components.RowFindPanel) Point(java.awt.Point)

Example 2 with RowFindPanel

use of com.ramussoft.pb.frames.components.RowFindPanel in project ramus by Vitaliy-Yakovchuk.

the class AlternativeArrowDialog method getRowFindPanel.

/**
 * This method initializes rowFindPanel
 *
 * @return com.dsoft.pb.frames.elements.RowFindPanel
 */
private RowFindPanel getRowFindPanel() {
    if (rowFindPanel == null) {
        rowFindPanel = new RowFindPanel() {

            @Override
            public boolean find(final String text, final boolean wordsOrder) {
                return find(-1, text, wordsOrder);
            }

            @Override
            public boolean findNext(final String text, final boolean wordsOrder) {
                return find(jList.getSelectedIndex(), text, wordsOrder);
            }

            private boolean find(final int selectedIndex, final String text, final boolean wordsOrder) {
                final Stream[] streams = streamModel.getData();
                for (int i = selectedIndex + 1; i < streams.length; i++) {
                    final Stream stream = streams[i];
                    if (select(text, wordsOrder, i, stream))
                        return true;
                }
                for (int i = 0; i < selectedIndex; i++) {
                    final Stream stream = streams[i];
                    if (select(text, wordsOrder, i, stream))
                        return true;
                }
                return false;
            }

            private boolean select(final String text, final boolean wordsOrder, final int i, final Stream stream) {
                if (RowSetClass.isStartSame(stream, text, wordsOrder)) {
                    jList.setSelectedIndex(i);
                    jList.ensureIndexIsVisible(i);
                    return true;
                }
                return false;
            }

            @Override
            public void setVisible(final boolean aFlag) {
                super.setVisible(aFlag);
                Options.setBoolean("showFindStreamPanel", aFlag);
            }
        };
        boolean v = Options.getBoolean("showFindStreamPanel", true);
        if (!v)
            rowFindPanel.setVisible(false);
        else
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    rowFindPanel.getJTextField().requestFocus();
                }
            });
    }
    return rowFindPanel;
}
Also used : Stream(com.ramussoft.pb.Stream) RowFindPanel(com.ramussoft.pb.frames.components.RowFindPanel)

Example 3 with RowFindPanel

use of com.ramussoft.pb.frames.components.RowFindPanel in project ramus by Vitaliy-Yakovchuk.

the class StreamsEditDialog method getFindPanel.

private RowFindPanel getFindPanel() {
    if (findPanel == null) {
        findPanel = new RowFindPanel() {

            @Override
            public boolean find(final String text, final boolean wordsOrder) {
                return find(-1, text, wordsOrder);
            }

            @Override
            public boolean findNext(final String text, final boolean wordsOrder) {
                return find(jTable.getSelectedRow(), text, wordsOrder);
            }

            private boolean find(final int selectedIndex, final String text, final boolean wordsOrder) {
                for (int i = selectedIndex + 1; i < data.size(); i++) {
                    final Stream stream = (Stream) data.get(i);
                    if (select(text, wordsOrder, i, stream))
                        return true;
                }
                for (int i = 0; i < selectedIndex; i++) {
                    final Stream stream = (Stream) data.get(i);
                    if (select(text, wordsOrder, i, stream))
                        return true;
                }
                return false;
            }

            private boolean select(final String text, final boolean wordsOrder, final int i, final Stream stream) {
                if (RowSetClass.isStartSame(stream, text, wordsOrder)) {
                    jTable.changeSelection(i, 0, false, false);
                    return true;
                }
                return false;
            }
        };
        ResourceLoader.setJComponentsText(findPanel);
    }
    return findPanel;
}
Also used : Stream(com.ramussoft.pb.Stream) RowFindPanel(com.ramussoft.pb.frames.components.RowFindPanel)

Aggregations

RowFindPanel (com.ramussoft.pb.frames.components.RowFindPanel)3 Stream (com.ramussoft.pb.Stream)2 Container (java.awt.Container)1 Point (java.awt.Point)1 JTable (javax.swing.JTable)1