Java Code Examples for org.netbeans.swing.outline.Outline#setRootVisible()

The following examples show how to use org.netbeans.swing.outline.Outline#setRootVisible() . 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 File: FileSelectionPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the table of the available files.
 */
@NbBundle.Messages({
    "FileSelectionPanel.fileColumn.title=File",
    "FileSelectionPanel.installColumn.title=Install"
})
private void initOutlineView() {
    outlineView = new OutlineView(Bundle.FileSelectionPanel_fileColumn_title());
    outlineView.setAllowedDragActions(DnDConstants.ACTION_NONE);
    outlineView.setAllowedDropActions(DnDConstants.ACTION_NONE);
    outlineView.setShowNodeIcons(false);
    outlineView.addPropertyColumn(
            FileNode.InstallProperty.NAME,
            Bundle.FileSelectionPanel_installColumn_title());

    Outline outline = outlineView.getOutline();
    outline.setRootVisible(false);        
}
 
Example 2
Source File: KnockoutPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the context view.
 */
@NbBundle.Messages({
    "KnockoutPanel.contextView.name=Name",
    "KnockoutPanel.contextView.value=Value"
})
private void initContextView() {
    contextView = new OutlineView(Bundle.KnockoutPanel_contextView_name());
    contextView.setAllowedDragActions(DnDConstants.ACTION_NONE);
    contextView.setAllowedDropActions(DnDConstants.ACTION_NONE);
    contextView.setShowNodeIcons(false);
    contextView.addPropertyColumn(
            KnockoutNode.ValueProperty.NAME,
            Bundle.KnockoutPanel_contextView_value());

    Outline outline = contextView.getOutline();
    outline.setRootVisible(false);
}
 
Example 3
Source File: MetadataViewTopComponent.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
private void initView() {
    setLayout(new BorderLayout());
    outlineView = new OutlineView(nodesColumnName);
    outlineView.setPropertyColumns(COLUMN_NAMES);
    final Outline outline = outlineView.getOutline();
    outline.setRootVisible(false);
    DefaultTableCellRenderer decimalTableCellRenderer = new StringDecimalFormatRenderer();
    outline.setDefaultRenderer(Double.class, decimalTableCellRenderer);
    outline.setDefaultRenderer(Float.class, decimalTableCellRenderer);
    outline.setDefaultRenderer(Node.Property.class, new MetadataOutlineCellRenderer());
    final TableColumnModel columnModel = outline.getColumnModel();
    columnModel.getColumn(0).setCellRenderer(new MetadataOutlineCellRenderer());
    final int[] columnWidths = COLUMN_WIDTHS;
    for (int i = 0; i < columnModel.getColumnCount(); i++) {
        columnModel.getColumn(i).setPreferredWidth(columnWidths[i]);
    }
    add(outlineView, BorderLayout.CENTER);
}
 
Example 4
Source File: TestWebServiceMethodDlg.java    From netbeans with 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 5
Source File: OrderingAttributesTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void initTable() {
        Outline outline = outlineView1.getOutline();
        outline.setRootVisible(false);
//        outline.setAutoResizeMode(ETable.AUTO_RESIZE_OFF);
//        TableColumnModel columnModel = outline.getColumnModel();
//        ETableColumn column = (ETableColumn) columnModel.getColumn(0);
//        ((ETableColumnModel) columnModel).setColumnHidden(column, true);
        ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.COL_Attribute());
        OrderingAttributeNode.createTableColumns(outlineView1);
        outline.setFullyNonEditable(true);
    }
 
Example 6
Source File: DbPagedTableTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void initTable() {
        outlineView1.setNodePopupFactory(new TablePopupFactory());
        Outline outline = outlineView1.getOutline();
        outline.setRootVisible(false);
        outline.setCellSelectionEnabled(true);
//        outline.setAutoResizeMode(ETable.AUTO_RESIZE_OFF);
        outline.setAutoResizeMode(ETable.AUTO_RESIZE_ALL_COLUMNS);
        ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("tid");
        outline.setFullyNonEditable(true);
    }
 
Example 7
Source File: DbTableTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void initTable() {
        outlineView1.setNodePopupFactory(new TablePopupFactory());
        Outline outline = outlineView1.getOutline();
        outline.setRootVisible(false);
        outline.setCellSelectionEnabled(true);
        outline.setAutoResizeMode(ETable.AUTO_RESIZE_OFF);
//        TableColumnModel columnModel = outline.getColumnModel();
//        ETableColumn column = (ETableColumn) columnModel.getColumn(0);
//        ((ETableColumnModel) columnModel).setColumnHidden(column, true);
        ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("tid");
        outline.setFullyNonEditable(true);
    }
 
