當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。