Search in sources :

Example 71 with KeyStroke

use of javax.swing.KeyStroke in project fql by CategoricalData.

the class OplDisplay method display.

// private final Map<String, String> indices = new HashMap<>();
private void display(String s, @SuppressWarnings("unused") List<String> order) {
    frame = new JFrame();
    // this.name = s;
    Vector<String> ooo = new Vector<>();
    // int index = 0;
    for (Pair<String, JComponent> p : frames) {
        x.add(p.second, p.first);
        ooo.add(p.first);
    // indices.put(order.get(index++), p.first);
    }
    x.add(new JPanel(), "blank");
    cl.show(x, "blank");
    yyy.setListData(ooo);
    JPanel temp1 = new JPanel(new GridLayout(1, 1));
    temp1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Select:"));
    JScrollPane yyy1 = new JScrollPane(yyy);
    temp1.add(yyy1);
    // temp1.setMinimumSize(new Dimension(200, 600));
    // yyy.setPreferredSize(new Dimension(200, 600));
    yyy.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    yyy.addListSelectionListener((ListSelectionEvent e) -> {
        int i = yyy.getSelectedIndex();
        if (i == -1) {
            cl.show(x, "blank");
        } else {
            cl.show(x, ooo.get(i));
        }
    });
    JPanel north = new JPanel(new GridLayout(1, 1));
    // JButton saveButton = new JButton("Save GUI");
    // north.add(saveButton);
    // saveButton.setMinimumSize(new Dimension(10,10));
    // saveButton.addActionListener(x -> GUI.save2(env));
    JSplitPane px = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    // px.setResizeWeight(.8);
    px.setDividerLocation(200);
    // FQLSplit px = new FQLSplit(.5, JSplitPane.HORIZONTAL_SPLIT);
    px.setDividerSize(4);
    frame = new JFrame(/* "Viewer for " + */
    s);
    JSplitPane temp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    temp2.setResizeWeight(1);
    temp2.setDividerSize(0);
    temp2.setBorder(BorderFactory.createEmptyBorder());
    temp2.add(temp1);
    temp2.add(north);
    // px.add(temp1);
    px.add(temp2);
    px.add(x);
    // JPanel bd = new JPanel(new BorderLayout());
    // bd.add(px, BorderLayout.CENTER);
    // bd.add(north, BorderLayout.NORTH);
    // frame.setContentPane(bd);
    frame.setContentPane(px);
    frame.setSize(900, 600);
    ActionListener escListener = (ActionEvent e) -> frame.dispose();
    frame.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
    KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
    frame.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
    frame.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) JComponent(javax.swing.JComponent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) GridLayout(java.awt.GridLayout) ActionListener(java.awt.event.ActionListener) JFrame(javax.swing.JFrame) KeyStroke(javax.swing.KeyStroke) JSplitPane(javax.swing.JSplitPane) Vector(java.util.Vector)

Example 72 with KeyStroke

use of javax.swing.KeyStroke in project fql by CategoricalData.

the class FqlDisplay method display.

