Java Code Examples for org.netbeans.swing.outline.RowModel

The following examples show how to use org.netbeans.swing.outline.RowModel. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jlibs   Source File: XSDOutlinePanel.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"unchecked"})
public void setXSModel(XSModel model, MyNamespaceSupport nsSupport){
    Navigator navigator1 = new FilteredTreeNavigator(new XSNavigator(), new XSDisplayFilter());
    Navigator navigator = new PathNavigator(navigator1);
    XSPathDiplayFilter filter = new XSPathDiplayFilter(navigator1);
    navigator = new FilteredTreeNavigator(navigator, filter);
    
    TreeModel treeModel = new NavigatorTreeModel(new Path(model), navigator);
    RowModel rowModel = new DefaultRowModel(new DefaultColumn("Detail", String.class, new XSDisplayValueVisitor(nsSupport))/*, new ClassColumn()*/);

    outline.setModel(DefaultOutlineModel.createOutlineModel(treeModel, rowModel));
    outline.getColumnModel().getColumn(1).setMinWidth(150);

    DefaultRenderDataProvider dataProvider = new DefaultRenderDataProvider();
    dataProvider.setDisplayNameVisitor(new XSDisplayNameVisitor(nsSupport, filter));
    dataProvider.setForegroundVisitor(new XSColorVisitor(filter));
    dataProvider.setFontStyleVisitor(new XSFontStyleVisitor(filter));
    outline.setRenderDataProvider(dataProvider);
}
 
Example 2
Source Project: netbeans   Source File: OutlineView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This method allows plugging own OutlineModel to the OutlineView.
 * You can override it and create different model in the subclass.
 */
protected OutlineModel createOutlineModel(NodeTreeModel treeModel, RowModel rowModel, String label) {
    if (label == null) {
        label = NbBundle.getMessage(OutlineView.class, "NodeOutlineModel_NodesColumnLabel"); // NOI18N
    }
    return new NodeOutlineModel(treeModel, rowModel, false, label);
}
 
Example 3
Source Project: netbeans   Source File: TestWebServiceMethodDlg.java    License: Apache License 2.0 5 votes vote down vote up
private Outline loadResultTreeTable(JavaMethod inMethod, Object inResultObject) throws WebServiceReflectionException {
    if(null == inMethod) {
        return null;
    }
    JavaType currentType = inMethod.getReturnType();
    String typeName = currentType.getRealName();
    TypeNodeData data = ReflectionHelper.createTypeData(typeName, inResultObject);

    DefaultMutableTreeNode node = NodeHelper.getInstance().createResultNodeFromData(data);

    /**
     * Make sure to create a new result root each time since the user can change the parameters and submit many
     * times.
     */
    this.setResultRootNode(new DefaultMutableTreeNode());
    /**
     *  Add it to the root.
     */
    this.getResultRootNode().add(node);

    DefaultTreeModel treeModel = new DefaultTreeModel(this.getResultRootNode());
    RowModel rowModel = new ResultRowModel();
    OutlineModel outlineModel = DefaultOutlineModel.createOutlineModel(treeModel,
            rowModel, false,NbBundle.getMessage(this.getClass(), 
            "TYPE_COLUMN_NAME"));
    Outline returnOutline = new Outline(outlineModel);
    ResultCellEditor cellEditor = new ResultCellEditor();
    returnOutline.setDefaultEditor(Object.class,cellEditor);
    returnOutline.setRootVisible(false);

    returnOutline.setRenderDataProvider(new TypeDataProvider());

    return returnOutline;
}
 
