Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 745B4200CD7 for ; Tue, 18 Jul 2017 01:05:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 72DA9165F44; Mon, 17 Jul 2017 23:05:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C9BFF165F24 for ; Tue, 18 Jul 2017 01:05:19 +0200 (CEST) Received: (qmail 49208 invoked by uid 500); 17 Jul 2017 23:05:19 -0000 Mailing-List: contact commits-help@oodt.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@oodt.apache.org Delivered-To: mailing list commits@oodt.apache.org Received: (qmail 49025 invoked by uid 99); 17 Jul 2017 23:05:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jul 2017 23:05:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 44C85F5548; Mon, 17 Jul 2017 23:05:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mattmann@apache.org To: commits@oodt.apache.org Date: Mon, 17 Jul 2017 23:05:33 -0000 Message-Id: <3192fdced1e7494286d087c38371b098@git.apache.org> In-Reply-To: <95eff81647544b1996db031f8290e90b@git.apache.org> References: <95eff81647544b1996db031f8290e90b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [18/88] [abbrv] [partial] oodt git commit: Record change for OODT-836, OODT-837. archived-at: Mon, 17 Jul 2017 23:05:23 -0000 http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java deleted file mode 100644 index 6c1a358..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java +++ /dev/null @@ -1,89 +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.profile; - -import java.io.Serializable; -import java.util.Collections; -import java.util.List; -import org.w3c.dom.Node; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.rdf.model.Resource; -import java.net.URI; - -/** - * A profile element with unspecified values. - - * This is a profile element that is not enumerated (it doesn't have listed values, and so - * <elemEnumFlag> is false), nor does it have minimum or maximum - * values. As such, it always matches any query in which it's involved in an expression. - * - * @author Kelly - */ -public class UnspecifiedProfileElement extends ProfileElement implements Serializable, Cloneable { - /** - * Creates a profile element. - * - * @param profile a Profile value. - */ - public UnspecifiedProfileElement(Profile profile) { - super(profile); - } - - /** - * Create a profile element from constituent attributes. - * - * @param profile Profile to which this element belongs. - * @param name Required name of the element. - * @param id ID of the element. - * @param desc Long description of the element. - * @param type Data type of the element. - * @param unit Units. - * @param synonyms Collection of element IDs ({@link String}) that are synonyms for this element. - * @param obligation True if this is a required element - * @param maxOccurrence Maximum number of occurrences of this element. - * @param comment Any comments about this element. - */ - public UnspecifiedProfileElement(Profile profile, String name, String id, String desc, String type, String unit, - List synonyms, boolean obligation, int maxOccurrence, String comment) { - super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment); - } - - public List getValues() { - return Collections.EMPTY_LIST; - } - - public String getMinValue() { - return ""; - } - - public String getMaxValue() { - return ""; - } - - protected boolean isEnumerated() { - return false; - } - - protected void addValues(Node node) {} - - protected void addElementSpecificProperties(Model model, Resource element, ProfileAttributes profAttr, URI uri) {} - - /** Serial version unique ID. */ - static final long serialVersionUID = -3717582969125927629L; -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/Utility.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/Utility.java b/profile/src/main/java/org/apache/oodt/profile/Utility.java deleted file mode 100644 index 86ac062..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/Utility.java +++ /dev/null @@ -1,254 +0,0 @@ -// 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. - -package org.apache.oodt.profile; - -import org.apache.oodt.commons.Configuration; - -import java.io.IOException; - -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.rdf.model.ModelFactory; -import org.apache.jena.rdf.model.Resource; -import org.apache.jena.rdf.model.Property; - -import java.util.Collection; - -import org.apache.jena.rdf.model.Bag; -import org.apache.jena.rdf.model.Seq; - -import java.util.List; -import java.net.URI; - -/** - * Profile utilities. - * - * Utility methods for profiles. - * - * @author Kelly - */ -class Utility { - /** - * Don't call because this is a utiliy class. - */ - private Utility() { - throw new IllegalStateException("Utility class"); - } - - static void addProperty(Model model, Resource resource, Property property, Object value, ProfileAttributes profAttr, - URI uri) { - - if (value == null || value.toString().length() == 0) { - return; - } - - Object obj; - if (value instanceof Collection) { - Collection collection = (Collection) value; - if (collection.isEmpty()) { - return; - } - Bag bag = model.createBag(uri + "_" + property.getLocalName() + "_bag"); - for (Object aCollection : collection) { - bag.add(aCollection); - } - resource.addProperty(property, bag); - obj = bag; - } else { - resource.addProperty(property, value.toString()); - obj = value; - } - - Resource reification = model.createResource(uri + "_" + property.getLocalName() + "_reification"); - - reification.addProperty(rdfSubject, resource); - reification.addProperty(rdfPredicate, property); - reification.addProperty(rdfObject, obj.toString()); - reification.addProperty(rdfType, rdfStatement); - - addPotentiallyNullReifiedStatement(reification, edmID, profAttr.getVersion()); - addPotentiallyNullReifiedStatement(reification, edmVersion, profAttr.getVersion()); - addPotentiallyNullReifiedStatement(reification, edmType, profAttr.getType()); - addPotentiallyNullReifiedStatement(reification, edmStatus, profAttr.getStatusID()); - addPotentiallyNullReifiedStatement(reification, edmSecurity, profAttr.getSecurityType()); - addPotentiallyNullReifiedStatement(reification, edmParent, profAttr.getParent()); - addPotentiallyNullReifiedStatement(reification, edmRegAuth, profAttr.getRegAuthority()); - - List children = profAttr.getChildren(); - if (!children.isEmpty()) { - Bag bag = model.createBag(uri + "_" + property.getLocalName() + "_childrenBag"); - for (Object aChildren : children) { - bag.add(aChildren); - } - reification.addProperty(edmChild, bag); - } - - List revNotes = profAttr.getRevisionNotes(); - if (!revNotes.isEmpty()) { - Seq seq = model.createSeq(uri + "_" + property.getLocalName() + "_revNotesSeq"); - for (Object revNote : revNotes) { - seq.add(revNote); - } - reification.addProperty(edmRevNote, seq); - } - } - - private static void addPotentiallyNullReifiedStatement(Resource reification, Property property, Object value) { - if (value == null || value.toString().length() == 0) { - return; - } - reification.addProperty(property, value.toString()); - } - - - /** Dublin core's title */ - static Property dcTitle; - static Property dcSubject; - static Property dcDescription; - static Property dcPublisher; - static Property dcContributor; - static Property dcCreator; - static Property dcDate; - static Property dcType; - static Property dcFormat; - static Property dcSource; - static Property dcLanguage; - static Property dcRelation; - static Property dcCoverage; - static Property dcRights; - - /** A resource that is an RDF statement. */ - static Resource rdfStatement; - - /** A property that is an RDF subject of a statement. */ - static Property rdfSubject; - - /** A property that is an RDF predicate of a statement. */ - static Property rdfPredicate; - - /** A property that is an object of a statement. */ - static Property rdfObject; - - /** A property that names the type of an RDF resource. */ - static Property rdfType; - - private static final String RDF_SYNTAX_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; - - private static final String DC_NS = "http://purl.org/dc/elements/1.1/"; - - private static Property edmID; - private static Property edmVersion; - private static Property edmType; - private static Property edmStatus; - private static Property edmSecurity; - private static Property edmParent; - private static Property edmChild; - private static Property edmRegAuth; - private static Property edmRevNote; - - static Property edmElement; - static Property edmContext; - static Property edmAggregation; - static Property edmClass; - static Property edmLocation; - static Property edmElemID; - static Property edmDescription; - static Property edmElemType; - static Property edmUnit; - static Property edmSynonym; - static Property edmObligation; - static Property edmMaxOccurrence; - static Property edmComment; - static Property edmMinValue; - static Property edmMaxValue; - static Property edmValue; - - /** - * Initialize this class. - */ - static { - try { - @SuppressWarnings("unused") - Configuration config = Configuration.getConfiguration(); - String profNS = System.getProperty("jpl.rdf.ns", "http://oodt.jpl.nasa.gov/grid-profile/rdfs/prof.rdf"); - Model model = ModelFactory.createDefaultModel(); - - rdfStatement = model.createResource(RDF_SYNTAX_NS + "Statement"); - - rdfSubject = model.createProperty(RDF_SYNTAX_NS, "subject"); - rdfPredicate = model.createProperty(RDF_SYNTAX_NS, "predicate"); - rdfObject = model.createProperty(RDF_SYNTAX_NS, "object"); - rdfType = model.createProperty(RDF_SYNTAX_NS, "type"); - - dcTitle = model.createProperty(DC_NS, "title"); - dcCreator = model.createProperty(DC_NS, "creator"); - dcSubject = model.createProperty(DC_NS, "subject"); - dcDescription = model.createProperty(DC_NS, "description"); - dcPublisher = model.createProperty(DC_NS, "publisher"); - dcContributor = model.createProperty(DC_NS, "contributor"); - dcDate = model.createProperty(DC_NS, "date"); - dcType = model.createProperty(DC_NS, "type"); - dcFormat = model.createProperty(DC_NS, "format"); - dcSource = model.createProperty(DC_NS, "source"); - dcLanguage = model.createProperty(DC_NS, "language"); - dcRelation = model.createProperty(DC_NS, "relation"); - dcCoverage = model.createProperty(DC_NS, "coverage"); - dcRights = model.createProperty(DC_NS, "rights"); - - edmID = model.createProperty(profNS, "id"); - edmVersion = model.createProperty(profNS, "version"); - edmType = model.createProperty(profNS, "type"); - edmStatus = model.createProperty(profNS, "status"); - edmSecurity = model.createProperty(profNS, "security"); - edmParent = model.createProperty(profNS, "parent"); - edmChild = model.createProperty(profNS, "child"); - edmRegAuth = model.createProperty(profNS, "regAuth"); - edmRevNote = model.createProperty(profNS, "revNote"); - edmElement = model.createProperty(profNS, "element"); - edmContext = model.createProperty(profNS, "context"); - edmClass = model.createProperty(profNS, "class"); - edmAggregation = model.createProperty(profNS, "aggregation"); - edmLocation = model.createProperty(profNS, "location"); - - edmElemID = model.createProperty(profNS, "edmElemID"); - edmDescription = model.createProperty(profNS, "edmDescription"); - edmElemType = model.createProperty(profNS, "edmElemType"); - edmUnit = model.createProperty(profNS, "edmUnit"); - edmSynonym = model.createProperty(profNS, "edmSynonym"); - edmObligation = model.createProperty(profNS, "edmObligation"); - edmMaxOccurrence = model.createProperty(profNS, "edmMaxOccurrence"); - edmComment = model.createProperty(profNS, "edmComment"); - edmMinValue = model.createProperty(profNS, "edmMinValue"); - edmMaxValue = model.createProperty(profNS, "edmMaxValue"); - edmValue = model.createProperty(profNS, "edmValue"); - - } catch (IOException ex) { - System.err.println("Fatal I/O error prevents reading of configuration: " + ex.getMessage()); - System.exit(1); - } catch (SAXParseException ex) { - System.err.println("Fatal error parsing file (public ID \"" + ex.getPublicId() + "\", system ID \"" - + ex.getSystemId() + "\"), line " + ex.getLineNumber() + " column " + ex.getColumnNumber() - + ": " + ex.getMessage()); - System.exit(1); - } catch (SAXException ex) { - System.err.println("Fatal SAX exception: " + ex.getMessage() + (ex.getException() == null? "" - : " (embedded exception " + ex.getException().getClass().getName() + ": " - + ex.getException().getMessage() + ")")); - System.exit(1); - } - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java b/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java deleted file mode 100644 index 3b0fa6a..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java +++ /dev/null @@ -1,26 +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.profile.activity; - -import org.apache.oodt.commons.activity.Incident; - -public class ConnectedToServer extends Incident { - /** Serial version unique ID */ - static final long serialVersionUID = 11593677192131322L; -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java b/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java deleted file mode 100644 index 52a00fc..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java +++ /dev/null @@ -1,26 +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.profile.activity; - -import org.apache.oodt.commons.activity.Incident; - -public class ProfileClientConstructed extends Incident { - /** Serial version unique ID. */ - static final long serialVersionUID = 6229028649808262392L; -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java b/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java deleted file mode 100644 index d155a17..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java +++ /dev/null @@ -1,26 +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.profile.activity; - -import org.apache.oodt.commons.activity.Incident; - -public class QueriedHandlers extends Incident { - /** Serial version unique ID. */ - static final long serialVersionUID = -3845963004602982264L; -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java b/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java deleted file mode 100644 index a2bd723..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java +++ /dev/null @@ -1,26 +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.profile.activity; - -import org.apache.oodt.commons.activity.Incident; - -public class ReceivedQuery extends Incident { - /** Serial version unique ID. */ - static final long serialVersionUID = 3646406525260246714L; -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java b/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java deleted file mode 100755 index b3dd729..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java +++ /dev/null @@ -1,288 +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.profile.gui; - -import org.apache.oodt.profile.EnumeratedProfileElement; -import org.apache.oodt.profile.Profile; -import org.apache.oodt.profile.ProfileElement; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreePath; - - - -public class LeafListener extends MouseAdapter{ - profileTree tree; - - public LeafListener(profileTree jtr){ - - tree = jtr; - - } - - private boolean isValidMultiTerm(String t){ - if(t==null){return false;} - - if(t.equals("Children")){ - return true; - } - else if(t.equals("Revision Notes")){ - return true; - } - else if(t.equals("Contexts")){ - return true; - } - else if(t.equals("Contributors")){ - return true; - } - else if(t.equals("Coverages")){ - return true; - } - else if(t.equals("Creators")){ - return true; - } - else if(t.equals("Dates")){ - return true; - } - else if(t.equals("Formats")){ - return true; - } - else if(t.equals("Languages")){ - return true; - } - else if(t.equals("Resource Locations")){ - return true; - } - else if(t.equals("Publishers")){ - return true; - } - else if(t.equals("Relations")){ - return true; - } - else if(t.equals("Rights")){ - return true; - } - else if(t.equals("Sources")){ - return true; - } - else if(t.equals("Subjects")){ - return true; - } - else if(t.equals("Types")){ - return true; - } - else if(t.equals("Profile Elements")){ - return true; - } - else if(t.equals("Synonyms")){ - return true; - } - - return false; - - } - - public DefaultMutableTreeNode generateNewProfileElementTree(String peName){ - DefaultMutableTreeNode peRoot; - - ProfileElement theProfileElement = new EnumeratedProfileElement(new Profile()); - - - peRoot = new DefaultMutableTreeNode(peName); - DefaultMutableTreeNode theCommentsRoot = new DefaultMutableTreeNode("Comments"); - DefaultMutableTreeNode theComments = new DefaultMutableTreeNode(theProfileElement.getComments()); - - theCommentsRoot.add(theComments); - - DefaultMutableTreeNode theDesc = new DefaultMutableTreeNode(theProfileElement.getDescription()); - DefaultMutableTreeNode theDescRoot = new DefaultMutableTreeNode("Description"); - - theDescRoot.add(theDesc); - - - - DefaultMutableTreeNode theID = new DefaultMutableTreeNode(theProfileElement.getID()); - DefaultMutableTreeNode theIDRoot = new DefaultMutableTreeNode("ID"); - - theIDRoot.add(theID); - - DefaultMutableTreeNode theMO = new DefaultMutableTreeNode( - Integer.toString(theProfileElement.getMaxOccurrence())); - DefaultMutableTreeNode theMORoot = new DefaultMutableTreeNode("Max Occurence"); - theMORoot.add(theMO); - - DefaultMutableTreeNode theSynonyms = new DefaultMutableTreeNode("Synonyms"); - - for (Object o : theProfileElement.getSynonyms()) { - String theSynonym = (String) o; - DefaultMutableTreeNode sNode = new DefaultMutableTreeNode(theSynonym); - theSynonyms.add(sNode); - } - - DefaultMutableTreeNode theType = new DefaultMutableTreeNode(theProfileElement.getType()); - DefaultMutableTreeNode theTypeRoot = new DefaultMutableTreeNode("Type"); - theTypeRoot.add(theType); - - - DefaultMutableTreeNode theUnit = new DefaultMutableTreeNode(theProfileElement.getUnit()); - DefaultMutableTreeNode theUnitRoot = new DefaultMutableTreeNode("Unit"); - theUnitRoot.add(theUnit); - - peRoot.add(theCommentsRoot); - peRoot.add(theDescRoot); - peRoot.add(theIDRoot); - peRoot.add(theMORoot); - peRoot.add(theSynonyms); - peRoot.add(theTypeRoot); - peRoot.add(theUnitRoot); - - - return peRoot; - - } - - protected void menuItem2ActionPerformed(ActionEvent evt,DefaultMutableTreeNode theTreeNode,DefaultTreeModel theModel){ - - //only add child if it's one of the things that should have children - String treeNodeName = (String)theTreeNode.getUserObject(); - - if(isValidMultiTerm(treeNodeName)){ - return; //only edit non multi-term fields - } - - - String newNodeName = (String)JOptionPane.showInputDialog(null,"Edit","Enter New Node Value", JOptionPane.PLAIN_MESSAGE,null,null,"New Value"); - - if(newNodeName == null){return; } //they didn't specify name or hit cancel - theTreeNode.setUserObject(newNodeName); - theModel.reload(); - } - - - protected void menuItem1ActionPerformed(ActionEvent evt,DefaultMutableTreeNode theTreeNode,DefaultTreeModel theModel){ - - //only add child if it's one of the things that should have children - String treeNodeName = (String)theTreeNode.getUserObject(); - - if(!isValidMultiTerm(treeNodeName)){ - return; - } - - DefaultMutableTreeNode theAddNode; - String childNodeName = (String)JOptionPane.showInputDialog(null,"Add","Enter Node Name", JOptionPane.PLAIN_MESSAGE,null,null,"Child Value"); - - if(childNodeName == null){return; } //they didn't specify name or hit cancel - - if(treeNodeName.equals("Profile Elements")){ - theAddNode = generateNewProfileElementTree(childNodeName); - } - else{ - theAddNode = new DefaultMutableTreeNode(childNodeName); - } - - - - theTreeNode.add(theAddNode); - theModel.reload(); - } - - - public void mousePressed(MouseEvent e) { - - int selectedRow = tree.getRowForLocation(e.getX(), e.getY()); - TreePath selectedPath = tree.getPathForLocation(e.getX(), e.getY()); - - if(selectedRow != -1) { - DefaultMutableTreeNode tn //get end of current path - = (DefaultMutableTreeNode)(selectedPath.getLastPathComponent()); - - JMenuItem menuItem1 = new JMenuItem("Add"); - JMenuItem menuItem2 = new JMenuItem("Edit"); - - menuItem2.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"EDIT")); - menuItem1.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"ADD")); - JPopupMenu popup = new JPopupMenu(); - popup.add(menuItem1); - popup.add(menuItem2); - - if(e.isPopupTrigger()){ - popup.show(tree,e.getX(),e.getY()); - } - - } - } - - public void mouseReleased(MouseEvent e) { - - int selectedRow = tree.getRowForLocation(e.getX(), e.getY()); - TreePath selectedPath = tree.getPathForLocation(e.getX(), e.getY()); - - if(selectedRow != -1) { - DefaultMutableTreeNode tn //get end of current path - = (DefaultMutableTreeNode)(selectedPath.getLastPathComponent()); - - JMenuItem menuItem1 = new JMenuItem("Add"); - JMenuItem menuItem2 = new JMenuItem("Edit"); - - menuItem2.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"EDIT")); - menuItem1.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"ADD")); - JPopupMenu popup = new JPopupMenu(); - popup.add(menuItem1); - popup.add(menuItem2); - - if(e.isPopupTrigger()){ - popup.show(tree,e.getX(),e.getY()); - } - - } - } - - public class TreeNodeActionListener implements ActionListener{ - private DefaultMutableTreeNode myTreeNode = null; - private DefaultTreeModel myTreeModel = null; - private LeafListener theLeafListener=null; - private String type=null; - - public TreeNodeActionListener(DefaultMutableTreeNode t,LeafListener l,DefaultTreeModel tm,String theType){ - myTreeNode = t; - theLeafListener = l; - myTreeModel = tm; - type = theType; - } - - public void actionPerformed(ActionEvent evt) { - if(type.equals("ADD")){ - theLeafListener.menuItem1ActionPerformed(evt,myTreeNode,myTreeModel); - } - else if(type.equals("EDIT")){ - theLeafListener.menuItem2ActionPerformed(evt,myTreeNode,myTreeModel); - } - } - - } - - } http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form b/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form deleted file mode 100755 index c0b9ff0..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form +++ /dev/null @@ -1,435 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java b/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java deleted file mode 100755 index 381d8a3..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java +++ /dev/null @@ -1,962 +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.profile.gui; - -import org.apache.oodt.profile.Profile; -import org.apache.oodt.profile.ProfileElement; -import org.apache.oodt.profile.RangedProfileElement; -import org.apache.oodt.profile.gui.pstructs.ProfilePrinter; - -import org.xml.sax.SAXException; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.util.Enumeration; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.swing.JButton; -import javax.swing.JEditorPane; -import javax.swing.JFileChooser; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreeNode; - -/** -* This code was generated using CloudGarden's Jigloo -* SWT/Swing GUI Builder, which is free for non-commercial -* use. If Jigloo is being used commercially (ie, by a -* for-profit company or business) then you should purchase -* a license - please visit www.cloudgarden.com for details. -*/ -public class ProfileBuilderGUI extends javax.swing.JFrame { - private static Logger LOG = Logger.getLogger(ProfileBuilderGUI.class.getName()); - private JButton jButton1; - private JEditorPane jEditorPane1; - private JScrollPane jPanel3; - private profileTree jTree1; - private JScrollPane jPanel2; - private JPanel jPanel1; - private JMenuItem helpMenuItem; - private JMenu jMenu5; - private JMenuItem deleteMenuItem; - private JSeparator jSeparator1; - private JMenuItem pasteMenuItem; - private JMenuItem copyMenuItem; - private JMenuItem cutMenuItem; - private JMenu jMenu4; - private JMenuItem exitMenuItem; - private JSeparator jSeparator2; - private JMenuItem closeFileMenuItem; - private JMenuItem saveMenuItem; - private JMenuItem openFileMenuItem; - private JMenuItem newFileMenuItem; - private JMenu jMenu3; - private JMenuBar jMenuBar1; - - private Profile createdProfile=null; - - - public ProfileBuilderGUI() { - initGUI(); - } - - /** - * Initializes the GUI. - * Auto-generated code - any changes you make will disappear. - */ - public void initGUI(){ - try { - preInitGUI(); - - try { - javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); - } catch(Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - jPanel1 = new JPanel(); - jPanel2 = new JScrollPane(); - jTree1 = new profileTree(); - jPanel3 = new JScrollPane(); - jEditorPane1 = new JEditorPane(); - jButton1 = new JButton(); - - BorderLayout thisLayout = new BorderLayout(); - this.getContentPane().setLayout(thisLayout); - thisLayout.setHgap(0); - thisLayout.setVgap(0); - this.setTitle("OODT Profile Builder"); - this.setSize(new java.awt.Dimension(682,387)); - - BorderLayout jPanel1Layout = new BorderLayout(); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHgap(0); - jPanel1Layout.setVgap(0); - this.getContentPane().add(jPanel1, BorderLayout.CENTER); - - jPanel2.setPreferredSize(new java.awt.Dimension(231,339)); - jPanel2.setAutoscrolls(true); - jPanel1.add(jPanel2, BorderLayout.WEST); - - jTree1.setEditable(true); - jTree1.setPreferredSize(new java.awt.Dimension(426,800)); - jTree1.setAutoscrolls(true); - jTree1.setMaximumSize(new java.awt.Dimension(426,800)); - jTree1.setOpaque(true); - jTree1.setSize(new java.awt.Dimension(426,800)); - jPanel2.add(jTree1); - jPanel2.setViewportView(jTree1); - - jPanel3.setPreferredSize(new java.awt.Dimension(444,339)); - jPanel3.setAutoscrolls(true); - jPanel1.add(jPanel3, BorderLayout.EAST); - - jEditorPane1.setEditable(false); - jEditorPane1.setPreferredSize(new java.awt.Dimension(414,320)); - jEditorPane1.setAutoscrolls(true); - jPanel3.add(jEditorPane1); - jPanel3.setViewportView(jEditorPane1); - - jButton1.setText("Show XML"); - this.getContentPane().add(jButton1, BorderLayout.SOUTH); - jButton1.addActionListener( new ActionListener() { - public void actionPerformed(ActionEvent evt) { - jButton1ActionPerformed(evt); - } - }); - jMenuBar1 = new JMenuBar(); - jMenu3 = new JMenu(); - newFileMenuItem = new JMenuItem(); - openFileMenuItem = new JMenuItem(); - saveMenuItem = new JMenuItem(); - closeFileMenuItem = new JMenuItem(); - jSeparator2 = new JSeparator(); - exitMenuItem = new JMenuItem(); - jMenu4 = new JMenu(); - cutMenuItem = new JMenuItem(); - copyMenuItem = new JMenuItem(); - pasteMenuItem = new JMenuItem(); - jSeparator1 = new JSeparator(); - deleteMenuItem = new JMenuItem(); - jMenu5 = new JMenu(); - helpMenuItem = new JMenuItem(); - - setJMenuBar(jMenuBar1); - - jMenu3.setText("File"); - jMenu3.setVisible(true); - jMenuBar1.add(jMenu3); - - newFileMenuItem.setText("New Profile"); - newFileMenuItem.setVisible(true); - newFileMenuItem.setPreferredSize(new java.awt.Dimension(28,16)); - newFileMenuItem.setBounds(new java.awt.Rectangle(5,5,28,16)); - jMenu3.add(newFileMenuItem); - newFileMenuItem.addActionListener( new ActionListener() { - public void actionPerformed(ActionEvent evt) { - newFileMenuItemActionPerformed(evt); - } - }); - - openFileMenuItem.setText("Open Profile"); - openFileMenuItem.setVisible(true); - openFileMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu3.add(openFileMenuItem); - openFileMenuItem.addActionListener( new ActionListener() { - public void actionPerformed(ActionEvent evt) { - openFileMenuItemActionPerformed(evt); - } - }); - - saveMenuItem.setText("Save Profile"); - saveMenuItem.setVisible(true); - saveMenuItem.setVerifyInputWhenFocusTarget(false); - saveMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu3.add(saveMenuItem); - saveMenuItem.addActionListener( new ActionListener() { - public void actionPerformed(ActionEvent evt) { - saveMenuItemActionPerformed(evt); - } - }); - - closeFileMenuItem.setText("Close"); - closeFileMenuItem.setVisible(true); - closeFileMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu3.add(closeFileMenuItem); - - jSeparator2.setVisible(true); - jSeparator2.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu3.add(jSeparator2); - - exitMenuItem.setText("Exit"); - exitMenuItem.setVisible(true); - exitMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu3.add(exitMenuItem); - exitMenuItem.addActionListener( new ActionListener() { - public void actionPerformed(ActionEvent evt) { - exitMenuItemActionPerformed(evt); - } - }); - - jMenu4.setText("Edit"); - jMenu4.setVisible(true); - jMenuBar1.add(jMenu4); - - cutMenuItem.setText("Cut"); - cutMenuItem.setVisible(true); - cutMenuItem.setPreferredSize(new java.awt.Dimension(27,16)); - cutMenuItem.setBounds(new java.awt.Rectangle(5,5,27,16)); - jMenu4.add(cutMenuItem); - - copyMenuItem.setText("Copy"); - copyMenuItem.setVisible(true); - copyMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu4.add(copyMenuItem); - - pasteMenuItem.setText("Paste"); - pasteMenuItem.setVisible(true); - pasteMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu4.add(pasteMenuItem); - - jSeparator1.setVisible(true); - jSeparator1.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu4.add(jSeparator1); - - deleteMenuItem.setText("Delete"); - deleteMenuItem.setVisible(true); - deleteMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30)); - jMenu4.add(deleteMenuItem); - - jMenu5.setText("Help"); - jMenu5.setVisible(true); - jMenuBar1.add(jMenu5); - - helpMenuItem.setText("Help"); - helpMenuItem.setVisible(true); - helpMenuItem.setPreferredSize(new java.awt.Dimension(31,16)); - helpMenuItem.setBounds(new java.awt.Rectangle(5,5,31,16)); - jMenu5.add(helpMenuItem); - - postInitGUI(); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - /** Add your pre-init code in here */ - public void preInitGUI(){ - } - - /** Add your post-init code in here */ - public void postInitGUI(){ - } - - /** Auto-generated main method */ - public static void main(String[] args){ - //showGUI(); - showMainGUI(); - } - - public static void showMainGUI(){ - try { - ProfileBuilderGUI inst = new ProfileBuilderGUI(); - inst.setVisible(true); - inst.getJTree1().addMouseListener(new LeafListener(inst.getJTree1())); - inst.getJTree1().setExpandsSelectedPaths(true); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } - - - - - - - /** - * This static method creates a new instance of this class and shows - * it inside a new JFrame, (unless it is already a JFrame). - * - * It is a convenience method for showing the GUI, but it can be - * copied and used as a basis for your own code. * - * It is auto-generated code - the body of this method will be - * re-generated after any changes are made to the GUI. - * However, if you delete this method it will not be re-created. */ - public static void showGUI(){ - try { - ProfileBuilderGUI inst = new ProfileBuilderGUI(); - inst.setVisible(true); - } catch (Exception e) { - LOG.log(Level.SEVERE, e.getMessage()); - } - } -/** -* Auto-generated method -*/public JPanel getJPanel1(){ -return jPanel1; } -/** -* Auto-generated method -*/public JScrollPane getJPanel2(){ -return jPanel2; } -/** -* Auto-generated method -*/public profileTree getJTree1(){ -return jTree1; } - -public void setJTree1(profileTree jt){ - jTree1 = jt; - repaint(); -} -/** -* Auto-generated method -*/public JScrollPane getJPanel3(){ -return jPanel3; } -/** -* Auto-generated method -*/public JEditorPane getJEditorPane1(){ -return jEditorPane1; } - - - - /** Auto-generated event handler method */ - protected void newFileMenuItemActionPerformed(ActionEvent evt){ - //TODO add your handler code here - - createdProfile = new Profile(); - jEditorPane1.setText(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString()); - - getJTree1().setModel(generateModelFromProfile(createdProfile)); - //getJTree1().addMouseListener(new LeafListener(getJTree1())); - } - - /** Auto-generated event handler method */ - protected void exitMenuItemActionPerformed(ActionEvent evt){ - //TODO add your handler code here - System.exit(1); - } - - private void addElementsFromTreeNode(TreeNode t, List multiValueElem){ - for(Enumeration i = t.children(); i.hasMoreElements(); ){ - DefaultMutableTreeNode theNode = (DefaultMutableTreeNode)i.nextElement(); - - String theStr = (String)theNode.getUserObject(); - multiValueElem.add(theStr); - } - } - - - - private Profile generateProfileFromModel(TreeModel dtm){ - - Profile p = new Profile(); - DefaultMutableTreeNode theProfileRoot = (DefaultMutableTreeNode)dtm.getRoot(); - - //get the profile attributes - //children List - //id String - //parent String - //regAuthority String - //revisionNotes List - //securityType String - //statusID String - //type String - //version String - TreeNode theProfAttrRoot = theProfileRoot.getChildAt(0); - - TreeNode theProfAttr_Children = theProfAttrRoot.getChildAt(0); - addElementsFromTreeNode(theProfAttr_Children,p.getProfileAttributes().getChildren()); - - TreeNode theProfAttr_IDRoot = theProfAttrRoot.getChildAt(1); - DefaultMutableTreeNode theProfAttr_ID = (DefaultMutableTreeNode)theProfAttr_IDRoot.getChildAt(0); - p.getProfileAttributes().setID((String)theProfAttr_ID.getUserObject()); - - TreeNode theProfAttr_ParentRoot = theProfAttrRoot.getChildAt(2); - DefaultMutableTreeNode theProfAttr_Parent = (DefaultMutableTreeNode)theProfAttr_ParentRoot.getChildAt(0); - p.getProfileAttributes().setParent((String)theProfAttr_Parent.getUserObject()); - - - TreeNode theProfAttr_RegAuthorityRoot = theProfAttrRoot.getChildAt(3); - DefaultMutableTreeNode theProfAttr_RegAuthority = (DefaultMutableTreeNode)theProfAttr_RegAuthorityRoot.getChildAt(0); - p.getProfileAttributes().setRegAuthority((String)theProfAttr_RegAuthority.getUserObject()); - - TreeNode theProfAttr_revNotes = theProfAttrRoot.getChildAt(4); - addElementsFromTreeNode(theProfAttr_revNotes,p.getProfileAttributes().getRevisionNotes()); - - TreeNode theProfAttr_SecurityTypeRoot = theProfAttrRoot.getChildAt(5); - DefaultMutableTreeNode theProfAttr_SecurityType = (DefaultMutableTreeNode)theProfAttr_SecurityTypeRoot.getChildAt(0); - p.getProfileAttributes().setSecurityType((String)theProfAttr_SecurityType.getUserObject()); - - TreeNode theProfAttr_StatusIDRoot = theProfAttrRoot.getChildAt(6); - DefaultMutableTreeNode theProfAttr_StatusID = (DefaultMutableTreeNode)theProfAttr_StatusIDRoot.getChildAt(0); - p.getProfileAttributes().setStatusID((String)theProfAttr_StatusID.getUserObject()); - - TreeNode theProfAttr_TypeRoot = theProfAttrRoot.getChildAt(7); - DefaultMutableTreeNode theProfAttr_Type = (DefaultMutableTreeNode)theProfAttr_TypeRoot.getChildAt(0); - p.getProfileAttributes().setType((String)theProfAttr_Type.getUserObject()); - - TreeNode theProfAttr_VersionRoot = theProfAttrRoot.getChildAt(8); - DefaultMutableTreeNode theProfAttr_Version = (DefaultMutableTreeNode)theProfAttr_VersionRoot.getChildAt(0); - p.getProfileAttributes().setVersion((String)theProfAttr_Version.getUserObject()); - - - //resource attributes - //aggregation - string - //class - string - //contexts - list - //contributors - list - //coverages - list - //creators - list - //dates - list - //description - string - //formats - list - //identifier - string - //languages - list - //locations - list - //publishers - list - //relations - list - //rights - list - //sources - list - //subjects - list - //title - string - //types - list - - TreeNode theResAttrRoot = theProfileRoot.getChildAt(1); - - TreeNode ra_aggRoot=theResAttrRoot.getChildAt(0); - TreeNode ra_classRoot=theResAttrRoot.getChildAt(1); - TreeNode ra_contextRoot=theResAttrRoot.getChildAt(2); - TreeNode ra_contribRoot=theResAttrRoot.getChildAt(3); - TreeNode ra_coverageRoot=theResAttrRoot.getChildAt(4); - TreeNode ra_creatorRoot=theResAttrRoot.getChildAt(5); - TreeNode ra_datesRoot=theResAttrRoot.getChildAt(6); - TreeNode ra_descRoot=theResAttrRoot.getChildAt(7); - TreeNode ra_formatsRoot=theResAttrRoot.getChildAt(8); - TreeNode ra_identifierRoot=theResAttrRoot.getChildAt(9); - TreeNode ra_langRoot=theResAttrRoot.getChildAt(10); - TreeNode ra_locationRoot=theResAttrRoot.getChildAt(11); - TreeNode ra_publishersRoot=theResAttrRoot.getChildAt(12); - TreeNode ra_relationsRoot=theResAttrRoot.getChildAt(13); - TreeNode ra_rightsRoot=theResAttrRoot.getChildAt(14); - TreeNode ra_sourcesRoot=theResAttrRoot.getChildAt(15); - TreeNode ra_subjectsRoot=theResAttrRoot.getChildAt(16); - TreeNode ra_titleRoot=theResAttrRoot.getChildAt(17); - TreeNode ra_typesRoot=theResAttrRoot.getChildAt(18); - - DefaultMutableTreeNode ra_agg = (DefaultMutableTreeNode)ra_aggRoot.getChildAt(0); - DefaultMutableTreeNode ra_class = (DefaultMutableTreeNode)ra_classRoot.getChildAt(0); - - - p.getResourceAttributes().setResAggregation((String)ra_agg.getUserObject()); - p.getResourceAttributes().setResClass((String)ra_class.getUserObject()); - addElementsFromTreeNode(ra_contextRoot,p.getResourceAttributes().getResContexts()); - addElementsFromTreeNode(ra_contribRoot,p.getResourceAttributes().getContributors()); - addElementsFromTreeNode(ra_coverageRoot,p.getResourceAttributes().getCoverages()); - addElementsFromTreeNode(ra_creatorRoot,p.getResourceAttributes().getCreators()); - addElementsFromTreeNode(ra_datesRoot,p.getResourceAttributes().getDates()); - - DefaultMutableTreeNode ra_desc = (DefaultMutableTreeNode)ra_descRoot.getChildAt(0); - DefaultMutableTreeNode ra_identifier = (DefaultMutableTreeNode)ra_identifierRoot.getChildAt(0); - - p.getResourceAttributes().setDescription((String)ra_desc.getUserObject()); - p.getResourceAttributes().setIdentifier((String)ra_identifier.getUserObject()); - - addElementsFromTreeNode(ra_formatsRoot,p.getResourceAttributes().getFormats()); - addElementsFromTreeNode(ra_langRoot,p.getResourceAttributes().getLanguages()); - addElementsFromTreeNode(ra_locationRoot,p.getResourceAttributes().getResLocations()); - addElementsFromTreeNode(ra_publishersRoot,p.getResourceAttributes().getPublishers()); - addElementsFromTreeNode(ra_relationsRoot,p.getResourceAttributes().getRelations()); - addElementsFromTreeNode(ra_rightsRoot,p.getResourceAttributes().getRights()); - addElementsFromTreeNode(ra_sourcesRoot,p.getResourceAttributes().getSources()); - addElementsFromTreeNode(ra_subjectsRoot,p.getResourceAttributes().getSubjects()); - addElementsFromTreeNode(ra_typesRoot,p.getResourceAttributes().getTypes()); - - DefaultMutableTreeNode ra_title = (DefaultMutableTreeNode)ra_titleRoot.getChildAt(0); - p.getResourceAttributes().setTitle((String)ra_title.getUserObject()); - - //handle profile elements here - TreeNode theProfElemRoot = theProfileRoot.getChildAt(2); - - for(Enumeration e = theProfElemRoot.children(); e.hasMoreElements(); ){ - DefaultMutableTreeNode profElemN_Root = (DefaultMutableTreeNode)e.nextElement(); - System.out.println("Got Profile Element "+ profElemN_Root.getUserObject()); - ProfileElement profElem = makeProfileElementFromTreeNode(p,profElemN_Root); - - if(profElem != null){ - System.out.println("Making profile element"); - System.out.println(profElem.toString()); - - p.getProfileElements().put((String)profElemN_Root.getUserObject(),profElem); - } - - - } - - - return p; - } - - private ProfileElement makeProfileElementFromTreeNode(Profile theProfile,DefaultMutableTreeNode tn){ - - ProfileElement theProfileElement = new RangedProfileElement(theProfile); - - DefaultMutableTreeNode commentRoot = (DefaultMutableTreeNode)tn.getChildAt(0); - DefaultMutableTreeNode descRoot = (DefaultMutableTreeNode)tn.getChildAt(1); - DefaultMutableTreeNode idRoot = (DefaultMutableTreeNode)tn.getChildAt(2); - DefaultMutableTreeNode moRoot = (DefaultMutableTreeNode)tn.getChildAt(3); - DefaultMutableTreeNode synRoot = (DefaultMutableTreeNode)tn.getChildAt(4); - DefaultMutableTreeNode typeRoot = (DefaultMutableTreeNode)tn.getChildAt(5); - DefaultMutableTreeNode unitRoot = (DefaultMutableTreeNode)tn.getChildAt(6); - - DefaultMutableTreeNode pe_Comments = (DefaultMutableTreeNode)commentRoot.getChildAt(0); - DefaultMutableTreeNode pe_desc = (DefaultMutableTreeNode)descRoot.getChildAt(0); - DefaultMutableTreeNode pe_id = (DefaultMutableTreeNode)idRoot.getChildAt(0); - DefaultMutableTreeNode pe_mo = (DefaultMutableTreeNode)moRoot.getChildAt(0); - DefaultMutableTreeNode pe_type = (DefaultMutableTreeNode)typeRoot.getChildAt(0); - DefaultMutableTreeNode pe_unit = (DefaultMutableTreeNode)unitRoot.getChildAt(0); - - addElementsFromTreeNode(synRoot,theProfileElement.getSynonyms()); - - theProfileElement.setName((String)tn.getUserObject()); - theProfileElement.setComments((String)pe_Comments.getUserObject()); - theProfileElement.setDescription((String)pe_desc.getUserObject()); - theProfileElement.setID((String)pe_id.getUserObject()); - theProfileElement.setMaxOccurrence(Integer.parseInt((String)pe_mo.getUserObject())); - theProfileElement.setType((String)pe_type.getUserObject()); - theProfileElement.setUnit((String)pe_unit.getUserObject()); - - return theProfileElement; - - //return new RangedProfileElement(new Profile()); - } - - - - private DefaultTreeModel generateModelFromProfile(Profile p){ - DefaultMutableTreeNode root = new DefaultMutableTreeNode("Profile"); - DefaultMutableTreeNode resAttrRoot = new DefaultMutableTreeNode("Resource Attributes"); - DefaultMutableTreeNode profAttrRoot = new DefaultMutableTreeNode("Profile Attributes"); - DefaultMutableTreeNode profElemRoot = new DefaultMutableTreeNode("Profile Elements"); - - //do the Profile Attributes here - //children List - //id String - //parent String - //regAuthority String - //revisionNotes List - //securityType String - //statusID String - //type String - //version String - - DefaultMutableTreeNode profAttr_children = new DefaultMutableTreeNode("Children"); - - for (Object o : p.getProfileAttributes().getChildren()) { - String theChild = (String) o; - - DefaultMutableTreeNode profAttr_childN = new DefaultMutableTreeNode(theChild); - profAttr_children.add(profAttr_childN); - } - - - DefaultMutableTreeNode profAttr_id = new DefaultMutableTreeNode("Id"); - profAttr_id.add(new DefaultMutableTreeNode(p.getProfileAttributes().getID())); - - DefaultMutableTreeNode profAttr_parent = new DefaultMutableTreeNode("Parent"); - profAttr_parent.add(new DefaultMutableTreeNode(p.getProfileAttributes().getParent())); - - DefaultMutableTreeNode profAttr_regAuth = new DefaultMutableTreeNode("Registration Authority"); - profAttr_regAuth.add(new DefaultMutableTreeNode(p.getProfileAttributes().getRegAuthority())); - - DefaultMutableTreeNode profAttr_revNotes = new DefaultMutableTreeNode("Revision Notes"); - - for (Object o : p.getProfileAttributes().getRevisionNotes()) { - String revNoteString = (String) o; - - DefaultMutableTreeNode revNote_Child = new DefaultMutableTreeNode(revNoteString); - profAttr_revNotes.add(revNote_Child); - } - - DefaultMutableTreeNode profAttr_securityType = new DefaultMutableTreeNode("Security Type"); - profAttr_securityType.add(new DefaultMutableTreeNode(p.getProfileAttributes().getSecurityType())); - - DefaultMutableTreeNode profAttr_statusID = new DefaultMutableTreeNode("Status ID"); - profAttr_statusID.add(new DefaultMutableTreeNode(p.getProfileAttributes().getStatusID())); - - DefaultMutableTreeNode profAttr_type = new DefaultMutableTreeNode("Type"); - profAttr_type.add(new DefaultMutableTreeNode(p.getProfileAttributes().getType())); - - DefaultMutableTreeNode profAttr_version = new DefaultMutableTreeNode("Version"); - profAttr_version.add(new DefaultMutableTreeNode(p.getProfileAttributes().getVersion())); - - profAttrRoot.add(profAttr_children); - profAttrRoot.add(profAttr_id); - profAttrRoot.add(profAttr_parent); - profAttrRoot.add(profAttr_regAuth); - profAttrRoot.add(profAttr_revNotes); - profAttrRoot.add(profAttr_securityType); - profAttrRoot.add(profAttr_statusID); - profAttrRoot.add(profAttr_type); - profAttrRoot.add(profAttr_version); - - //resource attributes - //aggregation - string - //class - string - //contexts - list - //contributors - list - //coverages - list - //creators - list - //dates - list - //description - string - //formats - list - //identifier - string - //languages - list - //locations - list - //publishers - list - //relations - list - //rights - list - //sources - list - //subjects - list - //title - string - //types - list - - DefaultMutableTreeNode resAttr_aggregation = new DefaultMutableTreeNode("Aggregation"); - resAttr_aggregation.add(new DefaultMutableTreeNode(p.getResourceAttributes().getResAggregation())); - - DefaultMutableTreeNode resAttr_class = new DefaultMutableTreeNode("Class"); - resAttr_class.add(new DefaultMutableTreeNode(p.getResourceAttributes().getResClass())); - - - DefaultMutableTreeNode resAttr_contexts = new DefaultMutableTreeNode("Contexts"); - - for (String theContext : p.getResourceAttributes().getResContexts()) { - DefaultMutableTreeNode resAttr_contextN = new DefaultMutableTreeNode(theContext); - resAttr_contexts.add(resAttr_contextN); - } - - DefaultMutableTreeNode resAttr_contributors = new DefaultMutableTreeNode("Contributors"); - - for (String theContributor : p.getResourceAttributes().getContributors()) { - DefaultMutableTreeNode resAttr_contribN = new DefaultMutableTreeNode(theContributor); - resAttr_contributors.add(resAttr_contribN); - } - - DefaultMutableTreeNode resAttr_coverages = new DefaultMutableTreeNode("Coverages"); - - for (String theCoverage : p.getResourceAttributes().getCoverages()) { - DefaultMutableTreeNode resAttr_coverageN = new DefaultMutableTreeNode(theCoverage); - resAttr_coverages.add(resAttr_coverageN); - } - - DefaultMutableTreeNode resAttr_creators = new DefaultMutableTreeNode("Creators"); - - for (String theCreator : p.getResourceAttributes().getCreators()) { - DefaultMutableTreeNode resAttr_creatorN = new DefaultMutableTreeNode(theCreator); - resAttr_creators.add(resAttr_creatorN); - } - - DefaultMutableTreeNode resAttr_dates = new DefaultMutableTreeNode("Dates"); - - for (String theDate : p.getResourceAttributes().getDates()) { - DefaultMutableTreeNode resAttr_dateN = new DefaultMutableTreeNode(theDate); - resAttr_dates.add(resAttr_dateN); - } - - DefaultMutableTreeNode resAttr_description = new DefaultMutableTreeNode("Description"); - resAttr_description.add(new DefaultMutableTreeNode(p.getResourceAttributes().getDescription())); - - DefaultMutableTreeNode resAttr_formats = new DefaultMutableTreeNode("Formats"); - - for (String theFormat : p.getResourceAttributes().getFormats()) { - DefaultMutableTreeNode resAttr_formatN = new DefaultMutableTreeNode(theFormat); - resAttr_formats.add(resAttr_formatN); - } - - DefaultMutableTreeNode resAttr_identifier = new DefaultMutableTreeNode("Identifier"); - resAttr_identifier.add(new DefaultMutableTreeNode(p.getResourceAttributes().getIdentifier())); - - DefaultMutableTreeNode resAttr_languages = new DefaultMutableTreeNode("Languages"); - - for (String theLanguage : p.getResourceAttributes().getLanguages()) { - DefaultMutableTreeNode resAttr_langN = new DefaultMutableTreeNode(theLanguage); - resAttr_languages.add(resAttr_langN); - } - - DefaultMutableTreeNode resAttr_locations = new DefaultMutableTreeNode("Resource Locations"); - - for (String theLoc : p.getResourceAttributes().getResLocations()) { - DefaultMutableTreeNode resAttr_locN = new DefaultMutableTreeNode(theLoc); - resAttr_locations.add(resAttr_locN); - } - - DefaultMutableTreeNode resAttr_publishers = new DefaultMutableTreeNode("Publishers"); - - for (String thePublisher : p.getResourceAttributes().getPublishers()) { - DefaultMutableTreeNode resAttr_pubN = new DefaultMutableTreeNode(thePublisher); - resAttr_publishers.add(resAttr_pubN); - } - - DefaultMutableTreeNode resAttr_relations = new DefaultMutableTreeNode("Relations"); - - for (String theRelation : p.getResourceAttributes().getRelations()) { - DefaultMutableTreeNode resAttr_relationN = new DefaultMutableTreeNode(theRelation); - resAttr_relations.add(resAttr_relationN); - } - - - DefaultMutableTreeNode resAttr_rights = new DefaultMutableTreeNode("Rights"); - - for (String theRight : p.getResourceAttributes().getRights()) { - DefaultMutableTreeNode resAttr_rightN = new DefaultMutableTreeNode(theRight); - resAttr_rights.add(resAttr_rightN); - } - - DefaultMutableTreeNode resAttr_sources = new DefaultMutableTreeNode("Sources"); - - for (String theSource : p.getResourceAttributes().getSources()) { - DefaultMutableTreeNode resAttr_sourceN = new DefaultMutableTreeNode(theSource); - resAttr_sources.add(resAttr_sourceN); - } - - DefaultMutableTreeNode resAttr_subjects = new DefaultMutableTreeNode("Subjects"); - - for (String theSubject : p.getResourceAttributes().getSubjects()) { - DefaultMutableTreeNode resAttr_subjectN = new DefaultMutableTreeNode(theSubject); - resAttr_subjects.add(resAttr_subjectN); - } - - DefaultMutableTreeNode resAttr_title = new DefaultMutableTreeNode("Title"); - resAttr_title.add(new DefaultMutableTreeNode(p.getResourceAttributes().getTitle())); - - DefaultMutableTreeNode resAttr_types = new DefaultMutableTreeNode("Types"); - - for (String theType : p.getResourceAttributes().getTypes()) { - DefaultMutableTreeNode resAttr_typeN = new DefaultMutableTreeNode(theType); - resAttr_types.add(resAttr_typeN); - } - - - resAttrRoot.add(resAttr_aggregation); - resAttrRoot.add(resAttr_class); - resAttrRoot.add(resAttr_contexts); - resAttrRoot.add(resAttr_contributors); - resAttrRoot.add(resAttr_coverages); - resAttrRoot.add(resAttr_creators); - resAttrRoot.add(resAttr_dates); - resAttrRoot.add(resAttr_description); - resAttrRoot.add(resAttr_formats); - resAttrRoot.add(resAttr_identifier); - resAttrRoot.add(resAttr_languages); - resAttrRoot.add(resAttr_locations); - resAttrRoot.add(resAttr_publishers); - resAttrRoot.add(resAttr_relations); - resAttrRoot.add(resAttr_rights); - resAttrRoot.add(resAttr_sources); - resAttrRoot.add(resAttr_subjects); - resAttrRoot.add(resAttr_title); - resAttrRoot.add(resAttr_types); - - for (String peKey : p.getProfileElements().keySet()) { - ProfileElement theProfileElement = p.getProfileElements().get(peKey); - DefaultMutableTreeNode thePENode = new DefaultMutableTreeNode(theProfileElement.getName()); - DefaultMutableTreeNode theCommentsRoot = new DefaultMutableTreeNode("Comments"); - DefaultMutableTreeNode theComments = new DefaultMutableTreeNode(theProfileElement.getComments()); - - theCommentsRoot.add(theComments); - - DefaultMutableTreeNode theDesc = new DefaultMutableTreeNode(theProfileElement.getDescription()); - DefaultMutableTreeNode theDescRoot = new DefaultMutableTreeNode("Description"); - - theDescRoot.add(theDesc); - - - DefaultMutableTreeNode theID = new DefaultMutableTreeNode(theProfileElement.getID()); - DefaultMutableTreeNode theIDRoot = new DefaultMutableTreeNode("ID"); - - theIDRoot.add(theID); - - DefaultMutableTreeNode theMO = - new DefaultMutableTreeNode(Integer.toString(theProfileElement.getMaxOccurrence())); - DefaultMutableTreeNode theMORoot = new DefaultMutableTreeNode("Max Occurence"); - theMORoot.add(theMO); - - DefaultMutableTreeNode theSynonyms = new DefaultMutableTreeNode("Synonyms"); - - for (Object o : theProfileElement.getSynonyms()) { - String theSynonym = (String) o; - DefaultMutableTreeNode sNode = new DefaultMutableTreeNode(theSynonym); - theSynonyms.add(sNode); - } - - DefaultMutableTreeNode theType = new DefaultMutableTreeNode(theProfileElement.getType()); - DefaultMutableTreeNode theTypeRoot = new DefaultMutableTreeNode("Type"); - theTypeRoot.add(theType); - - - DefaultMutableTreeNode theUnit = new DefaultMutableTreeNode(theProfileElement.getUnit()); - DefaultMutableTreeNode theUnitRoot = new DefaultMutableTreeNode("Unit"); - theUnitRoot.add(theUnit); - - thePENode.add(theCommentsRoot); - thePENode.add(theDescRoot); - thePENode.add(theIDRoot); - thePENode.add(theMORoot); - thePENode.add(theSynonyms); - thePENode.add(theTypeRoot); - thePENode.add(theUnitRoot); - - profElemRoot.add(thePENode); - } - - root.add(profAttrRoot); - root.add(resAttrRoot); - root.add(profElemRoot); - - return new DefaultTreeModel(root); - - - } - - /** Auto-generated event handler method */ - protected void openFileMenuItemActionPerformed(ActionEvent evt){ - //TODO add your handler code here - - String filename = File.separator+"tmp"; - JFileChooser fc = new JFileChooser(new File(filename)); - - // Show open dialog; this method does not return until the dialog is closed - int decision = fc.showOpenDialog(this); - - if(decision != JFileChooser.APPROVE_OPTION){ - return; - } - - File selFile = fc.getSelectedFile(); - - //create a buffered reader, read it in, create a new profile from that file - FileReader fr = null; - - try{ - fr = new FileReader(selFile); - } - catch(FileNotFoundException fne){ - LOG.log(Level.SEVERE, fne.getMessage()); - System.out.println(fne.getMessage()); - } - - char [] buf = new char[256]; - StringBuilder sb = new StringBuilder(); - - int numRead; - - try{ - if (fr != null) { - while((numRead = fr.read(buf,0,256)) != -1){ - sb.append(buf,0,numRead); - buf = new char[256]; - } - } - } - catch(IOException ioe){ - LOG.log(Level.SEVERE, ioe.getMessage()); - System.out.println(ioe.getMessage()); - } - - System.out.println("Read in "+sb.toString()); - try{ - createdProfile = new Profile(sb.toString()); - jEditorPane1.setText(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString()); - - getJTree1().setModel(generateModelFromProfile(createdProfile)); - //getJTree1().addMouseListener(new LeafListener(getJTree1())); - }catch(SAXException se){ - LOG.log(Level.SEVERE, se.getMessage()); - System.out.println(se.getMessage()); - } - - - } - - /** Auto-generated event handler method */ - protected void jButton1ActionPerformed(ActionEvent evt){ - //TODO add your handler code here - - //basically we want to set the createdProfile to be generated from the current tree model - //then we want to set the jeditor pane to have the createdProfileText - - createdProfile = generateProfileFromModel(getJTree1().getModel()); - //jEditorPane1.setText(createdProfile.toString()); - jEditorPane1.setText(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString()); - - } - - /** Auto-generated event handler method */ - protected void saveMenuItemActionPerformed(ActionEvent evt){ - //TODO add your handler code here - - - JFileChooser fc = new JFileChooser(); - int decision = fc.showSaveDialog(this); - - if(decision != JFileChooser.APPROVE_OPTION){ - return; - } - - //first thing -- set the created profile to the current tree - createdProfile = generateProfileFromModel(getJTree1().getModel()); - - File file = fc.getSelectedFile(); - FileOutputStream fos = null; - - try{ - System.out.println("Trying to write to "+file.getAbsolutePath()); - fos = new FileOutputStream (file.getAbsolutePath()); - fos.write(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString().getBytes()); - } - catch(FileNotFoundException fne){ - LOG.log(Level.SEVERE, fne.getMessage()); - System.out.println(fne.getMessage()); - } - catch(IOException ioe){ - LOG.log(Level.SEVERE, ioe.getMessage()); - System.out.println(ioe.getMessage()); - } - finally{ - try{ - if (fos != null) { - fos.close(); - } - }catch(Exception ignore){ - //ignore - } - } - - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java b/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java deleted file mode 100755 index 3c9cf92..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java +++ /dev/null @@ -1,41 +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.profile.gui; - -import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; - - -public class profileTree extends JTree{ - - public profileTree(){ - setEditable(true); - DefaultMutableTreeNode dtmRoot = new DefaultMutableTreeNode("Profile"); - DefaultMutableTreeNode resAttrRoot = new DefaultMutableTreeNode("Resource Attributes"); - DefaultMutableTreeNode profAttrRoot = new DefaultMutableTreeNode("Profile Attributes"); - DefaultMutableTreeNode profElemRoot = new DefaultMutableTreeNode("Profile Elements"); - dtmRoot.add(resAttrRoot); - dtmRoot.add(profAttrRoot); - dtmRoot.add(profElemRoot); - DefaultTreeModel theModel = new DefaultTreeModel(dtmRoot); - setModel(theModel); - } - - -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java deleted file mode 100755 index 8599cfe..0000000 --- a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java +++ /dev/null @@ -1,75 +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. - */ - -/* - * Created on Jun 25, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.apache.oodt.profile.gui.pstructs; - - -import org.apache.oodt.profile.ProfileAttributes; - -/** - * @author mattmann - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public class ProfileAttributesPrinter { - - private ProfileAttributes myProfAttributes=null; - /** - * - */ - public ProfileAttributesPrinter(ProfileAttributes pa) { - super(); - // TODO Auto-generated constructor stub - myProfAttributes = pa; - } - - public String toXMLString(){ - StringBuilder rStr= new StringBuilder(); - - rStr.append("\n"); - rStr.append("\t").append(myProfAttributes.getID()).append("\n"); - rStr.append("\t").append(myProfAttributes.getType()).append("\n"); - rStr.append("\t").append(myProfAttributes.getVersion()).append("\n"); - rStr.append("\t").append(myProfAttributes.getStatusID()).append("\n"); - rStr.append("\t").append(myProfAttributes.getSecurityType()).append("\n"); - rStr.append("\t").append(myProfAttributes.getParent()).append("\n"); - - for (Object o1 : myProfAttributes.getChildren()) { - String theChild = (String) o1; - rStr.append("\t").append(theChild).append("\n"); - } - - rStr.append("\t").append(myProfAttributes.getRegAuthority()).append("\n"); - - for (Object o : myProfAttributes.getRevisionNotes()) { - String theNote = (String) o; - rStr.append("\t").append(theNote).append("\n"); - } - - rStr.append("\n\n"); - - - return rStr.toString(); - } -}