Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello my dear friends!
I want to insert ProductView panel to my custom Product Structure Explorer tab.
Can you post some java code example?
I have wrote following code, but I don`t know how to assign document to be visualised in com.ptc.windchill.explorer.structureexplorer.visualization.pvlite.PVLitePanel.
package com.ptc.windchill.explorer.structureexplorer.explorer.tabs;
import java.awt.GridLayout;
import java.util.List;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import wt.doc.WTDocument;
import com.ptc.core.meta.type.common.TypeInstance;
import com.ptc.windchill.explorer.structureexplorer.visualization.pvlite.PVLitePanel;
import com.ptc.windchill.mpml.explorer.common.MPMStructureExplorerApplet;
import ext.elm.mpml.t.InstanceProxy;
public class SketchesPanel extends JPanel {
private JList list;
/**
* Create the panel
*/
public SketchesPanel(List<wtdocument> docs, TypeInstance typeinstance) {
super();
setLayout(new GridLayout(1, 0));
final JTabbedPane tabbedPane = new JTabbedPane();
add(tabbedPane);
final JPanel panel = new JPanel();
panel.setLayout(null);
String[] listNames = new String[docs.size()];
int i = 0;
for (WTDocument d : docs) {
listNames[i++] = d.getDisplayIdentifier().toString();
/* TypeInstanceIdentifier t6 = com.ptc.core.meta.server.TypeIdentifierUtility
.getTypeInstanceIdentifier(d).getClass();*/
// System.out.println("TypeInstanceIdentifier= "+t6);
}
list = new JList(listNames);
list.setBounds(30, 29, 61, 137);
panel.add(list);
PVLitePanel pvl = new PVLitePanel(null);
pvl.setStatusBarVisible(true);
pvl.startPVLitePanel();
tabbedPane.addTab("my tab1", null, panel, null);
tabbedPane.addTab("pv tab", pvl);
// VisualizationPanelTab vpt = new VisualizationPanelTab();
// tabbedPane.addTab("my tab", null, vpt, null);
// TypeInstance typeinstance=TypeInstanceTools.getTypeInstance(
// docs.get(0));
/*try {
pvl.getPVLiteProxy().setRootNode((ComponentNode) null);
} catch (Exception e) {
e.printStackTrace();
}*/
// VisualizationPanelTab vpt = new VisualizationPanelTab();
// tabbedPane.addTab("my panel", null, vpt, null);
pvl.getPVLiteProxy().selectNode(new InstanceProxy());
}
public static void main(String[] args) {
String[] s = { "wt.context.verbose=false",
"application=ptc.cust.ProcessPlanExplorer",
"container_id=wt.pdmlink.PDMLinkProduct:15702136" };
// AbstractMPMStructureExplorerManager am;
MPMStructureExplorerApplet.main(s);
// GenericManagerApplet.main(s);
// TypeInstanceViewerApplication.main(s);
}
}