• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DockableState类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.vlsolutions.swing.docking.DockableState的典型用法代码示例。如果您正苦于以下问题:Java DockableState类的具体用法?Java DockableState怎么用?Java DockableState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DockableState类属于com.vlsolutions.swing.docking包,在下文中一共展示了DockableState类的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: storeFocusedDockables

点赞 3

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * This method saves all tabs which are currently selected/visible.
 */
private void storeFocusedDockables() {
	MainFrame mainFrame = RapidMinerGUI.getMainFrame();
	if (mainFrame != null) {
		focusedDockables = new ArrayList<>();
		DockableState[] states = mainFrame.getDockingDesktop().getContext().getDockables();
		List<TabbedDockableContainer> memorizedContainer = new ArrayList<>();
		for (DockableState state : states) {
			TabbedDockableContainer container = DockingUtilities.findTabbedDockableContainer(state.getDockable());
			if (container != null) {
				if (!memorizedContainer.contains(container)) {
					focusedDockables.add(container.getSelectedDockable());
					memorizedContainer.add(container);
				}
			}
		}
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:21,
代码来源:PerspectiveProperties.java

示例2: storeScrollBarPositions

点赞 3

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * This method saves scroll positions of all {@link JScrollPane}s in the current Perspective.
 */
private void storeScrollBarPositions() {
	MainFrame mainFrame = RapidMinerGUI.getMainFrame();
	if (mainFrame != null) {
		DockableState[] states = mainFrame.getDockingDesktop().getContext().getDockables();
		for (DockableState state : states) {
			Dockable dockable = state.getDockable();
			if (dockable.getComponent() instanceof Container) {
				JScrollPane scrollPane = findScrollPane((Container) dockable.getComponent());
				if (scrollPane != null) {
					ScrollBarsPosition scrollBarsPosition = new ScrollBarsPosition(
							scrollPane.getVerticalScrollBar().getValue(),
							scrollPane.getHorizontalScrollBar().getValue());
					scrollBarsPositions.put(dockable, scrollBarsPosition);
				}
			}
		}
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:22,
代码来源:PerspectiveProperties.java

示例3: clearNow

点赞 3

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
private void clearNow(boolean alsoClearLogs) {
	List<Dockable> toClose = new LinkedList<>();
	for (DockableState state : RapidMinerGUI.getMainFrame().getDockingDesktop().getContext().getDockables()) {
		if (state.getDockable().getDockKey().getKey().startsWith(ResultTab.DOCKKEY_PREFIX + "process_")
				|| alsoClearLogs && state.getDockable().getDockKey().getKey().startsWith(ProcessLogTab.DOCKKEY_PREFIX)) {
			toClose.add(state.getDockable());
		}
	}
	if (!toClose.isEmpty() || !dataTables.isEmpty()) {
		// fix for "delete old results" dialog after breakpoint resume
		if (closeResultsPerRun) {
			DockableResultDisplay.this.dataTables.clear();
			// updateDataTables();
			for (Dockable dockable : toClose) {
				if (dockable instanceof ResultTab) {
					((ResultTab) dockable).freeResources();
				} else if (dockable instanceof ProcessLogTab) {
					((ProcessLogTab) dockable).freeResources();
				}
				// RapidMinerGUI.getMainFrame().getDockingDesktop().close(dockable);
				RapidMinerGUI.getMainFrame().getPerspectiveController().removeFromAllPerspectives(dockable);
			}
		}
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:26,
代码来源:DockableResultDisplay.java

示例4: storeScrollBarPositions

点赞 3

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * This method saves scroll positions of all {@link JScrollPane}s in the current Perspective.
 */
private void storeScrollBarPositions() {
	MainFrame mainFrame = RapidMinerGUI.getMainFrame();
	if (mainFrame != null) {
		DockableState[] states = mainFrame.getDockingDesktop().getContext().getDockables();
		for (DockableState state : states) {
			Dockable dockable = state.getDockable();
			if (dockable.getComponent() instanceof Container) {
				JScrollPane scrollPane = findScrollPane((Container) dockable.getComponent());
				if (scrollPane != null) {
					ScrollBarsPosition scrollBarsPosition = new ScrollBarsPosition(
							scrollPane.getVerticalScrollBar().getValue(),
							scrollPane.getHorizontalScrollBar().getValue());
					scrollBarsPositions.put(dockable.getDockKey().getKey(), scrollBarsPosition);
				}
			}
		}
	}
}
 

开发者ID:rapidminer,
项目名称:rapidminer-studio,
代码行数:22,
代码来源:PerspectiveProperties.java

示例5: clearNow

点赞 3

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
private void clearNow(boolean alsoClearLogs) {
	List<Dockable> toClose = new LinkedList<>();
	for (DockableState state : RapidMinerGUI.getMainFrame().getDockingDesktop().getContext().getDockables()) {
		if (state.getDockable().getDockKey().getKey().startsWith(ResultTab.DOCKKEY_PREFIX + "process_")
				|| alsoClearLogs && state.getDockable().getDockKey().getKey().startsWith(ProcessLogTab.DOCKKEY_PREFIX)) {
			toClose.add(state.getDockable());
		}
	}
	if (!toClose.isEmpty() || !dataTables.isEmpty()) {
		// fix for "delete old results" dialog after breakpoint resume
		if (closeResultsPerRun) {
			DockableResultDisplay.this.dataTables.clear();
			// updateDataTables();
			for (Dockable dockable : toClose) {
				if (dockable instanceof ResultTab) {
					((ResultTab) dockable).freeResources();
				} else if (dockable instanceof ProcessLogTab) {
					((ProcessLogTab) dockable).freeResources();
				}
				// RapidMinerGUI.getMainFrame().getDockingDesktop().close(dockable);
				RapidMinerGUI.getMainFrame().getPerspectiveController().removeFromAllPerspectives(dockable);
			}
			getDockKey().resetPropertyChangeListener();
		}
	}
}
 

开发者ID:rapidminer,
项目名称:rapidminer-studio,
代码行数:27,
代码来源:DockableResultDisplay.java

示例6: clearNow

点赞 3

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
private void clearNow(boolean alsoClearLogs) {
	List<Dockable> toClose = new LinkedList<Dockable>();
	for (DockableState state : RapidMinerGUI.getMainFrame().getDockingDesktop().getContext().getDockables()) {
		if (state.getDockable().getDockKey().getKey().startsWith(ResultTab.DOCKKEY_PREFIX+"process_") ||
				(alsoClearLogs && state.getDockable().getDockKey().getKey().startsWith(ProcessLogTab.DOCKKEY_PREFIX))) {
			toClose.add(state.getDockable());
		}										
	}
	if ((!toClose.isEmpty() || !dataTables.isEmpty()) ) {
		// fix for "delete old results" dialog after breakpoint resume
		if (closeResultsPerRun) {
			DockableResultDisplay.this.dataTables.clear();
			//updateDataTables();
			for (Dockable dockable : toClose) {							
				if (dockable instanceof ResultTab) {
					((ResultTab) dockable).freeResources();
				} else if (dockable instanceof ProcessLogTab) {
					((ProcessLogTab) dockable).freeResources();
				}
				//RapidMinerGUI.getMainFrame().getDockingDesktop().close(dockable);
				RapidMinerGUI.getMainFrame().getPerspectives().removeFromAllPerspectives(dockable);
			}								
		}
	}
}
 

开发者ID:rapidminer,
项目名称:rapidminer-5,
代码行数:26,
代码来源:DockableResultDisplay.java

示例7: closeAllTutorialBrowsers

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * Attempts to close all instances of the {@link TutorialBrowser} (both visible and hidden).
 */
private void closeAllTutorialBrowsers() {
	DockableState state = DockingTools.getDockableState(TutorialBrowser.TUTORIAL_BROWSER_DOCK_KEY);
	Dockable browser = state.getDockable();
	if (state != null) {
		mainFrame.getDockingDesktop().close(browser);
		mainFrame.getPerspectiveController().removeFromInvisiblePerspectives(browser);
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:12,
代码来源:TutorialSelector.java

示例8: showTabInAllPerspectives

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * Shows the tab as a child of the given dockable in all perspectives.
 */
public void showTabInAllPerspectives(final Dockable dockable, final Dockable parent) {
	DockableState dstate = context.getDockableState(dockable);
	if (dstate != null && !dstate.isClosed()) {
		return;
	}

	DockingDesktop dockingDesktop = context.getDesktopList().get(0);
	context.registerDockable(dockable);

	WSDockKey parentKey = new WSDockKey(parent.getDockKey().getKey());
	WSDockKey key = new WSDockKey(dockable.getDockKey().getKey());
	for (Perspective persp : model.getAllPerspectives()) {
		if (persp == model.getSelectedPerspective()) {
			continue;
		}

		// We don't need to show it if
		// 1. We don't know the parent
		// 2. We already have the child
		boolean containsParent = persp.getWorkspace().getDesktop(0).containsNode(parentKey);
		boolean containsChild = persp.getWorkspace().getDesktop(0).containsNode(key);
		if (containsParent && !containsChild) {
			persp.getWorkspace().getDesktop(0).createTab(parentKey, key, 1);
		}
	}

	DockableState[] states = dockingDesktop.getDockables();
	for (DockableState state : states) {
		if (state.getDockable() == parent && !state.isClosed()) {
			dockingDesktop.createTab(state.getDockable(), dockable, 1, true);
			break;
		}
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:38,
代码来源:PerspectiveController.java

示例9: findExportComponents

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * Returns a list of printable components from the currently visible perspective.
 *
 * @return the components that can be exported as an image.
 */
public static final List<PrintableComponent> findExportComponents() {
	List<PrintableComponent> components = new LinkedList<>();

	// otherwise search for all PrintableComponents in current perspective
	for (DockableState state : RapidMinerGUI.getMainFrame().getDockingDesktop().getDockables()) {
		if (state.isHidden()) {
			continue;
		}
		Dockable dockable = state.getDockable();

		// if dockable is visible, search for PrintableComponents
		Component component = dockable.getComponent();
		if (component.isShowing()) {
			findExportComponents(component, components);
		}
	}

	// at last add MainFrame as printable component
	Perspective currentPerspective = RapidMinerGUI.getMainFrame().getPerspectiveController().getModel()
			.getSelectedPerspective();
	String perspectiveName = I18N.getGUIMessage("gui.action.workspace_" + currentPerspective.getName() + ".label");

	components.add(new SimplePrintableComponent(RapidMinerGUI.getMainFrame(), perspectiveName,
			I18N.getGUIMessage("gui.action.workspace_" + currentPerspective.getName() + ".icon")));

	return components;
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:33,
代码来源:PrintingTools.java

示例10: isDockableOnScreen

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * method to get to know whether the dockable with the given key is on Screen
 *
 * @param dockableKey
 *            i18nKey of the wanted Dockable
 * @return returns 1 if the Dockable is on the Screen but not showing, -1 if the Dockable is not
 *         on the Screen and 0 if the Dockable is on Screen and showing.
 */
public static int isDockableOnScreen(final String dockableKey) {
	Dockable dock = RapidMinerGUI.getMainFrame().getDockingDesktop().getContext().getDockableByKey(dockableKey);
	DockableState state = RapidMinerGUI.getMainFrame().getDockingDesktop().getDockableState(dock);
	if (!state.isClosed()) {
		if (dock.getComponent().isShowing()) {
			return OBJECT_SHOWING_ON_SCREEN;
		}
		return OBJECT_NOT_SHOWING;
	}
	return OBJECT_NOT_ON_SCREEN;

}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:21,
代码来源:BubbleWindow.java

示例11: getDockableState

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * Tries to resolve a {@link DockableState} with the given dockKey.
 *
 * @param dockKey
 *            The dock key of the desired {@link DockableState}
 * @return If successful the found {@link DockableState}, otherwise <code>null</code>.
 * @since 6.2.0
 */
public static DockableState getDockableState(String dockKey) {
	MainFrame mainFrame = RapidMinerGUI.getMainFrame();
	for (DockableState dockableState : mainFrame.getDockingDesktop().getDockables()) {
		Dockable dockable = dockableState.getDockable();
		if (dockable.getDockKey().getKey().equals(dockKey)) {
			return dockableState;
		}
	}
	return null;
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:19,
代码来源:DockingTools.java

示例12: clearAll

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
@Override
public void clearAll() {
	for (DockableState state : RapidMinerGUI.getMainFrame().getDockingDesktop().getContext().getDockables()) {
		if (state.getDockable().getDockKey().getKey().startsWith(ResultTab.DOCKKEY_PREFIX)
				|| state.getDockable().getDockKey().getKey().startsWith(ProcessLogTab.DOCKKEY_PREFIX)) {
			RapidMinerGUI.getMainFrame().getPerspectiveController().removeFromAllPerspectives(state.getDockable());
		}
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:10,
代码来源:DockableResultDisplay.java

示例13: closeAllTutorialBrowsers

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/**
 * Attempts to close all instances of the {@link TutorialBrowser} (both visible and hidden).
 */
private void closeAllTutorialBrowsers() {
	DockableState state = DockingTools.getDockableState(TutorialBrowser.TUTORIAL_BROWSER_DOCK_KEY);
	if (state != null) {
		Dockable browser = state.getDockable();
		mainFrame.getDockingDesktop().close(browser);
		mainFrame.getPerspectiveController().removeFromInvisiblePerspectives(browser);
	}
}
 

开发者ID:rapidminer,
项目名称:rapidminer-studio,
代码行数:12,
代码来源:TutorialSelector.java

示例14: getDockable

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
protected Dockable getDockable(PageComponent pageComponent) {
    DockableState[] states = desktop.getDockables();
    for (int i = 0; i < states.length; i++) {
        Dockable dockable = states[i].getDockable();
        PageComponent pc = getPageComponent(dockable);
        if (pc == pageComponent)
            return dockable;
    }
    return null;
}
 

开发者ID:shevek,
项目名称:spring-rich-client,
代码行数:11,
代码来源:VLDockingApplicationPage.java

示例15: dockableStateWillChange

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
public void dockableStateWillChange(DockableStateWillChangeEvent event) {
    DockableState futureState = event.getFutureState();
    if (futureState.isClosed()) {
        Dockable dockable = futureState.getDockable();
        if (dockable instanceof ViewDescriptorDockable) {
            ViewDescriptorDockable vdd = (ViewDescriptorDockable) dockable;
            PageComponent pc = vdd.getPageComponent();
            if (!pc.canClose())
                event.cancel();
        }
    }
}
 

开发者ID:shevek,
项目名称:spring-rich-client,
代码行数:13,
代码来源:VLDockingApplicationPage.java

示例16: dockableStateChanged

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
public void dockableStateChanged(DockableStateChangeEvent event) {
    DockableState previousState = event.getPreviousState();
    DockableState newState = event.getNewState();
    Dockable dockable = newState.getDockable();
    PageComponent pc = getPageComponent(dockable);
    if (pc == null)
        return;
    if (previousState != null && !previousState.isClosed() && newState.isClosed()) {
        pc.getContext().getPage().close(pc);
    }
}
 

开发者ID:shevek,
项目名称:spring-rich-client,
代码行数:12,
代码来源:VLDockingApplicationPage.java

示例17: getDockableNameByKey

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
private String getDockableNameByKey(String key) {
	DockableState[] dockables = RapidMinerGUI.getMainFrame().getDockingDesktop().getDockables();
	for (DockableState state : dockables) {
		if(state.getDockable().getDockKey().getKey().equals(key))
			return state.getDockable().getDockKey().getName();
	}
	throw new IllegalArgumentException("Dockable with key: "+key+" does not exists.");
}
 

开发者ID:rapidminer,
项目名称:rapidminer-5,
代码行数:9,
代码来源:NotOnScreenStep.java

示例18: showTabInAllPerspectives

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
/** Shows the tab as a child of the given dockable in all perspectives. */
public void showTabInAllPerspectives(Dockable dockable, Dockable parent) {
    DockableState dstate = context.getDockableState(dockable);
    if ((dstate != null) && (!dstate.isClosed())) {
        return;
    }

    DockingDesktop dockingDesktop = context.getDesktopList().get(0);
    context.registerDockable(dockable);
    //dockingDesktop.registerDockable(dockable);

    WSDockKey parentKey = new WSDockKey(parent.getDockKey().getKey());
    WSDockKey key = new WSDockKey(dockable.getDockKey().getKey());
    for (Perspective persp : perspectives.values()) {
        if (persp == current) {
            continue;
        }

        // We don't need to show it if
        // 1. We don't know the parent
        // 2. We already have the child
        boolean containsParent = persp.getWorkspace().getDesktop(0).containsNode(parentKey);
        boolean containsChild = persp.getWorkspace().getDesktop(0).containsNode(key);
        if (containsParent && !containsChild) {
            persp.getWorkspace().getDesktop(0).createTab(parentKey, key, 1);
        }
    }

    DockableState[] states = dockingDesktop.getDockables();
    for (DockableState state : states) {
        if ((state.getDockable() == parent) && !state.isClosed()) {
            dockingDesktop.createTab(state.getDockable(), dockable, 1, true);
            break;
        }
    }
}
 

开发者ID:rapidminer,
项目名称:rapidminer-5,
代码行数:37,
代码来源:ApplicationPerspectives.java

示例19: clearAll

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
@Override
public void clearAll() {
	for (DockableState state : RapidMinerGUI.getMainFrame().getDockingDesktop().getContext().getDockables()) {
		if (state.getDockable().getDockKey().getKey().startsWith(ResultTab.DOCKKEY_PREFIX) ||
				state.getDockable().getDockKey().getKey().startsWith(ProcessLogTab.DOCKKEY_PREFIX)) {
			RapidMinerGUI.getMainFrame().getPerspectives().removeFromAllPerspectives(state.getDockable());
		}										
	}
}
 

开发者ID:rapidminer,
项目名称:rapidminer-5,
代码行数:10,
代码来源:DockableResultDisplay.java

示例20: scanDrop

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
@Override
protected void scanDrop(DockEvent event, boolean drop) {
	if (getParent() instanceof TabbedDockableContainer) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).delegateDrag();
		}
		return;
	}
	if (event.getDragSource().getDockable() == dockable) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	if (event.getDragSource().getDockableContainer() instanceof TabbedDockableContainer) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Rectangle bounds = getBounds();
	DockGroup sourceGroup = event.getDragSource().getDockable().getDockKey().getDockGroup();
	DockGroup destinationGroup = dockable.getDockKey().getDockGroup();
	if (!DockGroup.areGroupsCompatible(destinationGroup, sourceGroup)) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Dockable sourceDockable = event.getDragSource().getDockable();
	DockableState.Location dockableLocation = sourceDockable.getDockKey().getLocation();
	DockableState.Location viewLocation = dockable.getDockKey().getLocation();
	if (drop) {
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation,
				viewLocation, dockable, 0));
		((DockDropEvent) event).acceptDrop(false);
		desktop.createTab(dockable, event.getDragSource().getDockable(), 0, true);
	} else {
		Rectangle2D r2d = new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height);
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation,
				viewLocation, dockable, 0));
		if (r2d.equals(lastDropShape)) {
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		} else {
			GeneralPath path = buildPathForTab(bounds);
			;
			lastDropShape = r2d;
			lastDropGeneralPath = path;
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		}
	}
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:61,
代码来源:DetachedDockViewAsTab.java

示例21: fill

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
private void fill() {
	removeAll();
	DockableState[] dockables = dockingContext.getDesktopList().get(0).getDockables();
	List<DockableState> sorted = new LinkedList<>();
	sorted.addAll(Arrays.asList(dockables));
	Collections.sort(sorted, new Comparator<DockableState>() {

		@Override
		public int compare(DockableState o1, DockableState o2) {
			return o1.getDockable().getDockKey().getName().compareTo(o2.getDockable().getDockKey().getName());
		}
	});
	for (final DockableState state : sorted) {
		if (state.getDockable() instanceof DummyDockable) {
			continue;
		}
		DockKey dockKey = state.getDockable().getDockKey();
		boolean cont = false;
		for (String prefix : HIDE_IN_DOCKABLE_MENU_PREFIX_REGISTRY) {
			if (dockKey.getKey().startsWith(prefix)) {
				cont = true;
				break;
			}
		}
		if (cont) {
			continue;
		}
		String description = null;
		if (dockKey instanceof ResourceDockKey) {
			description = ((ResourceDockKey) dockKey).getShortDescription();
		}
		description = description != null ? description : "";
		String text = dockKey.getName();
		if (SystemInfoUtilities.getOperatingSystem() != OperatingSystem.OSX) {
			// OS X cannot use html in menus so only do it for other OS
			text = "<html><p style='margin-left:5'><b>" + dockKey.getName() + "</b><br/>" + description + "</p></html>";
		}
		JCheckBoxMenuItem item = new JCheckBoxMenuItem(text, dockKey.getIcon());

		item.setSelected(!state.isClosed());
		item.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				if (state.isClosed()) {
					dockingContext.getDesktopList().get(0).addDockable(state.getDockable());
				} else {
					dockingContext.getDesktopList().get(0).close(state.getDockable());
				}
			}

		});

		// special handling for results overview dockable in Results perspective
		// this dockable is not allowed to be closed so we disable this item while in said
		// perspective
		if (RapidMinerGUI.getMainFrame().getPerspectiveController().getModel().getSelectedPerspective().getName()
				.equals(PerspectiveModel.RESULT)
				&& ResultDisplay.RESULT_DOCK_KEY.equals(state.getDockable().getDockKey().getKey())) {
			item.setEnabled(false);
		}

		add(item);
	}

}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:67,
代码来源:DockableMenu.java

示例22: scanDrop

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
@Override
protected void scanDrop(DockEvent event, boolean drop){
	if (getParent() instanceof TabbedDockableContainer){
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).delegateDrag();
		}
		return;
	}
	if (event.getDragSource().getDockable() == dockable) {
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	if (event.getDragSource().getDockableContainer() instanceof TabbedDockableContainer) {
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Rectangle bounds = getBounds();
	DockGroup sourceGroup = event.getDragSource().getDockable().getDockKey().getDockGroup();
	DockGroup destinationGroup = dockable.getDockKey().getDockGroup();
	if (!DockGroup.areGroupsCompatible(destinationGroup, sourceGroup)){
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Dockable sourceDockable = event.getDragSource().getDockable();
	DockableState.Location dockableLocation = sourceDockable.getDockKey().getLocation();
	DockableState.Location viewLocation = dockable.getDockKey().getLocation();
	if (drop){
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation, viewLocation, dockable, 0));
		((DockDropEvent) event).acceptDrop(false);
		desktop.createTab(dockable, event.getDragSource().getDockable(), 0, true);
	} else {
		Rectangle2D r2d = new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height);
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation, viewLocation, dockable, 0));
		if (r2d.equals(lastDropShape)) {
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		} else {
			GeneralPath path = buildPathForTab(bounds);;
			lastDropShape = r2d;
			lastDropGeneralPath = path;
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		}
	}    
}
 

开发者ID:rapidminer,
项目名称:rapidminer-5,
代码行数:58,
代码来源:DetachedDockViewAsTab.java

示例23: fill

点赞 2

import com.vlsolutions.swing.docking.DockableState; //导入依赖的package包/类
private void fill() {		
	removeAll();
	DockableState[] dockables = (dockingContext.getDesktopList().get(0)).getDockables();
	List<DockableState> sorted = new LinkedList<DockableState>();
	sorted.addAll(Arrays.asList(dockables));
	Collections.sort(sorted, new Comparator<DockableState>() {
		@Override
		public int compare(DockableState o1, DockableState o2) {
			return o1.getDockable().getDockKey().getName().compareTo(o2.getDockable().getDockKey().getName());
		}			
	});
	for (final DockableState state : sorted) {
		String key = state.getDockable().getDockKey().getKey();
		boolean cont = false;
		for(String prefix : HIDE_IN_DOCKABLE_MENU_PREFIX_REGISTRY) {
			if(key.startsWith(prefix)) {
				cont = true;
				break;
			}
		}
		if(cont) {
			continue;
		}
		JCheckBoxMenuItem item = new JCheckBoxMenuItem(
				state.getDockable().getDockKey().getName(),
				state.getDockable().getDockKey().getIcon());
		item.setSelected(!state.isClosed());
		item.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {					
				if (state.isClosed()) {
					(dockingContext.getDesktopList().get(0)).addDockable(state.getDockable());						
				} else {
					(dockingContext.getDesktopList().get(0)).close(state.getDockable());
				}
			}
			
		});
		
		// special handling for results overview dockable in Results perspective
		// this dockable is not allowed to be closed so we disable this item while in said perspective
		if (RapidMinerGUI.getMainFrame().getPerspectives().getCurrentPerspective().getName().equals("result") &&
				RapidMinerGUI.getMainFrame().getResultDisplay().getDockKey().equals(state.getDockable().getDockKey())) {
			item.setEnabled(false);
		}
		
		add(item);
	}

}
 

开发者ID:rapidminer,
项目名称:rapidminer-5,
代码行数:51,
代码来源:DockableMenu.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)