use of com.intellij.ui.treeStructure.Tree in project Aspose.Imaging-for-Java by aspose-imaging.
the class AsposeExamplePanel method initComponents.
private void initComponents() {
ResourceBundle bundle = ResourceBundle.getBundle("Bundle");
jPanel1 = new JPanel();
jLabel2 = new JLabel();
componentSelection = new ComboBox();
jLabel1 = new JLabel();
jLabelMessage = new JLabel();
jLabelMessage.setOpaque(true);
jScrollPane1 = new JBScrollPane();
examplesTree = new Tree();
jPanel1.setBackground(new Color(255, 255, 255));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setForeground(new Color(255, 255, 255));
// NOI18N
jLabel2.setIcon(icon);
jLabel2.setText("");
jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
jLabel2.setDoubleBuffered(true);
jLabel2.setOpaque(true);
jLabel2.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jLabel2ComponentResized(evt);
}
});
GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup().addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 390, Short.MAX_VALUE));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addComponent(jLabel2).addGap(0, 0, Short.MAX_VALUE)));
componentSelection.setModel(new DefaultComboBoxModel());
componentSelection.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
componentSelection_Propertychanged(evt);
}
});
jLabel1.setText(bundle.getString("AsposeExample.jLabel1_text"));
jLabelMessage.setText("");
examplesTree.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
examplesTree_clicked(evt);
}
});
jScrollPane1.setViewportView(examplesTree);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 361, GroupLayout.PREFERRED_SIZE).addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)));
}
use of com.intellij.ui.treeStructure.Tree in project Aspose.BarCode-for-Java by aspose-barcode.
the class AsposeExamplePanel method initComponents.
private void initComponents() {
ResourceBundle bundle = ResourceBundle.getBundle("Bundle");
jPanel1 = new JPanel();
jLabel2 = new JLabel();
componentSelection = new ComboBox();
jLabel1 = new JLabel();
jLabelMessage = new JLabel();
jLabelMessage.setOpaque(true);
jScrollPane1 = new JBScrollPane();
examplesTree = new Tree();
jPanel1.setBackground(new Color(255, 255, 255));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setForeground(new Color(255, 255, 255));
// NOI18N
jLabel2.setIcon(icon);
jLabel2.setText("");
jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
jLabel2.setDoubleBuffered(true);
jLabel2.setOpaque(true);
jLabel2.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jLabel2ComponentResized(evt);
}
});
GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup().addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 390, Short.MAX_VALUE));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addComponent(jLabel2).addGap(0, 0, Short.MAX_VALUE)));
componentSelection.setModel(new DefaultComboBoxModel());
componentSelection.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
componentSelection_Propertychanged(evt);
}
});
jLabel1.setText(bundle.getString("AsposeExample.jLabel1_text"));
jLabelMessage.setText("");
examplesTree.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
examplesTree_clicked(evt);
}
});
jScrollPane1.setViewportView(examplesTree);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 361, GroupLayout.PREFERRED_SIZE).addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)));
}
use of com.intellij.ui.treeStructure.Tree in project Aspose.OCR-for-Java by aspose-ocr.
the class AsposeExamplePanel method initComponents.
private void initComponents() {
ResourceBundle bundle = ResourceBundle.getBundle("Bundle");
jPanel1 = new JPanel();
jLabel2 = new JLabel();
componentSelection = new ComboBox();
jLabel1 = new JLabel();
jLabelMessage = new JLabel();
jLabelMessage.setOpaque(true);
jScrollPane1 = new JBScrollPane();
examplesTree = new Tree();
jPanel1.setBackground(new Color(255, 255, 255));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setForeground(new Color(255, 255, 255));
// NOI18N
jLabel2.setIcon(icon);
jLabel2.setText("");
jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
jLabel2.setDoubleBuffered(true);
jLabel2.setOpaque(true);
jLabel2.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jLabel2ComponentResized(evt);
}
});
GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup().addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 390, Short.MAX_VALUE));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addComponent(jLabel2).addGap(0, 0, Short.MAX_VALUE)));
componentSelection.setModel(new DefaultComboBoxModel());
componentSelection.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
componentSelection_Propertychanged(evt);
}
});
jLabel1.setText(bundle.getString("AsposeExample.jLabel1_text"));
jLabelMessage.setText("");
examplesTree.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
examplesTree_clicked(evt);
}
});
jScrollPane1.setViewportView(examplesTree);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 361, GroupLayout.PREFERRED_SIZE).addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)));
}
use of com.intellij.ui.treeStructure.Tree in project Aspose.Cells-for-Java by aspose-cells.
the class AsposeExamplePanel method initComponents.
private void initComponents() {
ResourceBundle bundle = ResourceBundle.getBundle("Bundle");
jPanel1 = new JPanel();
jLabel2 = new JLabel();
componentSelection = new ComboBox();
jLabel1 = new JLabel();
jLabelMessage = new JLabel();
jLabelMessage.setOpaque(true);
jScrollPane1 = new JBScrollPane();
examplesTree = new Tree();
jPanel1.setBackground(new Color(255, 255, 255));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setForeground(new Color(255, 255, 255));
// NOI18N
jLabel2.setIcon(icon);
jLabel2.setText("");
jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
jLabel2.setDoubleBuffered(true);
jLabel2.setOpaque(true);
jLabel2.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jLabel2ComponentResized(evt);
}
});
GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup().addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 390, Short.MAX_VALUE));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addComponent(jLabel2).addGap(0, 0, Short.MAX_VALUE)));
componentSelection.setModel(new DefaultComboBoxModel());
componentSelection.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
componentSelection_Propertychanged(evt);
}
});
jLabel1.setText(bundle.getString("AsposeExample.jLabel1_text"));
jLabelMessage.setText("");
examplesTree.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
examplesTree_clicked(evt);
}
});
jScrollPane1.setViewportView(examplesTree);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 361, GroupLayout.PREFERRED_SIZE).addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)));
}
use of com.intellij.ui.treeStructure.Tree in project azure-tools-for-java by Microsoft.
the class ServerExplorerToolWindowFactory method createToolWindowContent.
@Override
@AzureOperation(name = "common|explorer.initialize", type = AzureOperation.Type.SERVICE)
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
// initialize azure service module
AzureModule azureModule = new AzureModuleImpl(project);
HDInsightUtil.setHDInsightRootModule(azureModule);
azureModule.setSparkServerlessModule(new CosmosSparkClusterRootModuleImpl(azureModule));
azureModule.setArcadiaModule(new ArcadiaSparkClusterRootModuleImpl(azureModule));
// initialize aris service module
SqlBigDataClusterModule arisModule = new SqlBigDataClusterModule(project);
// initialize with all the service modules
DefaultTreeModel treeModel = new DefaultTreeModel(initRoot(project, ImmutableList.of(azureModule, arisModule)));
treeModelMap.put(project, treeModel);
// initialize tree
final JTree tree = new Tree(treeModel);
tree.setRootVisible(false);
tree.setCellRenderer(new NodeTreeCellRenderer());
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
new TreeSpeedSearch(tree);
final DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
final DefaultMutableTreeNode azureRoot = (DefaultMutableTreeNode) root.getChildAt(0);
final List<? extends com.microsoft.azure.toolkit.intellij.common.component.Tree.TreeNode<?>> modules = AzureExplorer.getModules().stream().map(m -> new com.microsoft.azure.toolkit.intellij.common.component.Tree.TreeNode<>(m, tree)).collect(Collectors.toList());
modules.forEach(azureRoot::add);
azureModule.setClearResourcesListener(() -> modules.forEach(m -> m.clearChildren()));
com.microsoft.azure.toolkit.intellij.common.component.Tree.installPopupMenu(tree);
treeModel.reload();
DataManager.registerDataProvider(tree, dataId -> {
if (StringUtils.equals(dataId, Action.SOURCE)) {
final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (Objects.nonNull(selectedNode)) {
return selectedNode.getUserObject();
}
}
return null;
});
// add a click handler for the tree
tree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {
treeNodeDblClicked(e, tree, project);
}
}
@Override
public void mousePressed(MouseEvent e) {
treeMousePressed(e, tree);
}
});
// add keyboard handler for the tree
tree.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
TreePath treePath = tree.getAnchorSelectionPath();
if (treePath == null) {
return;
}
final Object raw = treePath.getLastPathComponent();
if (raw instanceof com.microsoft.azure.toolkit.intellij.common.component.Tree.TreeNode || raw instanceof LoadingNode) {
return;
}
SortableTreeNode treeNode = (SortableTreeNode) raw;
Node node = (Node) treeNode.getUserObject();
Rectangle rectangle = tree.getRowBounds(tree.getRowForPath(treePath));
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (!node.isLoading()) {
node.getClickAction().fireNodeActionEvent();
}
} else if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) {
if (node.hasNodeActions()) {
JPopupMenu menu = createPopupMenuForNode(node);
menu.show(e.getComponent(), (int) rectangle.getX(), (int) rectangle.getY());
}
}
}
});
// add the tree to the window
toolWindow.getComponent().add(new JBScrollPane(tree));
// set tree and tree path to expand the node later
azureModule.setTree(tree);
azureModule.setTreePath(tree.getPathForRow(0));
// setup toolbar icons
addToolbarItems(toolWindow, project, azureModule);
}
Aggregations