Skip to content

Commit

Permalink
Merge branch 'legend' of github.com:eduramiba/gephi into legend
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Jun 16, 2013
2 parents 6948286 + 2e5ef5f commit 747769f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion AttributesImpl/manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Manifest-Version: 1.0
AutoUpdate-Essential-Module: true
OpenIDE-Module: org.gephi.data.attributes
OpenIDE-Module-Localizing-Bundle: org/gephi/data/attributes/Bundle.properties
OpenIDE-Module-Specification-Version: 0.8.0.3
OpenIDE-Module-Specification-Version: 0.8.0.5

102 changes: 49 additions & 53 deletions AttributesImpl/src/org/gephi/data/attributes/AttributeTableImpl.java
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Martin Škurla <bujacik@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Martin Škurla <bujacik@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.data.attributes;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeColumn;
import org.gephi.data.attributes.api.AttributeEvent;
import org.gephi.data.attributes.api.AttributeOrigin;
import org.gephi.data.attributes.api.AttributeTable;
import org.gephi.data.attributes.api.AttributeType;
import org.gephi.data.attributes.event.ColumnEvent;
import org.gephi.data.attributes.spi.AttributeValueDelegateProvider;
Expand Down Expand Up @@ -126,9 +126,9 @@ private synchronized AttributeColumnImpl addColumn(String id, String title, Attr
}
AttributeColumnImpl column = new AttributeColumnImpl(this, columns.size(), id, title, type, origin, defaultValue, attributeValueDelegateProvider);
columns.add(column);
columnsMap.put(id, column);
columnsMap.put(id.toLowerCase(), column);
if (title != null && !title.equals(id)) {
columnsMap.put(title, column);
columnsMap.put(title.toLowerCase(), column);
}
columnsSet.put(column, column);

Expand All @@ -155,9 +155,9 @@ public synchronized void removeColumn(AttributeColumn column) {
}
//Remove from collections
columns.remove((AttributeColumnImpl) column);
columnsMap.remove(column.getId());
columnsMap.remove(column.getId().toLowerCase());
if (column.getTitle() != null && !column.getTitle().equals(column.getId())) {
columnsMap.remove(column.getTitle());
columnsMap.remove(column.getTitle().toLowerCase());
}
columnsSet.remove(column);

Expand All @@ -174,24 +174,24 @@ public synchronized AttributeColumn replaceColumn(AttributeColumn source, Attrib
return null;
}
//Remove from collections
columnsMap.remove(source.getId());
columnsMap.remove(source.getId().toLowerCase());
if (source.getTitle() != null && !source.getTitle().equals(source.getId())) {
columnsMap.remove(source.getTitle());
columnsMap.remove(source.getTitle().toLowerCase());
}
columnsSet.remove(source);

//Add
targetImpl.index = index;
columns.set(index, targetImpl);
columnsMap.put(targetImpl.id, targetImpl);
columnsMap.put(targetImpl.id.toLowerCase(), targetImpl);
if (targetImpl.title != null && !targetImpl.title.equals(targetImpl.id)) {
columnsMap.put(targetImpl.title.toLowerCase(), targetImpl);
}
columnsSet.put(targetImpl, targetImpl);

model.fireAttributeEvent(
new ColumnEvent(AttributeEvent.EventType.REPLACE_COLUMN, (AttributeColumnImpl) source));

//Version
version++;
return targetImpl;
Expand Down Expand Up @@ -221,11 +221,7 @@ public synchronized AttributeColumnImpl getColumn(int index) {
}

public synchronized AttributeColumnImpl getColumn(String id) {
AttributeColumnImpl col = columnsMap.get(id);
if (col == null) {
return columnsMap.get(id.toLowerCase());
}
return col;
return columnsMap.get(id.toLowerCase());
}

public synchronized AttributeColumnImpl getColumn(String title, AttributeType type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public boolean writeRow(XMLStreamWriter writer, AttributeRowImpl row) throws XML

public void readRow(XMLStreamReader reader, AbstractAttributeModel model, AttributeTableImpl table, AttributeRowImpl row) throws XMLStreamException {
row.setRowVersion(Integer.parseInt(reader.getAttributeValue(null, "version")));
AttributeColumnImpl col = null;
Integer index = null;
String value = "";

boolean end = false;
Expand All @@ -162,26 +162,26 @@ public void readRow(XMLStreamReader reader, AbstractAttributeModel model, Attrib
case XMLStreamReader.START_ELEMENT:
String name = reader.getLocalName();
if (ELEMENT_VALUE.equalsIgnoreCase(name)) {
col = (AttributeColumnImpl) table.getColumn(Integer.parseInt(reader.getAttributeValue(null, "index")));
index = Integer.parseInt(reader.getAttributeValue(null, "index"));
}
break;
case XMLStreamReader.CHARACTERS:
if (!reader.isWhiteSpace() && col != null) {
if (!reader.isWhiteSpace() && index != null) {
value += reader.getText();
}
break;
case XMLStreamReader.END_ELEMENT:
if (ELEMENT_NODE_ROW.equalsIgnoreCase(reader.getLocalName()) || ELEMENT_EDGE_ROW.equalsIgnoreCase(reader.getLocalName())) {
end = true;
}
if (!value.isEmpty() && col != null) {
AttributeType type = col.getType();
if (!value.isEmpty() && index != null) {
AttributeType type = table.getColumn(index).getType();
Object v = type.parse(value);
v = model.getManagedValue(v, type);
row.setValue(col, v);
row.setValue(index, v);
}
value = "";
col = null;
index = null;
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions FiltersImpl/manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ Manifest-Version: 1.0
AutoUpdate-Essential-Module: true
OpenIDE-Module: org.gephi.filters
OpenIDE-Module-Localizing-Bundle: org/gephi/filters/Bundle.properties
OpenIDE-Module-Specification-Version: 0.8.0.5

OpenIDE-Module-Specification-Version: 0.8.0.6
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ public void readXML(XMLStreamReader reader) throws XMLStreamException {
if (parent != null) {
int parentId = Integer.parseInt(parent);
Query parentQuery = idMap.get(parentId);
model.setSubQuery(parentQuery, query);

//A plugin filter may be missing, or the parent filter could not be deserialized.
//For example a partition filter, which depends on partitions, and partitions are not serialized
if (parentQuery != null) {
model.setSubQuery(parentQuery, query);
}
} else {
//Top query
model.addFirst(query);
Expand Down

0 comments on commit 747769f

Please sign in to comment.