当前位置: 首页>>代码示例>>Java>>正文


Java TopComponent.getClientProperty方法代码示例

本文整理汇总了Java中org.openide.windows.TopComponent.getClientProperty方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.getClientProperty方法的具体用法?Java TopComponent.getClientProperty怎么用?Java TopComponent.getClientProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.windows.TopComponent的用法示例。


在下文中一共展示了TopComponent.getClientProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUI

import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private SnapshotsWindowUI getUI(boolean create) {
    if (ui == null) {
        WindowManager wm = WindowManager.getDefault();
        
        for (TopComponent tc : TopComponent.getRegistry().getOpened())
            if (tc.getClientProperty(SnapshotsWindowUI.ID) != null)
                ui = (SnapshotsWindowUI)tc;
        
        if (ui == null && create)
            ui = (SnapshotsWindowUI)wm.findTopComponent(SnapshotsWindowUI.ID);
        
        if (ui == null && create)
            ui = new SnapshotsWindowUI();
    }
    
    return ui;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SnapshotsWindow.java

示例2: guessSlideSide

import org.openide.windows.TopComponent; //导入方法依赖的package包/类
@Override
 public String guessSlideSide (TopComponent comp) {
     String toReturn = Constants.LEFT;
     if (hierarchy.getMaximizedModeView() != null) {
//issue #58562
         toReturn = (String)comp.getClientProperty("lastSlideSide");
         if (toReturn == null) {
             //TODO? now how does one figure on startup with maximazed mode where the editor is?
             toReturn = Constants.LEFT;
         }
     } else {
         Rectangle editorb = hierarchy.getPureEditorAreaBounds();
         Point leftTop = new Point(0, 0);
         SwingUtilities.convertPointToScreen(leftTop, comp);
         if (editorb.x > leftTop.x) {
             toReturn = Constants.LEFT;
             comp.putClientProperty("lastSlideSide", toReturn);
         }
         if ((editorb.x + editorb.width) < leftTop.x) {
             toReturn = Constants.RIGHT;
             comp.putClientProperty("lastSlideSide", toReturn);
         }
         if ((editorb.y + editorb.height) < leftTop.y) {
             toReturn = Constants.BOTTOM;
             comp.putClientProperty("lastSlideSide", toReturn);
         }
     }
     return toReturn;
 }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:DefaultView.java

示例3: obtainPath

import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private static String obtainPath(TopComponent tc) {
    Object file = tc.getClientProperty( RECENT_FILE_KEY );
    if( file instanceof File )
        return ((File)file).getPath();
    if( tc instanceof CloneableTopComponent ) {
        DataObject dObj = tc.getLookup().lookup(DataObject.class);
        if (dObj != null) {
            FileObject fo = dObj.getPrimaryFile();
            if (fo != null) {
                return convertFile2Path(fo);
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:RecentFiles.java

示例4: isOpenedByUser

import org.openide.windows.TopComponent; //导入方法依赖的package包/类
public static boolean isOpenedByUser( TopComponent tc ) {
    Object val = tc.getClientProperty( "userOpened" );
    tc.putClientProperty("userOpened", null);
    return null != val && val instanceof Boolean && ((Boolean)val).booleanValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:Utils.java

示例5: moveTopComponentIntoMode

import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private boolean moveTopComponentIntoMode(ModeImpl mode, TopComponent tc, int index) {
    boolean moved = false;
    boolean intoSliding = mode.getKind() == Constants.MODE_KIND_SLIDING;
    boolean intoSeparate = mode.getState() == Constants.MODE_STATE_SEPARATED;
    ModeImpl prevMode = null;
    String tcID = WindowManagerImpl.getInstance().findTopComponentID(tc);
    // XXX
    if(!mode.canContain(tc)) {
        return false;
    }
    TopComponentTracker.getDefault().add( tc, mode );
    for(Iterator it = model.getModes().iterator(); it.hasNext(); ) {
        ModeImpl m = (ModeImpl)it.next();
        if(model.containsModeTopComponent(m, tc)) {
            if (m.getKind() == Constants.MODE_KIND_SLIDING ||
                m.getState() == Constants.MODE_STATE_SEPARATED) {
                prevMode = model.getModeTopComponentPreviousMode(m, tcID);
            } else {
                prevMode = m;
            }
            break;
        }
    }
    int prevIndex = prevMode != null && (intoSliding || intoSeparate) ? prevMode.getOpenedTopComponentsIDs().indexOf( tcID ) : -1;
    if(removeTopComponentFromOtherModes(mode, tc)) {
        moved = true;
    }
    if (index > -1) {
        model.insertModeOpenedTopComponent(mode, tc, index);
    } else {
        model.addModeOpenedTopComponent(mode, tc);
    }
    if (prevMode != null && (intoSliding || intoSeparate)) {
        if( intoSeparate && mode.isPermanent() ) {
            //TC is being moved to a undocked mode so from now it will be
            //groupped with other TCs in that mode
            //so change the previous mode to ensure it docks back into
            //the same mode as other TCs in this mode
            List<String> ids = mode.getTopComponentsIDs();
            if( !ids.isEmpty() ) {
                ModeImpl groupPrevMode = model.getModeTopComponentPreviousMode( mode, ids.get( 0 ) );
                if( null != groupPrevMode ) {
                    prevMode = groupPrevMode;
                }
            }
        }
        // remember previous mode and constraints for precise de-auto-hide
        model.setModeTopComponentPreviousMode(mode, tcID, prevMode, prevIndex);
        model.setModeTopComponentPreviousConstraints(mode, tcID, model.getModeConstraints(prevMode));
    }
    if (!intoSliding) {
        // make the target mode active after dragging..
        model.setActiveMode(mode);
        model.setModeSelectedTopComponent(mode, tc);
    } else {
        sortSlidedOutTopComponentsByPrevModes( mode );
        // don't activate sliding modes, it means the component slides out, that's a bad thing..
        // make some other desktop mode active
        if(prevMode != null && prevMode == getActiveMode() 
               && prevMode.getOpenedTopComponents().isEmpty()) {
            setSomeModeActive();
        }
        // check the drop mode if it was already used, if not, assign it some reasonable size, 
        // according to the current component.
        if (mode.getBounds().width == 0 && mode.getBounds().height == 0) {
            // now we have the sliding mode in initial state
            mode.setBounds(tc.getBounds());
        }            
    }
    //#232061 
    if( null != tc.getClientProperty("windnd_cloned_tc")) {
        tc.putClientProperty("windnd_cloned_tc", null);
        WindowManagerImpl.getInstance().notifyTopComponentOpened(tc);
    }
    return moved;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:77,代码来源:Central.java


注:本文中的org.openide.windows.TopComponent.getClientProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。