use of org.netbeans.core.windows.view.ui.MultiSplitPane in project netbeans-rcp-lite by outersky.
the class ResizeModeAction method actionPerformed.
@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
updateEnabled();
if (!isEnabled())
return;
ModeImpl contextMode = getModeToWorkWith();
Component c = contextMode.getSelectedTopComponent();
MultiSplitPane splitPane = (MultiSplitPane) SwingUtilities.getAncestorOfClass(MultiSplitPane.class, c);
splitPane.startResizing(c);
}
use of org.netbeans.core.windows.view.ui.MultiSplitPane in project netbeans-rcp-lite by outersky.
the class ResizeModeAction method updateEnabled.
private void updateEnabled() {
ModeImpl contextMode = getModeToWorkWith();
if (null == contextMode || contextMode.getKind() == Constants.MODE_KIND_EDITOR || contextMode.getState() == Constants.MODE_STATE_SEPARATED || null == contextMode.getSelectedTopComponent()) {
setEnabled(false);
return;
}
Component c = contextMode.getSelectedTopComponent();
MultiSplitPane splitPane = (MultiSplitPane) SwingUtilities.getAncestorOfClass(MultiSplitPane.class, c);
if (null == splitPane) {
setEnabled(false);
return;
}
setEnabled(true);
}
use of org.netbeans.core.windows.view.ui.MultiSplitPane in project netbeans-rcp-lite by outersky.
the class SplitView method getSplitPane.
private MultiSplitPane getSplitPane() {
if (splitPane == null) {
splitPane = new MultiSplitPane();
updateSplitPane();
int dividerSize;
// get default divider size from SplitPane's UI
if (orientation == JSplitPane.VERTICAL_SPLIT) {
// NOI18N
dividerSize = UIManager.getInt("Nb.SplitPane.dividerSize.vertical");
if (dividerSize == 0) {
// NOI18N
dividerSize = UIManager.getInt("SplitPane.dividerSize");
if (dividerSize == 0) {
dividerSize = Constants.DIVIDER_SIZE_VERTICAL;
}
}
} else {
// NOI18N
dividerSize = UIManager.getInt("Nb.SplitPane.dividerSize.horizontal");
if (dividerSize == 0) {
// NOI18N
dividerSize = UIManager.getInt("SplitPane.dividerSize");
if (dividerSize == 0) {
dividerSize = Constants.DIVIDER_SIZE_HORIZONTAL;
}
}
}
// NOI18N
Integer override = Integer.getInteger("Nb.SplitPane.dividerSize");
if (null != override) {
dividerSize = override.intValue();
}
splitPane.setDividerSize(dividerSize);
splitPane.setBorder(BorderFactory.createEmptyBorder());
// NOI18N
splitPane.addPropertyChangeListener(// NOI18N
"splitPositions", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
ArrayList<Double> weights = new ArrayList<Double>(children.size());
ArrayList<ViewElement> views = new ArrayList<ViewElement>(children.size());
splitPane.calculateSplitWeights(views, weights);
ViewElement[] arrViews = new ViewElement[views.size()];
double[] arrWeights = new double[views.size()];
for (int i = 0; i < views.size(); i++) {
arrViews[i] = views.get(i);
arrWeights[i] = weights.get(i).doubleValue();
}
getController().userMovedSplit(SplitView.this, arrViews, arrWeights);
}
});
}
return splitPane;
}
Aggregations