Example 8
Source File: ResamplingDialog.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JPanel createAdvancedMethodDefinitionPanel() {
    final TableLayout tableLayoutMethodDefinition = new TableLayout(1);
    tableLayoutMethodDefinition.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    tableLayoutMethodDefinition.setTableFill(TableLayout.Fill.HORIZONTAL);
    tableLayoutMethodDefinition.setTableWeightX(1.0);
    tableLayoutMethodDefinition.setTablePadding(4, 4);
    JPanel panel = new JPanel(tableLayoutMethodDefinition);
    if(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct() != null) {
        BandsTreeModel myModel = new BandsTreeModel(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct());

        bandResamplingPresets = new BandResamplingPreset[myModel.getTotalRows()];
        for(int i = 0 ; i < myModel.getTotalRows() ; i++) {
            bandResamplingPresets[i] = new BandResamplingPreset(myModel.getRows()[i], (String) (parameterSupport.getParameterMap().get("downsamplingMethod")) , (String) (parameterSupport.getParameterMap().get("upsamplingMethod")));
        }

        resamplingRowModel = new ResamplingRowModel(bandResamplingPresets, myModel);

        mdl = DefaultOutlineModel.createOutlineModel(
                myModel, resamplingRowModel, true, "Bands");

        outline1 = new Outline();
        outline1.setRootVisible(false);
        outline1.setModel(mdl);

        ResamplingUtils.setUpUpsamplingColumn(outline1,outline1.getColumnModel().getColumn(1), (String) parameterSupport.getParameterMap().get("upsamplingMethod"));
        ResamplingUtils.setUpDownsamplingColumn(outline1,outline1.getColumnModel().getColumn(2), (String) parameterSupport.getParameterMap().get("downsamplingMethod"));
        JScrollPane tableContainer = new JScrollPane(outline1);
        panel.add(tableContainer);

        panel.setVisible(false);
    }
    return panel;
}
 
Example 9
Source File: TestWebServiceMethodDlg.java    From netbeans with 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;
}
 
Example 10
Source File: ResamplingDialog.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private void reactToSourceProductChange(Product product) {
    referenceBandNameBoxPanel.reactToSourceProductChange(product);
    targetWidthAndHeightPanel.reactToSourceProductChange(product);
    targetResolutionPanel.reactToSourceProductChange(product);
    if (product != null) {
        referenceBandButton.setEnabled(product.getBandNames().length > 0);

        final ProductNodeGroup<Band> productBands = product.getBandGroup();
        final ProductNodeGroup<TiePointGrid> productTiePointGrids = product.getTiePointGridGroup();
        double xOffset = Double.NaN;
        double yOffset = Double.NaN;
        if (productBands.getNodeCount() > 0) {
            xOffset = productBands.get(0).getImageToModelTransform().getTranslateX();
            yOffset = productBands.get(0).getImageToModelTransform().getTranslateY();
        } else if (productTiePointGrids.getNodeCount() > 0) {
            xOffset = productTiePointGrids.get(0).getImageToModelTransform().getTranslateX();
            yOffset = productTiePointGrids.get(0).getImageToModelTransform().getTranslateY();
        }
        boolean allowToSetWidthAndHeight = true;
        if (!Double.isNaN(xOffset) && !Double.isNaN(yOffset)) {
            allowToSetWidthAndHeight = allOffsetsAreEqual(productBands, xOffset, yOffset) &&
                    allOffsetsAreEqual(productTiePointGrids, xOffset, yOffset);
        }
        widthAndHeightButton.setEnabled(allowToSetWidthAndHeight);
        final GeoCoding sceneGeoCoding = product.getSceneGeoCoding();
        resolutionButton.setEnabled(sceneGeoCoding instanceof CrsGeoCoding &&
                ResampleUtils.allGridsAlignAtUpperLeftPixel(product));
    }
    if (referenceBandButton.isEnabled()) {
        referenceBandButton.setSelected(true);
        referenceBandNameBoxPanel.setEnabled(true);
    } else if (widthAndHeightButton.isEnabled()) {
        widthAndHeightButton.setSelected(true);
    } else if (resolutionButton.isEnabled()) {
        resolutionButton.setSelected(true);
    }

    if(product != null) {
        advancedMethodDefinitionPanel.removeAll();
        BandsTreeModel myModel = new BandsTreeModel(product);

        bandResamplingPresets = new BandResamplingPreset[myModel.getTotalRows()];
        for(int i = 0 ; i < myModel.getTotalRows() ; i++) {
            bandResamplingPresets[i] = new BandResamplingPreset(myModel.getRows()[i], (String) (parameterSupport.getParameterMap().get("downsamplingMethod")),(String) (parameterSupport.getParameterMap().get("upsamplingMethod")));
        }

        resamplingRowModel = new ResamplingRowModel(bandResamplingPresets, myModel);
        //Create the Outline's model, consisting of the TreeModel and the RowModel
        mdl = DefaultOutlineModel.createOutlineModel(
                myModel, resamplingRowModel, true, "Products");

        Outline outline1 = new Outline();
        outline1.setRootVisible(false);
        outline1.setModel(mdl);

        ResamplingUtils.setUpUpsamplingColumn(outline1,outline1.getColumnModel().getColumn(1), (String)  parameterSupport.getParameterMap().get("upsamplingMethod"));
        ResamplingUtils.setUpDownsamplingColumn(outline1,outline1.getColumnModel().getColumn(2), (String) parameterSupport.getParameterMap().get("downsamplingMethod"));

        JScrollPane tableContainer = new JScrollPane(outline1);
        advancedMethodDefinitionPanel.add(tableContainer);
        advancedMethodDefinitionPanel.revalidate();
        advancedMethodDefinitionPanel.setVisible(advancedMethodCheckBox.isSelected());
    }
}