use of org.netbeans.swing.tabcontrol.customtabs.Tabbed in project netbeans-rcp-lite by outersky.
the class CommandManager method slideIn.
public void slideIn(int tabIndex) {
SlideBarDataModel model = slideBar.getModel();
if (isCompSlided()) {
if (curSlidedComp != model.getTab(tabIndex).getComponent()) {
// another component requests slide in, so slide out current first
slideOut(false, false);
}
}
curSlidedIndex = tabIndex;
curSlidedComp = model.getTab(tabIndex).getComponent();
curSlideOrientation = model.getOrientation();
curSlideButton = slideBar.getButton(tabIndex);
Tabbed cont = updateSlidedTabContainer(tabIndex);
SlideOperation operation = SlideOperationFactory.createSlideIn(cont.getComponent(), curSlideOrientation, true, true);
boolean alreadyListening = false;
for (AWTEventListener el : Toolkit.getDefaultToolkit().getAWTEventListeners()) {
if (el == getAWTListener()) {
alreadyListening = false;
break;
}
}
if (!alreadyListening)
Toolkit.getDefaultToolkit().addAWTEventListener(getAWTListener(), MouseEvent.MOUSE_EVENT_MASK);
curSlideButton.setSelected(true);
postEvent(new SlideBarActionEvent(slideBar, SlideBar.COMMAND_SLIDE_IN, operation));
recog.attachResizeRecognizer(orientation2Side(curSlideOrientation), cont.getComponent());
}
use of org.netbeans.swing.tabcontrol.customtabs.Tabbed in project netbeans-rcp-lite by outersky.
the class TopComponentDragSupport method doStartDrag.
/**
* Actually starts the drag operation.
*/
private void doStartDrag(Component startingComp, TopComponentDraggable transfer, DragGestureEvent evt, TopComponentDroppable startingDroppable, final Point startingPoint) {
if (DEBUG) {
// NOI18N
debugLog("");
// NOI18N
debugLog("doStartDrag");
}
TopComponent tc = transfer.getTopComponent();
canCopy = tc instanceof TopComponent.Cloneable && !Boolean.TRUE.equals(tc.getClientProperty(TopComponent.PROP_DND_COPY_DISABLED));
// Inform window sys there is DnD about to start.
// XXX Using the firstTC in DnD manager is a hack.
windowDnDManager.dragStarting(startingDroppable, startingPoint, transfer);
Cursor cursor = hackUserDropAction == DnDConstants.ACTION_MOVE ? getDragCursor(startingComp, CURSOR_MOVE) : (canCopy ? getDragCursor(startingComp, CURSOR_COPY) : getDragCursor(startingComp, CURSOR_COPY_NO_MOVE));
// Sets listnening for ESC key.
addListening();
hackESC = false;
Tabbed tabbed = null;
Tabbed.Accessor acc = (Tabbed.Accessor) SwingUtilities.getAncestorOfClass(Tabbed.Accessor.class, startingComp);
tabbed = acc != null ? acc.getTabbed() : null;
int tabIndex = -1;
Image img = createDragImage();
if (tabbed != null) {
if (transfer.isTopComponentTransfer() && WinSysPrefs.HANDLER.getBoolean(WinSysPrefs.DND_DRAGIMAGE, Utilities.getOperatingSystem() != Utilities.OS_SOLARIS)) {
tabIndex = tabbed.indexOf(transfer.getTopComponent());
visualizer = new DragAndDropFeedbackVisualizer(tabbed, tabIndex);
}
}
try {
Transferable transferable;
if (transfer.isTopComponentTransfer()) {
transferable = new TopComponentTransferable(transfer.getTopComponent());
} else {
assert transfer.isModeTransfer();
transferable = new TopComponentModeTransferable(transfer.getMode());
}
evt.startDrag(cursor, img, new Point(0, 0), transferable, this);
evt.getDragSource().addDragSourceMotionListener(this);
if (null != visualizer) {
visualizer.start(evt);
}
} catch (InvalidDnDOperationException idoe) {
Logger.getLogger(TopComponentDragSupport.class.getName()).log(Level.WARNING, null, idoe);
removeListening();
windowDnDManager.resetDragSource();
if (null != visualizer) {
visualizer.dispose(false);
visualizer = null;
}
}
}
use of org.netbeans.swing.tabcontrol.customtabs.Tabbed in project netbeans-rcp-lite by outersky.
the class TabbedHandler method handlePopupMenuShowing.
/**
* Possibly invokes popup menu.
*/
public static void handlePopupMenuShowing(MouseEvent e, int idx) {
Component c = (Component) e.getSource();
while (c != null && !(c instanceof Tabbed.Accessor)) c = c.getParent();
if (c == null) {
return;
}
final Tabbed tab = ((Tabbed.Accessor) c).getTabbed();
final Point p = SwingUtilities.convertPoint((Component) e.getSource(), e.getPoint(), c);
final int clickTab = idx;
Lookup context = null;
Action[] actions = null;
if (clickTab >= 0) {
TopComponent tc = tab.getTopComponentAt(clickTab);
if (tc != null) {
// ask also tabbed to possibly alter actions
actions = tab.getPopupActions(tc.getActions(), clickTab);
if (actions == null) {
actions = tc.getActions();
}
if (actions == null || actions.length == 0)
return;
context = tc.getLookup();
}
}
if (null == context) {
actions = tab.getPopupActions(new Action[0], -1);
if (actions == null || actions.length == 0)
return;
context = Lookup.getDefault();
}
showPopupMenu(Utilities.actionsToPopup(actions, context), p, c);
}
use of org.netbeans.swing.tabcontrol.customtabs.Tabbed in project netbeans-rcp-lite by outersky.
the class CommandManager method updateSlidedTabContainer.
private Tabbed updateSlidedTabContainer(int tabIndex) {
Tabbed container = getSlidingTabbed();
// TabDataModel containerModel = container.getModel();
SlideBarDataModel dataModel = slideBar.getModel();
// creating new TabData instead of just referencing
// to be able to compare and track changes between models of slide bar and
// slided tabbed container
TabData origTab = dataModel.getTab(tabIndex);
TopComponent tc = (TopComponent) origTab.getComponent();
container.setTopComponents(new TopComponent[] { tc }, tc);
return container;
}
use of org.netbeans.swing.tabcontrol.customtabs.Tabbed in project netbeans-rcp-lite by outersky.
the class TabbedHandler method handleMaximization.
/**
* Possibly invokes the (un)maximization.
*/
public static void handleMaximization(TabActionEvent tae) {
Component c = (Component) tae.getSource();
while (c != null && !(c instanceof Tabbed.Accessor)) c = c.getParent();
if (c == null) {
return;
}
final Tabbed tab = ((Tabbed.Accessor) c).getTabbed();
TopComponent tc = tab.getTopComponentAt(tae.getTabIndex());
// perform action
MaximizeWindowAction mwa = new MaximizeWindowAction(tc);
if (mwa.isEnabled())
mwa.actionPerformed(tae);
}
Aggregations