private void display(String s, List<String> order) {
    frame = new JFrame();
    name = s;
    Vector<String> ooo = new Vector<>();
    int index = 0;
    for (Pair<String, JComponent> p : frames) {
        x.add(p.second, p.first);
        ooo.add(p.first);
        indices.put(order.get(index++), p.first);
    }
    x.add(new JPanel(), "blank");
    cl.show(x, "blank");
    yyy.setListData(ooo);
    JPanel temp1 = new JPanel(new GridLayout(1, 1));
    temp1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Select:"));
    JScrollPane yyy1 = new JScrollPane(yyy);
    temp1.add(yyy1);
    temp1.setMinimumSize(new Dimension(10, 10));
    yyy.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    yyy.addListSelectionListener((ListSelectionEvent e) -> {
        int i = yyy.getSelectedIndex();
        if (i == -1) {
            cl.show(x, "blank");
        } else {
            cl.show(x, ooo.get(i));
        }
    });
    JPanel north = new JPanel(new GridLayout(2, 1));
    JButton instanceFlowButton = new JButton("Instance Dependence Graph");
    JButton schemaFlowButton = new JButton("Schema Mapping Graph");
    instanceFlowButton.setMinimumSize(new Dimension(10, 10));
    schemaFlowButton.setMinimumSize(new Dimension(10, 10));
    north.add(instanceFlowButton);
    instanceFlowButton.addActionListener((ActionEvent e) -> showInstanceFlow(prog));
    north.add(schemaFlowButton);
    schemaFlowButton.addActionListener((ActionEvent e) -> showSchemaFlow());
    Split px = new Split(.5, JSplitPane.HORIZONTAL_SPLIT);
    px.setDividerSize(6);
    px.setDividerLocation(220);
    frame = new JFrame(/* "Viewer for " + */
    s);
    JSplitPane temp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    temp2.setResizeWeight(1);
    temp2.setDividerSize(0);
    temp2.setBorder(BorderFactory.createEmptyBorder());
    temp2.add(temp1);
    temp2.add(north);
    px.add(temp2);
    px.add(x);
    frame.setContentPane(px);
    frame.setSize(900, 600);
    ActionListener escListener = (ActionEvent e) -> frame.dispose();
    frame.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
    KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
    frame.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
    frame.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) JComponent(javax.swing.JComponent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) Paint(java.awt.Paint) GridLayout(java.awt.GridLayout) ActionListener(java.awt.event.ActionListener) JFrame(javax.swing.JFrame) KeyStroke(javax.swing.KeyStroke) Split(catdata.ide.Split) JSplitPane(javax.swing.JSplitPane) Vector(java.util.Vector)

Example 73 with KeyStroke

use of javax.swing.KeyStroke in project fql by CategoricalData.

the class FqlDisplay method showSchemaFlow.

private void showSchemaFlow() {
    JFrame f = new JFrame();
    ActionListener escListener = (ActionEvent e) -> f.dispose();
    f.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
    KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
    f.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
    f.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
    Graph<String, Object> g = prog.build2;
    if (g.getVertexCount() == 0) {
        f.add(new JPanel());
    } else {
        f.add(doView2(g));
    }
    f.setSize(600, 540);
    f.setTitle("Schema Mapping Graph for " + name);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) JFrame(javax.swing.JFrame) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke)

Example 74 with KeyStroke

use of javax.swing.KeyStroke in project fql by CategoricalData.

the class FqlCodeEditor method doTemplates.

@Override
protected void doTemplates() {
    CompletionProvider provider = createCompletionProvider();
    AutoCompletion ac = new AutoCompletion(provider);
    KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
    ac.setTriggerKey(key);
    ac.install(topArea);
}
Also used : DefaultCompletionProvider(org.fife.ui.autocomplete.DefaultCompletionProvider) CompletionProvider(org.fife.ui.autocomplete.CompletionProvider) AutoCompletion(org.fife.ui.autocomplete.AutoCompletion) KeyStroke(javax.swing.KeyStroke)

Example 75 with KeyStroke

use of javax.swing.KeyStroke in project gitblit by gitblit.

the class EditUserDialog method createRootPane.

@Override
protected JRootPane createRootPane() {
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    JRootPane rootPane = new JRootPane();
    rootPane.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    return rootPane;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane)

Aggregations

KeyStroke (javax.swing.KeyStroke)194 ActionEvent (java.awt.event.ActionEvent)77 AbstractAction (javax.swing.AbstractAction)56 InputMap (javax.swing.InputMap)46 Action (javax.swing.Action)44 JRootPane (javax.swing.JRootPane)36 ActionListener (java.awt.event.ActionListener)27 JPanel (javax.swing.JPanel)20 ActionMap (javax.swing.ActionMap)17 JComponent (javax.swing.JComponent)16 KeyEvent (java.awt.event.KeyEvent)15 JMenuItem (javax.swing.JMenuItem)14 JScrollPane (javax.swing.JScrollPane)14 Point (java.awt.Point)13 JFrame (javax.swing.JFrame)12 JPopupMenu (javax.swing.JPopupMenu)12 WindowEvent (java.awt.event.WindowEvent)10 Dimension (java.awt.Dimension)9 MouseAdapter (java.awt.event.MouseAdapter)9 MouseEvent (java.awt.event.MouseEvent)9