Return-Path: Delivered-To: apmail-incubator-oodt-commits-archive@minotaur.apache.org Received: (qmail 56964 invoked from network); 12 Jul 2010 17:41:23 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Jul 2010 17:41:23 -0000 Received: (qmail 67328 invoked by uid 500); 12 Jul 2010 17:41:23 -0000 Delivered-To: apmail-incubator-oodt-commits-archive@incubator.apache.org Received: (qmail 67315 invoked by uid 500); 12 Jul 2010 17:41:23 -0000 Mailing-List: contact oodt-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oodt-dev@incubator.apache.org Delivered-To: mailing list oodt-commits@incubator.apache.org Received: (qmail 67308 invoked by uid 99); 12 Jul 2010 17:41:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 17:41:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 17:41:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6010A2388A5F; Mon, 12 Jul 2010 17:40:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r963384 [2/2] - in /incubator/oodt/trunk/app/fmbrowser: ./ src/main/java/org/apache/oodt/cas/filemgr/browser/controller/ src/main/java/org/apache/oodt/cas/filemgr/browser/model/ src/main/java/org/apache/oodt/cas/filemgr/browser/system/ src/... Date: Mon, 12 Jul 2010 17:40:22 -0000 To: oodt-commits@incubator.apache.org From: mattmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100712174023.6010A2388A5F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java?rev=963384&r1=963383&r2=963384&view=diff ============================================================================== --- incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java (original) +++ incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java Mon Jul 12 17:40:21 2010 @@ -1,4 +1,4 @@ -/* +/** * 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. @@ -15,7 +15,6 @@ * limitations under the License. */ - package org.apache.oodt.cas.filemgr.browser.view.panels; import java.awt.Color; @@ -23,61 +22,62 @@ 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;i1) 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(){ - String q = new String(); - for(int i=0;i 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() { + String q = new String(); + for (int i = 0; i < this.getComponentCount(); i++) { + Component c = this.getComponent(i); + if (c instanceof TermQueryPanel) { + q += ((TermQueryPanel) c).getOp() + " "; + q += ((TermQueryPanel) c).getElement() + ":"; + q += ((TermQueryPanel) c).getText() + " "; + } else if (c instanceof RangeQueryPanel) { + q += ((RangeQueryPanel) c).getOp() + " "; + q += ((RangeQueryPanel) c).getElement() + ":["; + q += ((RangeQueryPanel) c).getStart() + " TO "; + q += ((RangeQueryPanel) c).getStop() + "] "; + } + } + + return q; + } + + 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()); + } + } + } Modified: incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java?rev=963384&r1=963383&r2=963384&view=diff ============================================================================== --- incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java (original) +++ incubator/oodt/trunk/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java Mon Jul 12 17:40:21 2010 @@ -1,4 +1,4 @@ -/* +/** * 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. @@ -15,7 +15,6 @@ * limitations under the License. */ - package org.apache.oodt.cas.filemgr.browser.view.prompts; import java.awt.Color; @@ -34,121 +33,121 @@ 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); - } - } - +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); + } + } + }