use of org.gephi.datalab.spi.values.AttributeValueManipulator in project gephi by gephi.
the class PopupMenuUtils method createSubMenuFromRowColumn.
public static JMenu createSubMenuFromRowColumn(Element row, Column column) {
DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
JMenu subMenu = new JMenu(NbBundle.getMessage(PopupMenuUtils.class, "Cell.Popup.subMenu.text"));
subMenu.setIcon(ImageUtilities.loadImageIcon("org/gephi/desktop/datalab/resources/table-select.png", true));
Integer lastManipulatorType = null;
for (AttributeValueManipulator am : dlh.getAttributeValueManipulators()) {
am.setup(row, column);
if (lastManipulatorType == null) {
lastManipulatorType = am.getType();
}
if (lastManipulatorType != am.getType()) {
subMenu.addSeparator();
}
lastManipulatorType = am.getType();
subMenu.add(PopupMenuUtils.createMenuItemFromManipulator(am));
}
if (subMenu.getMenuComponentCount() == 0) {
subMenu.setEnabled(false);
}
return subMenu;
}
use of org.gephi.datalab.spi.values.AttributeValueManipulator in project gephi by gephi.
the class DataLaboratoryHelper method getAttributeValueManipulators.
/**
* <p>Prepares an array with one new instance of every AttributeValueManipulator
* that has a builder registered and returns it.</p>
* <p>It also returns the manipulators ordered first by type and then by position.</p>
* @return Array of all AttributeValueManipulator implementations
*/
public AttributeValueManipulator[] getAttributeValueManipulators() {
ArrayList<AttributeValueManipulator> attributeValueManipulators = new ArrayList<>();
for (AttributeValueManipulatorBuilder am : Lookup.getDefault().lookupAll(AttributeValueManipulatorBuilder.class)) {
attributeValueManipulators.add(am.getAttributeValueManipulator());
}
sortManipulators(attributeValueManipulators);
return attributeValueManipulators.toArray(new AttributeValueManipulator[0]);
}
Aggregations