Search in sources :

Example 1 with SizeRenderer

use of com.android.tools.idea.apk.viewer.ApkViewPanel.SizeRenderer in project android by JetBrains.

the class ApkDiffPanel method createUIComponents.

private void createUIComponents() {
    myTreeModel = new DefaultTreeModel(new LoadingNode());
    myTree = new Tree(myTreeModel);
    myTree.setShowsRootHandles(true);
    // show root node only when showing LoadingNode
    myTree.setRootVisible(true);
    myTree.setPaintBusy(true);
    Convertor<TreePath, String> convertor = new Convertor<TreePath, String>() {

        @Override
        public String convert(TreePath path) {
            ApkEntry e = ApkEntry.fromNode(path.getLastPathComponent());
            if (e == null) {
                return null;
            }
            return e.getPath();
        }
    };
    TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(myTree, convertor, true);
    ColumnTreeBuilder builder = new ColumnTreeBuilder(myTree).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("File").setPreferredWidth(600).setHeaderAlignment(SwingConstants.LEADING).setRenderer(new NameRenderer(treeSpeedSearch))).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Old Size").setPreferredWidth(150).setHeaderAlignment(SwingConstants.TRAILING).setRenderer(new SizeRenderer(ApkDiffEntry::getOldSize))).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("New Size").setPreferredWidth(150).setHeaderAlignment(SwingConstants.TRAILING).setRenderer(new SizeRenderer(ApkDiffEntry::getNewSize))).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Diff Size").setPreferredWidth(150).setHeaderAlignment(SwingConstants.TRAILING).setRenderer(new SizeRenderer(ApkEntry::getSize)));
    myColumnTreePane = (JScrollPane) builder.build();
}
Also used : SizeRenderer(com.android.tools.idea.apk.viewer.ApkViewPanel.SizeRenderer) NameRenderer(com.android.tools.idea.apk.viewer.ApkViewPanel.NameRenderer) TreeSpeedSearch(com.intellij.ui.TreeSpeedSearch) LoadingNode(com.intellij.ui.LoadingNode) ApkEntry(com.android.tools.idea.apk.viewer.ApkEntry) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Convertor(com.intellij.util.containers.Convertor) TreePath(javax.swing.tree.TreePath) ColumnTreeBuilder(com.android.tools.adtui.common.ColumnTreeBuilder) Tree(com.intellij.ui.treeStructure.Tree)

Aggregations

ColumnTreeBuilder (com.android.tools.adtui.common.ColumnTreeBuilder)1 ApkEntry (com.android.tools.idea.apk.viewer.ApkEntry)1 NameRenderer (com.android.tools.idea.apk.viewer.ApkViewPanel.NameRenderer)1 SizeRenderer (com.android.tools.idea.apk.viewer.ApkViewPanel.SizeRenderer)1 LoadingNode (com.intellij.ui.LoadingNode)1 TreeSpeedSearch (com.intellij.ui.TreeSpeedSearch)1 Tree (com.intellij.ui.treeStructure.Tree)1 Convertor (com.intellij.util.containers.Convertor)1 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1 TreePath (javax.swing.tree.TreePath)1