use of org.gephi.visualization.VizModel in project gephi by gephi.
the class GlobalSettingsPanel method refreshSharedConfig.
private void refreshSharedConfig() {
VizModel vizModel = VizController.getInstance().getVizModel();
setEnable(!vizModel.isDefaultModel());
if (vizModel.isDefaultModel()) {
return;
}
if (autoSelectNeigborCheckbox.isSelected() != vizModel.isAutoSelectNeighbor()) {
autoSelectNeigborCheckbox.setSelected(vizModel.isAutoSelectNeighbor());
}
((JColorButton) backgroundColorButton).setColor(vizModel.getBackgroundColor());
if (hightlightCheckBox.isSelected() != vizModel.isLightenNonSelectedAuto()) {
hightlightCheckBox.setSelected(vizModel.isLightenNonSelectedAuto());
}
}
use of org.gephi.visualization.VizModel in project gephi by gephi.
the class VizBarController method getToolbar.
public VizToolbar getToolbar() {
VizModel model = VizController.getInstance().getVizModel();
toolbar = new VizToolbar(groups);
toolbar.setEnable(!model.isDefaultModel());
return toolbar;
}
use of org.gephi.visualization.VizModel in project gephi by gephi.
the class EdgeSettingsPanel method setup.
public void setup() {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("init")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeHasUniColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("showEdges")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeUniColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeInSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeOutSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeBothSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeScale")) {
refreshSharedConfig();
}
}
});
refreshSharedConfig();
showEdgesCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setShowEdges(showEdgesCheckbox.isSelected());
setEnable(true);
}
});
((JColorButton) edgeColorButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeUniColor(((JColorButton) edgeColorButton).getColorArray());
}
});
sourceNodeColorCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeHasUniColor(!sourceNodeColorCheckbox.isSelected());
}
});
selectionColorCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeSelectionColor(selectionColorCheckbox.isSelected());
}
});
edgeInSelectionColorChooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeInSelectionColor(edgeInSelectionColorChooser.getColor().getComponents(null));
}
});
edgeBothSelectionColorChooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeBothSelectionColor(edgeBothSelectionColorChooser.getColor().getComponents(null));
}
});
edgeOutSelectionColorChooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeOutSelectionColor(edgeOutSelectionColorChooser.getColor().getComponents(null));
}
});
scaleSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
if (vizModel.getEdgeScale() != (scaleSlider.getValue() / 10f + 0.1f)) {
vizModel.setEdgeScale(scaleSlider.getValue() / 10f + 0.1f);
}
}
});
}
use of org.gephi.visualization.VizModel in project gephi by gephi.
the class LabelSettingsPanel method refreshSharedConfig.
private void refreshSharedConfig() {
VizModel vizModel = VizController.getInstance().getVizModel();
setEnable(!vizModel.isDefaultModel());
if (vizModel.isDefaultModel()) {
return;
}
TextModelImpl model = vizModel.getTextModel();
// node
nodeFontButton.setText(model.getNodeFont().getFontName() + ", " + model.getNodeFont().getSize());
((JColorButton) nodeColorButton).setColor(model.getNodeColor());
if (showNodeLabelsCheckbox.isSelected() != model.isShowNodeLabels()) {
showNodeLabelsCheckbox.setSelected(model.isShowNodeLabels());
}
if (nodeSizeSlider.getValue() / 100f != model.getNodeSizeFactor()) {
nodeSizeSlider.setValue((int) (model.getNodeSizeFactor() * 100f));
}
// edge
edgeFontButton.setText(model.getEdgeFont().getFontName() + ", " + model.getEdgeFont().getSize());
((JColorButton) edgeColorButton).setColor(model.getEdgeColor());
if (showEdgeLabelsCheckbox.isSelected() != model.isShowEdgeLabels()) {
showEdgeLabelsCheckbox.setSelected(model.isShowEdgeLabels());
}
if (edgeSizeSlider.getValue() / 100f != model.getEdgeSizeFactor()) {
edgeSizeSlider.setValue((int) (model.getEdgeSizeFactor() * 100f));
}
// general
if (hideNonSelectedCheckbox.isSelected() != model.isSelectedOnly()) {
hideNonSelectedCheckbox.setSelected(model.isSelectedOnly());
}
if (sizeModeCombo.getSelectedItem() != model.getSizeMode()) {
sizeModeCombo.setSelectedItem(model.getSizeMode());
}
if (colorModeCombo.getSelectedItem() != model.getColorMode()) {
colorModeCombo.setSelectedItem(model.getColorMode());
}
}
use of org.gephi.visualization.VizModel in project gephi by gephi.
the class CompatibilityEngine method display.
@Override
public synchronized void display(GL2 gl, GLU glu) {
markTime++;
VizModel vizModel = VizController.getInstance().getVizModel();
// Edges
if (edgeModeler.isEnabled()) {
edgeModeler.beforeDisplay(gl, glu);
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.markTime != markTime) {
obj.display(gl, glu, vizModel);
obj.markTime = markTime;
}
}
edgeModeler.afterDisplay(gl, glu);
}
markTime++;
// Arrows
if (edgeModeler.isEnabled() && vizConfig.isShowArrows() && dataBridge.isDirected()) {
gl.glBegin(GL2.GL_TRIANGLES);
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.getEdge().isDirected() && obj.markTime != markTime) {
obj.displayArrow(gl, glu, vizModel);
obj.markTime = markTime;
}
}
gl.glEnd();
}
// Nodes
if (nodeModeler.isEnabled()) {
nodeModeler.beforeDisplay(gl, glu);
for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (obj.markTime != markTime) {
obj.display(gl, glu, vizModel);
obj.markTime = markTime;
}
}
nodeModeler.afterDisplay(gl, glu);
}
// Labels
if (vizModel.getTextModel().isShowNodeLabels() || vizModel.getTextModel().isShowEdgeLabels()) {
markTime++;
if (nodeModeler.isEnabled() && vizModel.getTextModel().isShowNodeLabels()) {
textManager.getNodeRenderer().beginRendering();
textManager.defaultNodeColor();
if (textManager.isSelectedOnly()) {
for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (obj.markTime != markTime) {
if (obj.isSelected() && obj.isTextVisible()) {
textManager.getNodeRenderer().drawTextNode(obj);
}
obj.markTime = markTime;
}
}
} else {
for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (obj.markTime != markTime) {
if (obj.isTextVisible()) {
textManager.getNodeRenderer().drawTextNode(obj);
}
obj.markTime = markTime;
}
}
}
textManager.getNodeRenderer().endRendering();
}
// }
if (edgeModeler.isEnabled() && vizModel.getTextModel().isShowEdgeLabels()) {
markTime++;
textManager.getEdgeRenderer().beginRendering();
textManager.defaultEdgeColor();
if (textManager.isSelectedOnly()) {
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.markTime != markTime) {
if ((obj.isSelected() || obj.isAutoSelected()) && obj.isTextVisible()) {
textManager.getEdgeRenderer().drawTextEdge(obj);
}
obj.markTime = markTime;
}
}
} else {
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.markTime != markTime) {
if (obj.isTextVisible()) {
textManager.getEdgeRenderer().drawTextEdge(obj);
}
obj.markTime = markTime;
}
}
}
textManager.getEdgeRenderer().endRendering();
}
}
// octree.displayOctree(gl, glu);
}
Aggregations