Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 217106 | Differences between
and this patch

Collapse All | Expand All

(-)maven.graph/nbproject/project.xml (+9 lines)
 Lines 121-126    Link Here 
121
                    </run-dependency>
121
                    </run-dependency>
122
                </dependency>
122
                </dependency>
123
                <dependency>
123
                <dependency>
124
                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
125
                    <build-prerequisite/>
126
                    <compile-dependency/>
127
                    <run-dependency>
128
                        <release-version>1</release-version>
129
                        <specification-version>1.71</specification-version>
130
                    </run-dependency>
131
                </dependency>
132
                <dependency>
124
                    <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
133
                    <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
125
                    <build-prerequisite/>
134
                    <build-prerequisite/>
126
                    <compile-dependency/>
135
                    <compile-dependency/>
(-)maven.graph/src/org/netbeans/modules/maven/graph/ArtifactWidget.java (-6 / +17 lines)
 Lines 50-55    Link Here 
50
import java.awt.event.ActionEvent;
50
import java.awt.event.ActionEvent;
51
import java.awt.event.ActionListener;
51
import java.awt.event.ActionListener;
52
import java.util.List;
52
import java.util.List;
53
import javax.swing.Icon;
53
import javax.swing.Timer;
54
import javax.swing.Timer;
54
import javax.swing.UIManager;
55
import javax.swing.UIManager;
55
import org.apache.maven.artifact.Artifact;
56
import org.apache.maven.artifact.Artifact;
 Lines 109-115    Link Here 
109
    private Timer hoverTimer;
110
    private Timer hoverTimer;
110
    private Color hoverBorderC;
111
    private Color hoverBorderC;
111
112
112
    private LabelWidget artifactW, versionW;
113
    private Widget artifactW;
114
    private LabelWidget versionW;
113
    private Widget contentW;
115
    private Widget contentW;
114
    private ImageWidget lockW, fixHintW;
116
    private ImageWidget lockW, fixHintW;
115
117
 Lines 120-126    Link Here 
120
122
121
    private String tooltipText;
123
    private String tooltipText;
122
124
123
    ArtifactWidget(DependencyGraphScene scene, ArtifactGraphNode node) {
125
    ArtifactWidget(DependencyGraphScene scene, ArtifactGraphNode node, Icon icon) {
124
        super(scene);
126
        super(scene);
125
        this.node = node;
127
        this.node = node;
126
128
 Lines 128-134    Link Here 
128
        setLayout(LayoutFactory.createVerticalFlowLayout());
130
        setLayout(LayoutFactory.createVerticalFlowLayout());
129
131
130
        updateTooltip();
132
        updateTooltip();
131
        initContent(scene, artifact);
133
        initContent(scene, artifact, icon);
132
134
133
        hoverTimer = new Timer(500, this);
135
        hoverTimer = new Timer(500, this);
134
        hoverTimer.setRepeats(false);
136
        hoverTimer.setRepeats(false);
 Lines 273-284    Link Here 
273
    }
275
    }
274
276
275
    @Messages("ACT_FixVersionConflict=Fix Version Conflict...")
277
    @Messages("ACT_FixVersionConflict=Fix Version Conflict...")
276
    private void initContent (DependencyGraphScene scene, Artifact artifact) {
278
    private void initContent (DependencyGraphScene scene, Artifact artifact, Icon icon) {
277
        contentW = new LevelOfDetailsWidget(scene, 0.05, 0.1, Double.MAX_VALUE, Double.MAX_VALUE);
279
        contentW = new LevelOfDetailsWidget(scene, 0.05, 0.1, Double.MAX_VALUE, Double.MAX_VALUE);
278
        contentW.setBorder(BorderFactory.createLineBorder(10));
280
        contentW.setBorder(BorderFactory.createLineBorder(10));
279
        contentW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1));
281
        contentW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1));
280
        artifactW = new LabelWidget(scene);
282
281
        artifactW.setLabel(artifact.getArtifactId() + "  ");
283
        //Artifact name (with optional project icon on the left)
284
        artifactW = new Widget(scene);
285
        artifactW.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 4));
286
        if (null != icon) {
287
            artifactW.addChild(new ImageWidget(scene, ImageUtilities.icon2Image(icon)));
288
        }
289
        final LabelWidget labelWidget = new LabelWidget(scene, artifact.getArtifactId() + "  ");
290
        labelWidget.setUseGlyphVector(true);
291
        artifactW.addChild(labelWidget);
292
      