Example 4
Source Project: jlibs   Source File: OutlineNavigatorTest.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"unchecked"})
public static void main(String[] args) throws Exception{
    String url = JOptionPane.showInputDialog("File/URL", "http://schemas.xmlsoap.org/wsdl/");
    if(url==null)
        return;
    XSModel model = new XSParser().parse(url);
    MyNamespaceSupport nsSupport = XSUtil.createNamespaceSupport(model);

    Navigator navigator1 = new FilteredTreeNavigator(new XSNavigator(), new XSDisplayFilter());
    Navigator navigator = new PathNavigator(navigator1);
    XSPathDiplayFilter filter = new XSPathDiplayFilter(navigator1);
    navigator = new FilteredTreeNavigator(navigator, filter);
    TreeModel treeModel = new NavigatorTreeModel(new Path(model), navigator);
    RowModel rowModel = new DefaultRowModel(new DefaultColumn("Detail", String.class, new XSDisplayValueVisitor(nsSupport))/*, new ClassColumn()*/);
    
    OutlineNavigatorTest test = new OutlineNavigatorTest("Navigator Test");
    Outline outline = test.getOutline();
    outline.setShowGrid(false);
    outline.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
    outline.setModel(DefaultOutlineModel.createOutlineModel(treeModel, rowModel));
    outline.getColumnModel().getColumn(1).setMinWidth(150);

    DefaultRenderDataProvider dataProvider = new DefaultRenderDataProvider();
    dataProvider.setDisplayNameVisitor(new XSDisplayNameVisitor(nsSupport, filter));
    dataProvider.setForegroundVisitor(new XSColorVisitor(filter));
    dataProvider.setFontStyleVisitor(new XSFontStyleVisitor(filter));
    outline.setRenderDataProvider(dataProvider);
    
    test.setVisible(true);
}
 
Example 5
Source Project: netbeans   Source File: OutlineView.java    License: Apache License 2.0 4 votes vote down vote up
public NodeOutlineModel(NodeTreeModel treeModel, RowModel rowModel, boolean largeModel, String nodesColumnLabel) {
    super( treeModel, rowModel, largeModel, nodesColumnLabel );
}
 
Example 6
Source Project: netbeans   Source File: TestWebServiceMethodDlg.java    License: Apache License 2.0 4 votes vote down vote up
private Outline loadParameterTreeTable(JavaMethod inMethod) throws WebServiceReflectionException {
    if(null == inMethod) {
        return null;
    }

    List<JavaParameter> parameters = inMethod.getParametersList();
    for (JavaParameter currentParameter : parameters) {
        /**
         * Add all Parameter's to the root tree node.
         */
        JavaType currentType = currentParameter.getType();

        String typeName = currentType.getRealName();
        String typeParamName = currentParameter.getName();

        if (currentParameter.isHolder()) {
            typeName = "javax.xml.ws.Holder<" + typeName + ">"; // NOI18N
        }

        TypeNodeData data = ReflectionHelper.createTypeData(typeName, typeParamName);
        data.setTypeValue(NodeHelper.getInstance().getParameterDefaultValue(data));
        if (currentParameter.isHolder()) {
            if (currentParameter.isIN()) data.setHolderType(TypeNodeData.IN);
            if (currentParameter.isOUT()) data.setHolderType(TypeNodeData.OUT);
            if (currentParameter.isINOUT()) data.setHolderType(TypeNodeData.IN_OUT);
        }

        DefaultMutableTreeNode node = NodeHelper.getInstance().createNodeFromData(data);

        /**
         *  Add it to the root.
         */
        this.getParamterRootNode().add(node);
    }

    DefaultTreeModel treeModel = new DefaultTreeModel(this.getParamterRootNode());
    RowModel rowModel = new TypeRowModel(this.getRuntimeClassLoader());
    OutlineModel outlineModel = DefaultOutlineModel.createOutlineModel(
            treeModel,rowModel, false,NbBundle.getMessage(this.getClass(), 
            "TYPE_COLUMN_NAME"));       // NOI18N
    Outline returnOutline = new Outline(outlineModel);
    TypeCellEditor cellEditor = new TypeCellEditor(getRuntimeClassLoader());
    returnOutline.setDefaultEditor(Object.class,cellEditor);
    returnOutline.setRootVisible(false);
    returnOutline.setRenderDataProvider(new TypeDataProvider());
    /**
     * Fix Bug 5052705.  This setting will cause the cells values to take affect when
     * the focus is lost.  This will remove the requirement of hitting "ENTER" after
     * entering a value in a cell to get the value to take affect.
     */
    returnOutline.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // NOI18N

    return returnOutline;
}