http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java deleted file mode 100644 index 65fd483..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view; - -import org.apache.oodt.cas.filemgr.browser.controller.WindowListener; -import org.apache.oodt.cas.filemgr.browser.view.menus.MenuBar; -import org.apache.oodt.cas.filemgr.browser.view.panels.BottomPane; -import org.apache.oodt.cas.filemgr.browser.view.panels.HeaderRow; -import org.apache.oodt.cas.filemgr.browser.view.panels.MiddlePane; -import org.apache.oodt.cas.filemgr.browser.view.panels.QueryPane; - -import java.awt.*; - -import javax.swing.*; - -public class MainWindow extends JFrame { - - public QueryPane qPane; - public MiddlePane mPane; - public BottomPane bPane; - public MenuBar bar; - - private WindowListener wListener; - - public MainWindow() { - wListener = new WindowListener(this); - setName("CAS File Manager Browser"); - setDefaultCloseOperation(EXIT_ON_CLOSE); - qPane = new QueryPane(wListener); - mPane = new MiddlePane(); - bPane = new BottomPane(); - Dimension d = new Dimension(GuiParams.WINDOW_WIDTH, GuiParams.WINDOW_HEIGHT); - Container p = this.getContentPane(); - p.setPreferredSize(d); - p.setMinimumSize(d); - p.setMaximumSize(d); - p.setBackground(Color.WHITE); - p.setLayout(new BorderLayout()); - p.add(qPane, BorderLayout.NORTH); - p.add(mPane, BorderLayout.CENTER); - p.add(bPane, BorderLayout.SOUTH); - - bar = new MenuBar(wListener, mPane.getListener()); - this.setJMenuBar(bar); - } - - public String[] getColHeaders() { - HeaderRow h = mPane.tPane.getHeader(); - String[] heading = new String[h.getNumCols()]; - for (int i = 0; i < h.getNumCols(); i++) { - heading[i] = h.getText(i); - } - return heading; - } -}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java deleted file mode 100644 index 897d331..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.menus; - -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; - -import javax.swing.*; - -public class MenuBar extends JMenuBar { - - private JMenu fileMenu; - private JMenu queryMenu; - private JMenu helpMenu; - - private JMenuItem queryItem; - private JMenuItem aboutItem; - private JMenuItem clearItem; - private JMenuItem unhideItem; - private JMenuItem exportItem; - private JMenuItem exitItem; - private JMenuItem sortItem; - private JMenuItem advancedItem; - private JMenuItem connectItem; - - public MenuBar(ActionListener windowListener, ActionListener tableListener) { - fileMenu = new JMenu("File"); - fileMenu.setMnemonic(KeyEvent.VK_F); - queryMenu = new JMenu("Query"); - queryMenu.setMnemonic(KeyEvent.VK_Q); - helpMenu = new JMenu("Help"); - - // build help menu - queryItem = new JMenuItem("Query Language"); - queryItem.addActionListener(windowListener); - aboutItem = new JMenuItem("About"); - aboutItem.addActionListener(windowListener); - helpMenu.add(queryItem); - helpMenu.addSeparator(); - helpMenu.add(aboutItem); - - // build query menu - clearItem = new JMenuItem("Clear Query"); - clearItem.addActionListener(windowListener); - advancedItem = new JMenuItem("Query Builder"); - advancedItem.addActionListener(windowListener); - sortItem = new JMenuItem("Sort"); - sortItem.addActionListener(windowListener); - unhideItem = new JMenuItem("Unhide Columns"); - unhideItem.addActionListener(tableListener); - queryMenu.add(unhideItem); - queryMenu.add(advancedItem); - queryMenu.add(sortItem); - queryMenu.addSeparator(); - queryMenu.add(clearItem); - - // build file menu - connectItem = new JMenuItem("Connect..."); - connectItem.addActionListener(windowListener); - exportItem = new JMenuItem("Export Table"); - exportItem.addActionListener(tableListener); - exitItem = new JMenuItem("Exit"); - exitItem.addActionListener(windowListener); - fileMenu.add(connectItem); - fileMenu.add(exportItem); - fileMenu.addSeparator(); - fileMenu.add(exitItem); - - add(fileMenu); - add(queryMenu); - add(helpMenu); - } - - public void changeConnectStatus() { - if (connectItem.getActionCommand().equals("Connect...")) { - connectItem.setActionCommand("Disconnect"); - connectItem.setText("Disconnect"); - } else { - connectItem.setActionCommand("Connect..."); - connectItem.setText("Connect..."); - } - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java deleted file mode 100644 index 0c0f64c..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.menus; - -import java.awt.event.ActionListener; - -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; - -public class RightClickMenu extends JPopupMenu { - - private JMenuItem hideItem; - private JMenuItem unhideItem; - - public RightClickMenu(ActionListener listener) { - - hideItem = new JMenuItem("Hide"); - hideItem.addActionListener(listener); - unhideItem = new JMenuItem("Unhide"); - unhideItem.addActionListener(listener); - - this.add(hideItem); - this.add(unhideItem); - } - - public void setUnhideMode() { - hideItem.setEnabled(false); - unhideItem.setEnabled(true); - } - - public void setHideMode() { - hideItem.setEnabled(true); - unhideItem.setEnabled(false); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java deleted file mode 100644 index 85f1419..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.Color; -import java.awt.Font; - -import javax.swing.BoxLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; - -public class BottomPane extends JPanel { - - public JLabel statusMessage; - - public BottomPane() { - - // set background and panel size - setBackground(Color.WHITE); - EmptyBorder line1 = new EmptyBorder(4, 10, 4, 2); - LineBorder line2 = new LineBorder(Color.BLACK, 1); - EmptyBorder line3 = new EmptyBorder(4, 10, 4, 10); - CompoundBorder cb1 = new CompoundBorder(line1, line2); - CompoundBorder cb2 = new CompoundBorder(cb1, line3); - setBorder(cb2); - - JLabel statusLabel = new JLabel(" Status: "); - statusLabel.setFont(new Font("san-serif", Font.PLAIN, 10)); - - statusMessage = new JLabel(" Disconnected"); - statusMessage.setFont(new Font("san-serif", Font.PLAIN, 10)); - statusMessage.setForeground(Color.RED); - statusMessage.setBackground(Color.WHITE); - - // set layout - setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); - add(statusLabel); - add(statusMessage); - } - - public void changeStatus(String status) { - statusMessage.setText(status); - this.repaint(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java deleted file mode 100644 index e5a29ea..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.LineBorder; - -import org.apache.oodt.cas.filemgr.browser.view.GuiParams; - -public class Cell extends JPanel { - - protected JLabel text; - - public Cell() { - setLayout(new BorderLayout()); - setBackground(Color.WHITE); - setForeground(Color.BLACK); - Dimension size = new Dimension(GuiParams.DEFAULT_CELL_WIDTH, - GuiParams.DEFAULT_CELL_HEIGHT); - setMinimumSize(size); - setMaximumSize(size); - setPreferredSize(size); - setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); - - text = new JLabel(""); - Font f = new Font("san-sarif", Font.PLAIN, 10); - text.setFont(f); - this.add(text, BorderLayout.CENTER); - } - - public void setText(String newText) { - text.setText(newText); - } - - public String getText() { - return text.getText(); - } - - public void setWidth(int newWidth) { - Dimension size = this.getSize(); - size.width = newWidth; - this.setSize(size); - text.setSize(size); - } - - public void setHeight(int newHeight) { - Dimension size = this.getSize(); - size.height = newHeight; - this.setSize(size); - text.setSize(size); - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java deleted file mode 100644 index 50c8453..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import org.apache.oodt.cas.filemgr.browser.view.GuiParams; - -import java.awt.*; -import java.awt.event.MouseListener; - -public class HeaderCell extends Cell { - - private int colNum; - - public HeaderCell(MouseListener listener, int colNum) { - super(); - this.setBackground(Color.LIGHT_GRAY); - this.setBorder(null); - Dimension size = new Dimension(GuiParams.DEFAULT_CELL_WIDTH - 2, - GuiParams.DEFAULT_CELL_HEIGHT); - setMinimumSize(size); - setMaximumSize(size); - setPreferredSize(size); - Font f = new Font("san-serif", Font.BOLD, 11); - text.setFont(f); - - this.colNum = colNum; - this.addMouseListener(listener); - } - - public int getColNum() { - return colNum; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java deleted file mode 100644 index 6980edf..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.Color; -import java.awt.event.MouseListener; - -import javax.swing.BoxLayout; -import javax.swing.JPanel; - -public class HeaderRow extends JPanel { - - private HeaderCell cells[]; - private int numCells; - - public HeaderRow(MouseListener listener, int numCells) { - // create cells - this.numCells = numCells; - cells = new HeaderCell[numCells]; - for (int i = 0; i < numCells; i++) { - cells[i] = new HeaderCell(listener, i); - } - - // set background, etc. - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); - - for (int i = 0; i < numCells; i++) { - this.add(cells[i]); - this.add(new HeaderSpacer(listener, i)); - } - } - - public int getNumCols() { - return numCells; - } - - public void hideCol(int colNum) { - int trueNum = colNum * 2; - HeaderCell c = (HeaderCell) this.getComponent(trueNum); - c.setVisible(false); - HeaderSpacer sp = (HeaderSpacer) this.getComponent(trueNum + 1); - sp.setVisible(false); - } - - public void unhideCol(int colNum) { - int trueNum = colNum * 2; - HeaderCell c = (HeaderCell) this.getComponent(trueNum); - c.setVisible(true); - HeaderSpacer sp = (HeaderSpacer) this.getComponent(trueNum + 1); - sp.setVisible(true); - } - - public void setText(int colNum, String text) { - int trueNum = colNum * 2; - HeaderCell c = (HeaderCell) this.getComponent(trueNum); - c.setText(text); - c.repaint(); - } - - public String getText(int colNum) { - int trueNum = colNum * 2; - HeaderCell c = (HeaderCell) this.getComponent(trueNum); - return c.getText(); - } - - public int getWidth(int colNum) { - int trueNum = colNum * 2; - HeaderCell c = (HeaderCell) this.getComponent(trueNum); - return c.getWidth(); - } - - public void changeWidth(int colNum, int newWidth) { - int trueNum = colNum * 2; - HeaderCell c = (HeaderCell) this.getComponent(trueNum); - int change = c.getWidth() - newWidth; - c.setWidth(newWidth); - for (int i = trueNum + 1; i < this.getComponentCount(); i++) { - this.getComponent(i).setLocation(this.getComponent(i).getX() - change, - this.getComponent(i).getY()); - } - this.repaint(); - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java deleted file mode 100644 index e8f8f19..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.MouseListener; - -import javax.swing.JPanel; - -import org.apache.oodt.cas.filemgr.browser.view.GuiParams; - -public class HeaderSpacer extends JPanel { - - private int col; - - public HeaderSpacer(MouseListener listener, int pos) { - // set background, size - this.setBackground(Color.WHITE); - Dimension d = new Dimension(2, GuiParams.DEFAULT_CELL_HEIGHT); - this.setMinimumSize(d); - this.setMaximumSize(d); - this.setPreferredSize(d); - - col = pos; - this.addMouseListener(listener); - } - - public int getColNum() { - return col; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java deleted file mode 100644 index 35f4ed2..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.BorderLayout; -import java.awt.Color; - -import javax.swing.JPanel; -import javax.swing.JScrollPane; - -import org.apache.oodt.cas.filemgr.browser.controller.TableListener; - -public class MiddlePane extends JPanel { - - public TablePane tPane; - - public MiddlePane() { - this.setBackground(Color.WHITE); - this.setLayout(new BorderLayout()); - - tPane = new TablePane(); - - JPanel inset = new JPanel(); - inset.setBackground(Color.WHITE); - inset.setLayout(new BorderLayout()); - inset.add(tPane, BorderLayout.WEST); - - JScrollPane scrollPane = new JScrollPane(inset); - - this.add(scrollPane, BorderLayout.CENTER); - } - - public TableListener getListener() { - return tPane.getListener(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java deleted file mode 100644 index a707ec7..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.*; - -public class QueryField extends JPanel implements ActionListener { - - private JTextField text; - private JButton button; - private JComboBox types; - - public QueryField(ActionListener listener) { - - // setbackground an size for panel - setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); - setBackground(Color.WHITE); - setMinimumSize(new Dimension(500, 50)); - setPreferredSize(new Dimension(500, 50)); - - text = new JTextField(30); - button = new JButton("Search"); - String[] blankType = { "" }; - types = new JComboBox(blankType); - - // set background and size for textbox and combo - text.setForeground(Color.BLACK); - text.setBackground(Color.WHITE); - text.setMinimumSize(new Dimension(100, 25)); - text.setPreferredSize(new Dimension(100, 25)); - text.setMaximumSize(new Dimension(100, 25)); - text.addActionListener(this); - Dimension typeDim = new Dimension(100, 25); - types.setMaximumSize(typeDim); - types.setMinimumSize(typeDim); - types.setPreferredSize(typeDim); - types.setBackground(Color.WHITE); - - // set button - button.setBackground(Color.WHITE); - button.addActionListener(listener); - button.setName("Query"); - - add(new JLabel("ProductType: ")); - add(types); - add(new JLabel(" Query: ")); - add(text); - add(button); - } - - public String getQueryString() { - return text.getText(); - } - - public void clearQuery() { - text.setText(""); - } - - public String getProductType() { - return types.getSelectedItem().toString(); - } - - public void updateTypes(String[] typeNames) { - this.remove(types); - types = new JComboBox(typeNames); - types.setBackground(Color.WHITE); - Dimension typeDim = new Dimension(100, 25); - types.setMaximumSize(typeDim); - types.setMinimumSize(typeDim); - types.setPreferredSize(typeDim); - add(types, 1); - this.repaint(); - } - - public void actionPerformed(ActionEvent arg0) { - button.doClick(); - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java deleted file mode 100644 index eb8821a..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import org.apache.oodt.cas.filemgr.browser.view.GuiParams; - -import java.awt.*; -import java.awt.event.ActionListener; - -import javax.swing.*; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; - -public class QueryPane extends JPanel { - - private QueryField field; - - public QueryPane(ActionListener listener) { - super(new BorderLayout()); - - // set background and panel size - setBackground(Color.WHITE); - Dimension paneSize = new Dimension(); - paneSize.width = GuiParams.WINDOW_WIDTH; - paneSize.height = (int) (GuiParams.WINDOW_HEIGHT * (0.1)); - - // set border - EmptyBorder line1 = new EmptyBorder(2, 10, 2, 2); - LineBorder line2 = new LineBorder(Color.BLACK, 1); - CompoundBorder cp = new CompoundBorder(line1, line2); - this.setBorder(cp); - - // add query field to pane - field = new QueryField(listener); - add(field, BorderLayout.EAST); - } - - public String getQuery() { - return field.getQueryString(); - } - - public void clearQuery() { - field.clearQuery(); - } - - public String getType() { - return field.getProductType(); - } - - public void updateTypes(String[] types) { - field.updateTypes(types); - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java deleted file mode 100644 index d127180..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import java.awt.Color; - -import javax.swing.BoxLayout; -import javax.swing.JPanel; - -public class Row extends JPanel { - - private Cell cells[]; - - public Row(int numCells) { - // create cells - cells = new Cell[numCells]; - for (int i = 0; i < numCells; i++) { - cells[i] = new Cell(); - cells[i].setText(""); - } - - // set background, etc. - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); - - for (int i = 0; i < numCells; i++) { - this.add(cells[i]); - } - } - - public void hideCol(int colNum) { - Cell c = (Cell) this.getComponent(colNum); - c.setVisible(false); - } - - public void unhideCol(int colNum) { - Cell c = (Cell) this.getComponent(colNum); - c.setVisible(true); - } - - public void setText(int colNum, String text) { - Cell c = (Cell) this.getComponent(colNum); - c.setText(text); - c.repaint(); - } - - public String getText(int colNum) { - Cell c = (Cell) this.getComponent(colNum); - return c.getText(); - } - - public int getWidth(int colNum) { - Cell c = (Cell) this.getComponent(colNum); - return c.getWidth(); - } - - public void changeWidth(int colNum, int newWidth) { - Cell c = (Cell) this.getComponent(colNum); - int change = c.getWidth() - newWidth; - c.setWidth(newWidth); - for (int i = colNum + 1; i < this.getComponentCount(); i++) { - this.getComponent(i).setLocation(this.getComponent(i).getX() - change, - this.getComponent(i).getY()); - } - this.repaint(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java deleted file mode 100644 index 3c06a60..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.oodt.cas.filemgr.browser.view.panels; - -import org.apache.oodt.cas.filemgr.browser.controller.TableListener; - -import java.awt.*; -import java.util.Vector; - -import javax.swing.*; -import javax.swing.border.LineBorder; - -public class TablePane extends JPanel{ - - public Vector<Integer> hiddenCols; - public HeaderRow header; - - private TableListener listener; - - public TablePane(){ - listener = new TableListener(this); - - hiddenCols = new Vector<Integer>(); - setBackground(Color.WHITE); - LineBorder line1 = new LineBorder(Color.WHITE,10); - setBorder(line1); - - setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS)); - - this.setBlank(); - } - - public TableListener getListener(){ - return listener; - } - - public void setBlank(){ - this.removeAll(); - int numColumns = 10; - int numRows = 20; - header = new HeaderRow(listener,numColumns); - add(header); - - for(int i=0;i<numRows;i++){ - Row r = new Row(numColumns); - add(r); - } - - this.validate(); - this.repaint(); - } - - public void newTable(String[][] data){ - this.removeAll(); - if(data.length>1){ - header = new HeaderRow(listener,data[0].length); - for(int j=0;j<data[0].length;j++){ - header.setText(j, data[0][j]); - } - this.add(header); - - for(int j=1;j<data.length;j++){ - Row r = new Row(data[0].length); - for(int k=0;k<data[0].length;k++){ - r.setText(k, data[j][k]); - } - this.add(r); - } - } - this.validate(); - this.repaint(); - } - - public HeaderRow getHeader(){ - return header; - } - - public void sortRows(int col, String sortType){ - int length = this.getComponentCount(); - int i,j; - - for (i=length; --i >=1;) { - for (j=1; j<i;j++) { - Row jThRow = (Row)this.getComponent(j); - Row iThRow = (Row)this.getComponent(i); - if(sortType.equals("Accending")){ - if(jThRow.getText(col).compareTo(iThRow.getText(col))>0){ - swapRows(j,j+1); - } - } else { - if(jThRow.getText(col).compareTo(iThRow.getText(col))<0){ - swapRows(j,j+1); - } - } - } - } - this.validate(); - this.repaint(); - - } - - public void swapRows(int index1, int index2){ - Component c1 = this.getComponent(index1); - Component c2 = this.getComponent(index2); - this.add(c1, index2); - this.add(c2, index1); - } - - public Row getRow(int num){ - Row r = null; - if(num<this.getComponentCount()-1){ - r = (Row)this.getComponent(num+1); - } - return r; - } - - public void hideColumn(int colNum){ - header.hideCol(colNum); - for(int i=1;i<this.getComponentCount();i++){ - ((Row)this.getComponent(i)).hideCol(colNum); - } - hiddenCols.add(colNum); - } - - public void unhideColumn(int colNum){ - header.unhideCol(colNum); - for(int i=1;i<this.getComponentCount();i++){ - ((Row)this.getComponent(i)).unhideCol(colNum); - } - hiddenCols.remove(Integer.valueOf(colNum)); - - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java deleted file mode 100644 index e95c50a..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.prompts; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.*; -import javax.swing.border.EmptyBorder; - -public class ConnectPrompt extends JFrame implements ActionListener { - - private CASField topPanel; - private ConnectButton bottomPanel; - - public ConnectPrompt(ActionListener listener) { - this.setName("New Connection"); - this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - Dimension d = new Dimension(400, 100); - this.setMinimumSize(d); - this.setMaximumSize(d); - this.setPreferredSize(d); - - this.getContentPane().setLayout( - new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); - this.getContentPane().setBackground(Color.WHITE); - - topPanel = new CASField(this); - bottomPanel = new ConnectButton(listener); - this.add(topPanel); - this.add(bottomPanel); - } - - public String getCASUrl() { - return topPanel.casRef.getText(); - } - - private class CASField extends JPanel { - - protected JTextField casRef; - - protected CASField(ActionListener listener) { - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); - Dimension d = new Dimension(400, 30); - this.setMaximumSize(d); - this.setMinimumSize(d); - this.setPreferredSize(d); - - EmptyBorder line1 = new EmptyBorder(5, 10, 5, 5); - this.setBorder(line1); - - this.add(new JLabel("CAS File Manager URL: ")); - casRef = new JTextField(); - casRef.addActionListener(listener); - this.add(casRef); - } - } - - private class ConnectButton extends JPanel { - - protected JButton connect; - protected JButton cancel; - - protected ConnectButton(ActionListener listener) { - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); - - EmptyBorder line1 = new EmptyBorder(5, 20, 5, 5); - this.setBorder(line1); - - this.add(new JLabel(" ")); - connect = new JButton("Connect"); - connect.setBackground(Color.WHITE); - connect.addActionListener(listener); - cancel = new JButton("Cancel"); - cancel.setBackground(Color.WHITE); - cancel.addActionListener(listener); - cancel.setName("ConnectCancel"); - this.add(cancel); - this.add(connect); - } - } - - public void actionPerformed(ActionEvent arg0) { - bottomPanel.connect.doClick(); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java deleted file mode 100644 index 49ab623..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java +++ /dev/null @@ -1,444 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.prompts; - -import org.apache.oodt.cas.filemgr.browser.controller.WindowListener; -import org.apache.oodt.cas.filemgr.browser.model.CasDB; -import org.apache.oodt.cas.filemgr.structs.RangeQueryCriteria; -import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; - -import javax.swing.*; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; - -public class QueryBuilderPrompt extends JFrame { - - protected CasDB database; - protected WindowListener listener; - - protected TypePanel tPanel; - protected QuerySelectionPanel qPanel; - protected JScrollPane scrollPane; - protected BuiltQueryPane builtPanel; - protected SearchPanel sPanel; - - public QueryBuilderPrompt(CasDB db, WindowListener l) { - - database = db; - listener = l; - - this.setName("Query Builder"); - this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - Dimension d = new Dimension(500, 400); - this.setMinimumSize(d); - this.setMaximumSize(d); - this.setPreferredSize(d); - - this.getContentPane().setLayout( - new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); - this.getContentPane().setBackground(Color.WHITE); - - tPanel = new TypePanel(this); - qPanel = new QuerySelectionPanel(this); - sPanel = new SearchPanel(this); - builtPanel = new BuiltQueryPane(this); - - scrollPane = new JScrollPane(qPanel); - Dimension scrollDim = new Dimension(500, 220); - scrollPane.setMaximumSize(scrollDim); - scrollPane.setMinimumSize(scrollDim); - scrollPane.setPreferredSize(scrollDim); - - this.getContentPane().add(tPanel); - this.getContentPane().add(scrollPane); - this.getContentPane().add(builtPanel); - this.getContentPane().add(sPanel); - } - - public org.apache.oodt.cas.filemgr.structs.Query getQuery() { - return qPanel.getCasQuery(); - } - - public String getQueryString() { - return qPanel.getQuery(); - } - - public String getProductType() { - return tPanel.getType(); - } - - private class QueryPanel extends JPanel { - - private JComboBox elements; - private JComboBox ops; - private JPanel placeholder; - private boolean showOp; - - public QueryPanel(QueryBuilderPrompt prompt) { - Dimension d = new Dimension(460, 35); - this.setMaximumSize(d); - this.setMinimumSize(d); - this.setPreferredSize(d); - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); - - showOp = false; - ops = new JComboBox(new String[] { "AND", "OR", "NOT" }); - Dimension opsDim = new Dimension(75, 25); - ops.setMaximumSize(opsDim); - ops.setMinimumSize(opsDim); - ops.setPreferredSize(opsDim); - ops.setBackground(Color.WHITE); - ops.setVisible(false); - - placeholder = new JPanel(); - placeholder.setBackground(Color.WHITE); - placeholder.setMaximumSize(opsDim); - placeholder.setMinimumSize(opsDim); - placeholder.setPreferredSize(opsDim); - - elements = new JComboBox(prompt.database - .getAvailableElements(prompt.tPanel.getType())); - elements.setBackground(Color.WHITE); - Dimension dElem = new Dimension(150, 25); - elements.setMaximumSize(dElem); - elements.setMinimumSize(dElem); - elements.setPreferredSize(dElem); - - this.add(ops); - this.add(placeholder); - this.add(elements); - } - - public void addOp() { - showOp = true; - ops.setVisible(true); - placeholder.setVisible(false); - } - - public String getElement() { - return elements.getSelectedItem().toString(); - } - - public String getOp() { - String op = ""; - if (showOp) { - op = ops.getSelectedItem().toString(); - } - return op; - } - } - - private class TermQueryPanel extends QueryPanel { - - private JTextField text; - - public TermQueryPanel(QueryBuilderPrompt prompt) { - super(prompt); - - text = new JTextField(); - Dimension dText = new Dimension(150, 25); - text.setPreferredSize(dText); - text.setMaximumSize(dText); - text.setMinimumSize(dText); - text.setBackground(Color.WHITE); - text.addFocusListener(prompt.builtPanel); - text.addActionListener(prompt.builtPanel); - - this.add(new JLabel(" Matches ")); - this.add(text); - } - - public String getText() { - return text.getText(); - } - - } - - private class RangeQueryPanel extends QueryPanel { - - private JTextField start; - private JTextField stop; - - public RangeQueryPanel(QueryBuilderPrompt prompt) { - super(prompt); - - start = new JTextField(); - stop = new JTextField(); - - Dimension dText = new Dimension(60, 25); - start.setMaximumSize(dText); - start.setMinimumSize(dText); - start.setPreferredSize(dText); - start.addFocusListener(prompt.builtPanel); - start.addActionListener(prompt.builtPanel); - - stop.setMaximumSize(dText); - stop.setMinimumSize(dText); - stop.setPreferredSize(dText); - stop.addFocusListener(prompt.builtPanel); - stop.addActionListener(prompt.builtPanel); - - this.add(new JLabel(" Between ")); - this.add(start); - this.add(new JLabel(" And ")); - this.add(stop); - } - - public String getStart() { - return start.getText(); - } - - public String getStop() { - return stop.getText(); - } - - } - - private class QuerySelectionPanel extends JPanel implements ActionListener { - - private JButton addTerm; - private JButton addRange; - private QueryBuilderPrompt prompt; - - public QuerySelectionPanel(QueryBuilderPrompt prompt) { - this.prompt = prompt; - this.setBackground(Color.WHITE); - - EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2); - LineBorder line2 = new LineBorder(Color.BLACK, 1); - CompoundBorder cp = new CompoundBorder(line1, line2); - this.setBorder(cp); - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - JPanel buttonPanel = new JPanel(); - Dimension buttonDim = new Dimension(460, 30); - buttonPanel.setMaximumSize(buttonDim); - buttonPanel.setMinimumSize(buttonDim); - buttonPanel.setPreferredSize(buttonDim); - buttonPanel.setBackground(Color.WHITE); - buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - - addTerm = new JButton("Add Term Criteria"); - addTerm.setBackground(Color.WHITE); - addTerm.addActionListener(this); - - addRange = new JButton("Add Range Criteria"); - addRange.setBackground(Color.WHITE); - addRange.addActionListener(this); - - buttonPanel.add(addTerm); - buttonPanel.add(addRange); - this.add(buttonPanel); - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getActionCommand().equals("Add Term Criteria")) { - TermQueryPanel tq = new TermQueryPanel(prompt); - if (this.getComponentCount() > 1) { - tq.addOp(); - } - int insertOrder = this.getComponentCount() - 1; - if (insertOrder < 0) { - insertOrder = 0; - } - this.add(tq, insertOrder); - this.validate(); - prompt.scrollPane.validate(); - } else if (arg0.getActionCommand().equals("Add Range Criteria")) { - RangeQueryPanel rq = new RangeQueryPanel(prompt); - if (this.getComponentCount() > 1) { - rq.addOp(); - } - int insertOrder = this.getComponentCount() - 1; - if (insertOrder < 0) { - insertOrder = 0; - } - this.add(rq, insertOrder); - this.validate(); - prompt.scrollPane.validate(); - } - } - - public String getQuery() { - StringBuilder q = new StringBuilder(); - for (int i = 0; i < this.getComponentCount(); i++) { - Component c = this.getComponent(i); - if (c instanceof TermQueryPanel) { - q.append(((TermQueryPanel) c).getOp()).append(" "); - q.append(((TermQueryPanel) c).getElement()).append(":"); - q.append(((TermQueryPanel) c).getText()).append(" "); - } else if (c instanceof RangeQueryPanel) { - q.append(((RangeQueryPanel) c).getOp()).append(" "); - q.append(((RangeQueryPanel) c).getElement()).append(":["); - q.append(((RangeQueryPanel) c).getStart()).append(" TO "); - q.append(((RangeQueryPanel) c).getStop()).append("] "); - } - } - - return q.toString(); - } - - public org.apache.oodt.cas.filemgr.structs.Query getCasQuery() { - org.apache.oodt.cas.filemgr.structs.Query q = new org.apache.oodt.cas.filemgr.structs.Query(); - for (int i = 0; i < this.getComponentCount(); i++) { - Component c = this.getComponent(i); - String element; - if (c instanceof TermQueryPanel) { - element = database.getElementID(((TermQueryPanel) c).getElement()); - String criteria = ((TermQueryPanel) c).getText(); - if (!element.equals("") && !criteria.equals("")) { - TermQueryCriteria tc = new TermQueryCriteria(); - tc.setElementName(element); - tc.setValue(criteria); - q.addCriterion(tc); - } - } else if (c instanceof RangeQueryPanel) { - element = database.getElementID(((RangeQueryPanel) c).getElement()); - String startCriteria = ((RangeQueryPanel) c).getStart(); - String stopCriteria = ((RangeQueryPanel) c).getStop(); - if (!element.equals("") && !startCriteria.equals("") - && !stopCriteria.equals("")) { - RangeQueryCriteria rt = new RangeQueryCriteria(); - rt.setElementName(element); - rt.setStartValue(startCriteria); - rt.setEndValue(stopCriteria); - q.addCriterion(rt); - } - } - } - - return q; - } - - } - - private class SearchPanel extends JPanel { - private JButton search; - - public SearchPanel(QueryBuilderPrompt prompt) { - Dimension d = new Dimension(500, 40); - this.setMaximumSize(d); - this.setMinimumSize(d); - this.setPreferredSize(d); - EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2); - LineBorder line2 = new LineBorder(Color.BLACK, 1); - CompoundBorder cp = new CompoundBorder(line1, line2); - this.setBorder(cp); - this.setLayout(new BorderLayout()); - this.setBackground(Color.WHITE); - - search = new JButton("Search"); - search.setName("AdvancedQuery"); - search.addActionListener(prompt.listener); - search.setBackground(Color.WHITE); - - JPanel buttonPanel = new JPanel(); - buttonPanel.setBackground(Color.WHITE); - buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - buttonPanel.add(search); - this.add(buttonPanel, BorderLayout.EAST); - } - - } - - private class TypePanel extends JPanel { - - private JComboBox types; - - public TypePanel(QueryBuilderPrompt prompt) { - - Dimension d = new Dimension(500, 40); - this.setMaximumSize(d); - this.setMinimumSize(d); - this.setPreferredSize(d); - EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2); - LineBorder line2 = new LineBorder(Color.BLACK, 1); - CompoundBorder cp = new CompoundBorder(line1, line2); - this.setBorder(cp); - - types = new JComboBox(database.getAvailableTypes()); - types.setBackground(Color.WHITE); - Dimension tDim = new Dimension(200, 30); - types.setMaximumSize(tDim); - types.setMinimumSize(tDim); - types.setPreferredSize(tDim); - - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); - - JLabel label = new JLabel(" Product Type: "); - - this.add(label); - this.add(types); - } - - public String getType() { - return types.getSelectedItem().toString(); - } - } - - private class BuiltQueryPane extends JPanel implements FocusListener, - ActionListener { - - private QueryBuilderPrompt p; - private JTextArea field; - - public BuiltQueryPane(QueryBuilderPrompt prompt) { - - Dimension d = new Dimension(500, 75); - this.setMaximumSize(d); - this.setMinimumSize(d); - this.setPreferredSize(d); - - EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2); - LineBorder line2 = new LineBorder(Color.BLACK, 1); - CompoundBorder cp = new CompoundBorder(line1, line2); - this.setBorder(cp); - this.setLayout(new BorderLayout()); - - field = new JTextArea(); - Font font = new Font("san-serif", Font.PLAIN, 10); - field.setFont(font); - field.setBackground(Color.WHITE); - field.setLineWrap(true); - field.setWrapStyleWord(true); - - this.add(field, BorderLayout.CENTER); - } - - public void focusGained(FocusEvent arg0) { - } - - public void focusLost(FocusEvent arg0) { - field.setText(qPanel.getQuery()); - } - - public void actionPerformed(ActionEvent arg0) { - field.setText(qPanel.getQuery()); - } - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java deleted file mode 100644 index 5da550b..0000000 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.filemgr.browser.view.prompts; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionListener; - -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; - -import org.apache.oodt.cas.filemgr.browser.view.MainWindow; - -public class SortPrompt extends JFrame { - - private ColumnPanel cPanel; - private ConnectButton cButtons; - - public SortPrompt(MainWindow window, ActionListener listener) { - this.setName("Sort"); - this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - Dimension d = new Dimension(350, 150); - this.setMinimumSize(d); - this.setMaximumSize(d); - this.setPreferredSize(d); - - this.getContentPane().setLayout( - new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); - this.getContentPane().setBackground(Color.WHITE); - - cPanel = new ColumnPanel(window); - cButtons = new ConnectButton(listener); - this.add(cPanel); - this.add(cButtons); - } - - public int getSortIndex() { - return cPanel.getSortIndex(); - } - - public String getSortType() { - return cPanel.getSortType(); - } - - protected class ColumnPanel extends JPanel { - - protected JComboBox ColChoices; - protected JComboBox SortChoices; - protected JButton cancel; - protected JButton ok; - - public ColumnPanel(MainWindow window) { - ColChoices = new JComboBox(window.getColHeaders()); - ColChoices.setSelectedIndex(0); - ColChoices.setBackground(Color.WHITE); - String[] sortPatterns = { "Accending", "Descending" }; - SortChoices = new JComboBox(sortPatterns); - SortChoices.setSelectedIndex(0); - SortChoices.setBackground(Color.WHITE); - - Dimension choicesDim = new Dimension(200, 20); - ColChoices.setMinimumSize(choicesDim); - ColChoices.setMaximumSize(choicesDim); - ColChoices.setPreferredSize(choicesDim); - SortChoices.setMinimumSize(choicesDim); - SortChoices.setMaximumSize(choicesDim); - SortChoices.setPreferredSize(choicesDim); - - this.setBackground(Color.WHITE); - this.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - - EmptyBorder line1 = new EmptyBorder(5, 10, 5, 5); - this.setBorder(line1); - - c.gridx = 0; - c.gridy = 0; - c.ipadx = 10; - c.ipady = 10; - this.add(new JLabel("Sort By: "), c); - - c.gridx = 1; - c.gridy = 0; - this.add(ColChoices, c); - - c.gridx = 0; - c.gridy = 1; - this.add(new JLabel("In Order: "), c); - - c.gridx = 1; - c.gridy = 1; - this.add(SortChoices, c); - - } - - public int getSortIndex() { - return ColChoices.getSelectedIndex(); - } - - public String getSortType() { - return SortChoices.getSelectedItem().toString(); - } - - } - - private class ConnectButton extends JPanel { - - protected JButton connect; - protected JButton cancel; - - protected ConnectButton(ActionListener listener) { - this.setBackground(Color.WHITE); - this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); - - EmptyBorder line1 = new EmptyBorder(5, 20, 5, 5); - this.setBorder(line1); - - this.add(new JLabel(" ")); - connect = new JButton("OK"); - connect.setBackground(Color.WHITE); - connect.addActionListener(listener); - cancel = new JButton("Cancel"); - cancel.setBackground(Color.WHITE); - cancel.addActionListener(listener); - cancel.setName("SortCancel"); - this.add(cancel); - this.add(connect); - } - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/.gitignore ---------------------------------------------------------------------- diff --git a/app/weditor/.gitignore b/app/weditor/.gitignore deleted file mode 100644 index b54523f..0000000 --- a/app/weditor/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/maven-eclipse.xml http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/pom.xml ---------------------------------------------------------------------- diff --git a/app/weditor/pom.xml b/app/weditor/pom.xml deleted file mode 100644 index 107e4a4..0000000 --- a/app/weditor/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one or more contributor -license agreements. See the NOTICE.txt file distributed with this work for -additional information regarding copyright ownership. The ASF licenses this -file to you under the Apache License, Version 2.0 (the "License"); you may not -use this file except in compliance with the License. You may obtain a copy of -the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations under -the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.oodt</groupId> - <artifactId>oodt-core</artifactId> - <version>1.1-SNAPSHOT</version> - <relativePath>../../core/pom.xml</relativePath> - </parent> - <artifactId>weditor</artifactId> - <name>Catalog and Archive Workflow Management GUI Editor</name> - <description>Apache OODT Workflow Editor GUI</description> - <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact. - Once the dependency is in the core pom, it can then be used in other modules without the version tags. - For example, within core/pom.xml: - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk</artifactId> - <version>1.7.4</version> - </dependency> - - Elsewhere in the platform: - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk</artifactId> - </dependency> - - Where possible the same dependency version should be used across the whole platform but if required the version - can be overridden in a specific pom and should have a comment explaing why the version has been overridden - --> - <dependencies> - <dependency> - <groupId>jgraph</groupId> - <artifactId>jgraph</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.sf.jung</groupId> - <artifactId>jung-algorithms</artifactId> - </dependency> - <dependency> - <groupId>net.sf.jung</groupId> - <artifactId>jung-api</artifactId> - </dependency> - <dependency> - <groupId>net.sf.jung</groupId> - <artifactId>jung-graph-impl</artifactId> - </dependency> - <dependency> - <groupId>net.sf.jung</groupId> - <artifactId>jung-visualization</artifactId> - </dependency> - <dependency> - <groupId>org.apache.oodt</groupId> - <artifactId>cas-workflow</artifactId> - </dependency> - </dependencies> - <build> - <resources> - <resource> - <targetPath>org/apache/oodt/cas/workflow/gui/util</targetPath> - <directory>${basedir}/src/main/resources/icons</directory> - <includes> - <include>**</include> - </includes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>2.2-beta-2</version> - <configuration> - <descriptors> - <descriptor>src/main/assembly/assembly.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <goals> - <goal>single</goal> - </goals> - <phase>package</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/assembly/assembly.xml ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/assembly/assembly.xml b/app/weditor/src/main/assembly/assembly.xml deleted file mode 100644 index f64863d..0000000 --- a/app/weditor/src/main/assembly/assembly.xml +++ /dev/null @@ -1,72 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<assembly> - <id>dist</id> - <formats> - <format>tar.gz</format> - <format>zip</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <baseDirectory>${project.artifactId}-${project.version}</baseDirectory> - <includeSiteDirectory>false</includeSiteDirectory> - <fileSets> - <fileSet> - <directory>${basedir}</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>LICENSE.txt</include> - <include>CHANGES.txt</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/bin</directory> - <outputDirectory>bin</outputDirectory> - <includes/> - <fileMode>755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>etc</outputDirectory> - <includes> - <include>**.properties</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>logs</outputDirectory> - <includes> - <include>REMOVE.log</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources/examples</directory> - <outputDirectory>workspace</outputDirectory> - <includes> - <include>**</include> - </includes> - </fileSet> - </fileSets> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - <unpack>false</unpack> - <useProjectArtifact>true</useProjectArtifact> - <useTransitiveDependencies>true</useTransitiveDependencies> - <unpackOptions/> - </dependencySet> - </dependencySets> -</assembly> http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/bin/weditor ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/bin/weditor b/app/weditor/src/main/bin/weditor deleted file mode 100644 index c17df0e..0000000 --- a/app/weditor/src/main/bin/weditor +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/csh -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -${JAVA_HOME}/bin/java \ - -Djava.ext.dirs=../lib \ - -Djava.util.logging.config.file=../etc/logging.properties \ - org.apache.oodt.cas.workflow.gui.WorkflowGUI - - http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java deleted file mode 100644 index 1676a26..0000000 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java +++ /dev/null @@ -1,325 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.workflow.gui; - -//Commons import - -import org.apache.commons.lang.StringUtils; -import org.apache.oodt.cas.workflow.gui.menu.EditMenu; -import org.apache.oodt.cas.workflow.gui.menu.FileMenu; -import org.apache.oodt.cas.workflow.gui.model.ModelGraph; -import org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepository; -import org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepositoryFactory; -import org.apache.oodt.cas.workflow.gui.perspective.MultiStatePerspective; -import org.apache.oodt.cas.workflow.gui.perspective.build.BuildPerspective; -import org.apache.oodt.cas.workflow.gui.perspective.view.View; -import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState; -import org.apache.oodt.cas.workflow.gui.toolbox.Tool; -import org.apache.oodt.cas.workflow.gui.toolbox.ToolBox; -import org.apache.oodt.cas.workflow.gui.util.IconLoader; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Vector; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JMenuBar; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -//OODT imports -//JDK imports - -/** - * - * - * Main driver shell and JFrame for the Workflow Editor GUI. - * - * @author bfoster - * @author mattmann - * - */ -public class WorkflowGUI extends JFrame { - private static Logger LOG = Logger.getLogger(WorkflowGUI.class.getName()); - private static final long serialVersionUID = -8217540440195126377L; - - private ToolBox toolbox; - - private MultiStatePerspective perspective; - - private static AtomicInteger untitledIter = new AtomicInteger(0); - - private JMenuBar menu; - - private File workspace; - - private XmlWorkflowModelRepository repo; - - public WorkflowGUI() throws IOException, IllegalAccessException, InstantiationException { - - this.addWindowFocusListener(new WindowFocusListener() { - - public void windowGainedFocus(WindowEvent e) { - if (menu != null) { - menu.revalidate(); - } - if (toolbox != null) { - toolbox.revalidate(); - } - if (perspective != null) { - perspective.refresh(); - } - } - - public void windowLostFocus(WindowEvent e) { - } - - }); - - this.setLayout(new BorderLayout()); - this.setPreferredSize(new Dimension(1000, 800)); - - Vector<Tool> tools = new Vector<Tool>(); - Tool editTool = new Tool(IconLoader.getIcon(IconLoader.EDIT), - IconLoader.getIcon(IconLoader.EDIT_SELECTED)) { - private static final long serialVersionUID = 1682845263796161282L; - - @Override - public void onClick() { - WorkflowGUI.this.perspective.setMode(View.Mode.EDIT); - } - }; - tools.add(editTool); - Tool deleteTool = new Tool(IconLoader.getIcon(IconLoader.DELETE), - IconLoader.getIcon(IconLoader.DELETE_SELECTED)) { - private static final long serialVersionUID = 5050127713254634783L; - - @Override - public void onClick() { - WorkflowGUI.this.perspective.setMode(View.Mode.DELETE); - } - }; - tools.add(deleteTool); - Tool moveTool = new Tool(IconLoader.getIcon(IconLoader.MOVE), - IconLoader.getIcon(IconLoader.MOVE_SELECTED)) { - private static final long serialVersionUID = 1682845263796161282L; - - @Override - public void onClick() { - WorkflowGUI.this.perspective.setMode(View.Mode.MOVE); - } - }; - tools.add(moveTool); - Tool zoomInTool = new Tool(IconLoader.getIcon(IconLoader.ZOOM_IN), - IconLoader.getIcon(IconLoader.ZOOM_IN_SELECTED)) { - private static final long serialVersionUID = 1682845263796161282L; - - @Override - public void onClick() { - WorkflowGUI.this.perspective.setMode(View.Mode.ZOOM_IN); - } - }; - tools.add(zoomInTool); - Tool zoomOutTool = new Tool(IconLoader.getIcon(IconLoader.ZOOM_OUT), - IconLoader.getIcon(IconLoader.ZOOM_OUT_SELECTED)) { - private static final long serialVersionUID = 1682845263796161282L; - - @Override - public void onClick() { - WorkflowGUI.this.perspective.setMode(View.Mode.ZOOM_OUT); - } - }; - tools.add(zoomOutTool); - toolbox = new ToolBox(tools); - toolbox.setSelected(editTool); - this.add(toolbox, BorderLayout.NORTH); - - this.setJMenuBar(menu = this.generateMenuBar()); - perspective = new BuildPerspective(); - perspective.refresh(); - this.add(perspective, BorderLayout.CENTER); - } - - private void updateWorkspaceText() { - if (this.workspace == null) { - this.setTitle(null); - } else { - this.setTitle(StringUtils.leftPad("Workspace: " + this.workspace, 100)); - } - } - - private void loadProjects() { - try { - XmlWorkflowModelRepositoryFactory factory = new XmlWorkflowModelRepositoryFactory(); - factory.setWorkspace(this.workspace.getAbsolutePath()); - repo = factory.createModelRepository(); - repo.loadGraphs(new HashSet<String>(Arrays.asList("sequential", - "parallel", "task", "condition"))); - for (File file : repo.getFiles()) { - List<ModelGraph> graphs = new Vector<ModelGraph>(); - for (ModelGraph graph : repo.getGraphs()) { - if (graph.getModel().getFile().equals(file)) { - graphs.add(graph); - } - } - System.out.println(graphs); - perspective.addState(new ViewState(file, null, graphs, repo - .getGlobalConfigGroups())); - } - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - - public JMenuBar generateMenuBar() { - JMenuBar bar = new JMenuBar(); - FileMenu fileMenu = new FileMenu(); - bar.add(fileMenu); - fileMenu.getExit().addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent event) { - System.exit(1); - } - }); - - fileMenu.getOpenWorkspace().addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - try { - JFileChooser chooser = new JFileChooser(new File(".")) { - boolean acceptFile(File f) { - return f.isDirectory(); - } - }; - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int value = chooser.showOpenDialog(WorkflowGUI.this); - if (value == JFileChooser.APPROVE_OPTION) { - workspace = chooser.getSelectedFile(); - updateWorkspaceText(); - perspective.reset(); - loadProjects(); - } - } catch (Exception e1) { - e1.printStackTrace(); - } - } - }); - fileMenu.getImport().addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent event) { - try { - if (workspace == null) { - return; - } - JFileChooser chooser = new JFileChooser(new File(".")); - int value = chooser.showOpenDialog(WorkflowGUI.this); - if (value == JFileChooser.APPROVE_OPTION) { - File file = chooser.getSelectedFile(); - XmlWorkflowModelRepositoryFactory factory = new XmlWorkflowModelRepositoryFactory(); - factory.setWorkspace(workspace.getAbsolutePath()); - View activeView = perspective.getActiveView(); - - if (activeView != null) { - // TODO: add code for import - } - } - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - - }); - fileMenu.getNewWorkspace().addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - JFileChooser chooser = new JFileChooser(new File(".")) { - boolean acceptFile(File f) { - return f.isDirectory(); - } - }; - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int value = chooser.showOpenDialog(WorkflowGUI.this); - if (value == JFileChooser.APPROVE_OPTION) { - workspace = chooser.getSelectedFile(); - updateWorkspaceText(); - perspective.reset(); - loadProjects(); - perspective.refresh(); - } - } - }); - - fileMenu.getNewProject().addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - // TODO: add new project code - } - }); - fileMenu.getSave().addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - try { - repo.save(); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - }); - EditMenu editMenu = new EditMenu(); - bar.add(editMenu); - editMenu.getUndo().addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - try { - perspective.undo(); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - }); - bar.revalidate(); - return bar; - } - - public static void main(String[] args) { - UIManager.put("TabbedPane.selected", new Color(238, 238, 238)); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - WorkflowGUI gui; - try { - gui = new WorkflowGUI(); - gui.pack(); - gui.setVisible(true); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - }); - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java deleted file mode 100644 index db10dba..0000000 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.workflow.gui.menu; - -//JDK imports -import javax.swing.JMenu; -import javax.swing.JMenuItem; - -/** - * - * - * Edit menu driver for the Workflow Editor GUI. - * - * @author bfoster - * @author mattmann - * - */ -public class EditMenu extends JMenu { - - private static final long serialVersionUID = -8368744697132421274L; - - private JMenuItem undoItem; - - public EditMenu() { - super("Edit"); - this.add(this.undoItem = new JMenuItem("Undo")); - } - - public JMenuItem getUndo() { - return this.undoItem; - } - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java deleted file mode 100644 index 599a331..0000000 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.oodt.cas.workflow.gui.menu; - -//JDK imports -import javax.swing.JMenu; -import javax.swing.JMenuItem; - -/** - * - * - * File menu driver for the Workflow Editor GUI. - * - * @author bfoster - * @author mattmann - * - */ -public class FileMenu extends JMenu { - - private static final long serialVersionUID = -5702987396916441718L; - - private JMenuItem newWorkspace; - private JMenuItem newProject; - private JMenuItem openWorkspace; - private JMenuItem importItem; - private JMenuItem saveItem; - private JMenuItem exitItem; - private JMenu newMenu, openMenu, importMenu; - - public FileMenu() { - super("File"); - this.add(newMenu = new JMenu("New")); - newMenu.add(this.newWorkspace = new JMenuItem("Workspace")); - newMenu.add(this.newProject = new JMenuItem("Project")); - this.add(openMenu = new JMenu("Open")); - openMenu.add(this.openWorkspace = new JMenuItem("Workspace")); - this.add(importMenu = new JMenu("Import")); - importMenu.add(this.importItem = new JMenuItem("Project")); - this.add(this.saveItem = new JMenuItem("Save Project")); - this.add(this.exitItem = new JMenuItem("Exit")); - } - - public JMenuItem getOpenWorkspace() { - return this.openWorkspace; - } - - public JMenuItem getImport() { - return this.importItem; - } - - public JMenuItem getNewWorkspace() { - return this.newWorkspace; - } - - public JMenuItem getNewProject() { - return this.newProject; - } - - public JMenuItem getSave() { - return this.saveItem; - } - - public JMenuItem getExit(){ - return this.exitItem; - } - -}