282
        if (node.isRoot()) {
293
        if (node.isRoot()) {
283
            Font defF = scene.getDefaultFont();
294
            Font defF = scene.getDefaultFont();
284
            artifactW.setFont(defF.deriveFont(Font.BOLD, defF.getSize() + 3f));
295
            artifactW.setFont(defF.deriveFont(Font.BOLD, defF.getSize() + 3f));
(-)maven.graph/src/org/netbeans/modules/maven/graph/DependencyGraphScene.java (-1 / +30 lines)
 Lines 48-58    Link Here 
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.util.ArrayList;
49
import java.util.ArrayList;
50
import java.util.Collection;
50
import java.util.Collection;
51
import java.util.HashMap;
51
import java.util.HashSet;
52
import java.util.HashSet;
52
import java.util.List;
53
import java.util.List;
54
import java.util.Map;
53
import java.util.Set;
55
import java.util.Set;
54
import javax.swing.AbstractAction;
56
import javax.swing.AbstractAction;
55
import javax.swing.Action;
57
import javax.swing.Action;
58
import javax.swing.Icon;
56
import javax.swing.JPopupMenu;
59
import javax.swing.JPopupMenu;
57
import javax.swing.JScrollPane;
60
import javax.swing.JScrollPane;
58
import javax.swing.JSeparator;
61
import javax.swing.JSeparator;
 Lines 63-68    Link Here 
63
import org.apache.maven.shared.dependency.tree.DependencyNode;
66
import org.apache.maven.shared.dependency.tree.DependencyNode;
64
import org.netbeans.api.annotations.common.CheckForNull;
67
import org.netbeans.api.annotations.common.CheckForNull;
65
import org.netbeans.api.project.Project;
68
import org.netbeans.api.project.Project;
69
import org.netbeans.api.project.ProjectUtils;
70
import org.netbeans.api.project.ui.OpenProjects;
66
import org.netbeans.api.visual.action.ActionFactory;
71
import org.netbeans.api.visual.action.ActionFactory;
67
import org.netbeans.api.visual.action.EditProvider;
72
import org.netbeans.api.visual.action.EditProvider;
68
import org.netbeans.api.visual.action.MoveProvider;
73
import org.netbeans.api.visual.action.MoveProvider;
 Lines 126-131    Link Here 
126
131
127
    private static Set<ArtifactGraphNode> EMPTY_SELECTION = new HashSet<ArtifactGraphNode>();
132
    private static Set<ArtifactGraphNode> EMPTY_SELECTION = new HashSet<ArtifactGraphNode>();
128
    private POMModel model;
133
    private POMModel model;
134
    private final Map<Artifact, Icon> projectIcons;
129
    
135
    
130
    /** Creates a new instance ofla DependencyGraphScene */
136
    /** Creates a new instance ofla DependencyGraphScene */
131
    DependencyGraphScene(MavenProject prj, Project nbProj, DependencyGraphTopComponent tc,
137
    DependencyGraphScene(MavenProject prj, Project nbProj, DependencyGraphTopComponent tc,
 Lines 145-150    Link Here 
145
        getActions().addAction(panAction);
151
        getActions().addAction(panAction);
146
        getActions().addAction(editAction);
152
        getActions().addAction(editAction);
147
        getActions().addAction(popupMenuAction);
153
        getActions().addAction(popupMenuAction);
154
        this.projectIcons = getIconsForOpenProjects();
148
    }
155
    }
149
156
150
157
 Lines 183-188    Link Here 
183
        }
190
        }
184
        return null;
191
        return null;
185
    }
192
    }
193
    /**
194
     * @return map of maven artifact mapped to project icon
195
     */
196
    Map<Artifact, Icon> getIconsForOpenProjects() {
197
        Map<Artifact, Icon> result = new HashMap<Artifact, Icon>();
198
        //NOTE: surely not the best way to get the project icon
199
        Project[] openProjects = OpenProjects.getDefault().getOpenProjects();
200
        for (Project project : openProjects) {
201
            NbMavenProject mavenProject = project.getLookup().lookup(NbMavenProject.class);
202
            if (null != mavenProject) {
203
                Artifact artifact = mavenProject.getMavenProject().getArtifact();
204
                //get icon from opened project
205
                Icon icon = ProjectUtils.getInformation(project).getIcon();
206
                if (null != icon) {
207
                    result.put(artifact, icon);
208
                }
209
            }
210
        }
211
        return result;
212
    }
186
    
213
    
187
    @Override protected Widget attachNodeWidget(ArtifactGraphNode node) {
214
    @Override protected Widget attachNodeWidget(ArtifactGraphNode node) {
188
        if (rootNode == null) {
215
        if (rootNode == null) {
 Lines 191-197    Link Here 
191
        if (node.getPrimaryLevel() > maxDepth) {
218
        if (node.getPrimaryLevel() > maxDepth) {
192
            maxDepth = node.getPrimaryLevel();
219
            maxDepth = node.getPrimaryLevel();
193
        }
220
        }
194
        ArtifactWidget root = new ArtifactWidget(this, node);
221
        Artifact artifact = node.getArtifact().getArtifact();
222
        Icon icon = projectIcons.get(artifact);
223
        ArtifactWidget root = new ArtifactWidget(this, node, icon);
195
        mainLayer.addChild(root);
224
        mainLayer.addChild(root);
196
        node.setWidget(root);
225
        node.setWidget(root);
197
        root.setOpaque(true);
226
        root.setOpaque(true);

Return to bug 217106
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo