def getButtonIdentifier(self): intFrame = SwingUtilities.getAncestorOfClass(JInternalFrame, self.widget.widget) if intFrame: return intFrame.getTitle() icon = SwingUtilities.getAncestorOfClass(JInternalFrame.JDesktopIcon, self.widget.widget) # @UndefinedVariable if icon: return self.widget.widget.getLabel()
def hasComplexAncestors(widget): if any((SwingUtilities.getAncestorOfClass(widgetClass, widget) is not None for widgetClass in [ JTable, JScrollBar, JComboBox, JSpinner ])): return True # If we're in a popup menu that's attached to something with complex ancestors, that's clearly even more complex :) popup = SwingUtilities.getAncestorOfClass(JPopupMenu, widget) if popup and isinstance(popup.getInvoker(), JComboBox): return True return popup is not None and hasComplexAncestors(popup.getInvoker())
def getContextName(self): if SwingUtilities.getAncestorOfClass(JInternalFrame, self.widget): return "Internal Frame" elif SwingUtilities.getAncestorOfClass(JInternalFrame.JDesktopIcon, self.widget): # @UndefinedVariable return "Internal Frame Icon"