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


Java Component.putClientProperty方法代码示例

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


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

示例1: collapseNode

import com.codename1.ui.Component; //导入方法依赖的package包/类
private void collapseNode(Component c, Transition t) {
    Container lead = c.getParent().getLeadParent();
    if(lead != null) {
        c = lead;
    }
    c.putClientProperty(KEY_EXPANDED, null);
    setNodeIcon(folder, c);
    Container p = c.getParent();
    for(int iter = 0 ; iter < p.getComponentCount() ; iter++) {
        if(p.getComponentAt(iter) != c) {
            Label dummy = new Label();
            p.replaceAndWait(p.getComponentAt(iter), dummy, t, true);
            p.removeComponent(dummy);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:17,代码来源:Tree.java

示例2: buildBranch

import com.codename1.ui.Component; //导入方法依赖的package包/类
/**
 * Adds the child components of a tree branch to the given container.
 */
private void buildBranch(Object parent, int depth, Container destination) {
    Vector children = model.getChildren(parent);
    int size = children.size();
    Integer depthVal = new Integer(depth + 1);
    for(int iter = 0 ; iter < size ; iter++) {
        final Object current = children.elementAt(iter);
        Component nodeComponent = createNode(current, depth);
        if(model.isLeaf(current)) {
            destination.addComponent(nodeComponent);
            bindNodeListener(new Handler(current), nodeComponent);
        } else {
            Container componentArea = new Container(new BorderLayout());
            componentArea.addComponent(BorderLayout.NORTH, nodeComponent);
            destination.addComponent(componentArea);
            bindNodeListener(expansionListener, nodeComponent);
        }
        nodeComponent.putClientProperty(KEY_OBJECT, current);
        nodeComponent.putClientProperty(KEY_PARENT, parent);
        nodeComponent.putClientProperty(KEY_DEPTH, depthVal);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:25,代码来源:Tree.java

示例3: createCellImpl

import com.codename1.ui.Component; //导入方法依赖的package包/类
private Component createCellImpl(Object value, final int row, final int column, boolean editable) {
    Component c = createCell(value, row, column, editable);
    c.putClientProperty("row", new Integer(row));
    c.putClientProperty("column", new Integer(column));
    
    // we do this here to allow subclasses to return a text area or its subclass
    if(c instanceof TextArea) {
        ((TextArea)c).addActionListener(listener);
    } 

    Style s = c.getSelectedStyle();
    //s.setMargin(0, 0, 0, 0);
    s.setMargin(verticalBorderSpacing, verticalBorderSpacing, horizontalBorderSpacing, horizontalBorderSpacing);
    if ((drawBorder) && (innerBorder!=INNER_BORDERS_NONE)) {
        s.setBorder(null);
        s = c.getUnselectedStyle();
        s.setBorder(null);
    } else {
        s = c.getUnselectedStyle();
    }
    //s.setBgTransparency(0);
    //s.setMargin(0, 0, 0, 0);
    s.setMargin(verticalBorderSpacing, verticalBorderSpacing, horizontalBorderSpacing, horizontalBorderSpacing);
    return c;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:26,代码来源:Table.java

示例4: beforeComponentPaint

import com.codename1.ui.Component; //导入方法依赖的package包/类
public void beforeComponentPaint(Component c) {
    if(trackDrawing) {
        if(c.isCellRenderer()) {
            return;
        }
        trackedDrawing = createTableModel();
        c.putClientProperty("track", trackedDrawing);
        return;
    }
    if(!paused) {
        c.putClientProperty("$t", new Long(System.nanoTime()));
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:14,代码来源:PerformanceMonitor.java

示例5: afterComponentPaint

import com.codename1.ui.Component; //导入方法依赖的package包/类
public void afterComponentPaint(Component c) {
    if(trackDrawing) {
        if(c.isCellRenderer()) {
            return;
        }
        if(c.getParent() != null) {
            trackedDrawing = (DefaultTableModel)c.getParent().getClientProperty("track");
        }
        return;
    }
    if(paused) {
        return;
    }
    long t = System.nanoTime();
    Long l = (Long)c.getClientProperty("$t");
    if(l != null) {
        t = t - l.longValue();
        Integer id = (Integer)c.getClientProperty(idString);
        Stats st;
        if(id == null) {
            id = new Integer(componentId);
            c.putClientProperty(idString, id);
            componentId++;
            st = new Stats(c);
            componentStats.put(id, st);                    
        } else {
            st = componentStats.get(id);
            if(st == null) {
                st = new Stats(c);
                componentStats.put(id, st); 
            }
        }
        st.updateInvocation(t);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:36,代码来源:PerformanceMonitor.java

示例6: expandNodeImpl

import com.codename1.ui.Component; //导入方法依赖的package包/类
private Container expandNodeImpl(boolean animate, Component c) {
    Container p = c.getParent().getLeadParent();
    if(p != null) {
        c = p;
    }
    c.putClientProperty(KEY_EXPANDED, "true");
    if(openFolder == null) {
        FontImage.setMaterialIcon(c, FontImage.MATERIAL_FOLDER, 3);
    } else {
        setNodeIcon(openFolder, c);
    }
    int depth = ((Integer)c.getClientProperty(KEY_DEPTH)).intValue();
    Container parent = c.getParent();
    Object o = c.getClientProperty(KEY_OBJECT);
    Container dest = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    parent.addComponent(BorderLayout.CENTER, dest);
    buildBranch(o, depth, dest);
    if(isInitialized() && animate) {
        // prevent a race condition on node expansion contraction
        parent.animateHierarchyAndWait(300);
        if(multilineMode) {
            revalidate();
        }
    } else {
        parent.revalidate();
    }
    return dest;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:29,代码来源:Tree.java

示例7: getComponentShiftMotion

import com.codename1.ui.Component; //导入方法依赖的package包/类
private Motion getComponentShiftMotion(Component c, boolean incoming) {
    Motion m = (Motion)c.getClientProperty("$shm");
    if(m == null) {
        Component dest = getDestination();
        if(dest == null || c == null) {
            return m;
        }
        int travelDestination = dest.getWidth() - c.getWidth() - c.getAbsoluteX();
        if(getDestination().getWidth() - c.getWidth() < 10) {
            // big component that takes up all the space such as a title that occupies the entire title area
            travelDestination = c.getWidth() / 2 - c.getPreferredW() / 2;
        }
        boolean dir = forward;
        if(c.getUIManager().getLookAndFeel().isRTL()) {
            dir = !dir;
        }
        if(incoming) {
            if(dir) {
                m = createMotion(-travelDestination, 0, speed);
            } else {
                m = createMotion(travelDestination, 0, speed);
            }
        } else {
            if(dir) {
                m = createMotion(0, travelDestination, speed);
            } else {
                m = createMotion(0, -travelDestination, speed);
            }
        }
        m.start();
        c.putClientProperty("$shm", m);
    }
    return m;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:35,代码来源:CommonTransitions.java

示例8: removeConstant

import com.codename1.ui.Component; //导入方法依赖的package包/类
private void removeConstant(Container c) {
    int componentCount = c.getComponentCount();
    c.putClientProperty("$shm", null);
    for(int iter = 0 ; iter < componentCount ; iter++) {
        Component cmp = c.getComponentAt(iter);
        cmp.putClientProperty("$shm", null);
        if(cmp instanceof Container) {
            removeConstant((Container)cmp);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:12,代码来源:CommonTransitions.java

示例9: installConstraint

import com.codename1.ui.Component; //导入方法依赖的package包/类
/**
 * Installs the given constraint in the provided component.
 * @param constraint
 * @param cmp
 * @return 
 */
private LayeredLayoutConstraint installConstraint(LayeredLayoutConstraint constraint, Component cmp) {
    
    if (constraint.outer() != this || (constraint.cmp != null && constraint.cmp != cmp)) {
        LayeredLayoutConstraint tmp = createConstraint();
        constraint.copyTo(tmp);
        constraint = tmp;
    }
    constraint.cmp = cmp;
    cmp.putClientProperty("$$LayeredLayoutConstraint", constraint);
    return constraint;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:18,代码来源:LayeredLayout.java

示例10: setNextForm

import com.codename1.ui.Component; //导入方法依赖的package包/类
void setNextForm(Component cmp, String nextForm, Resources res, Container root) {
    cmp.putClientProperty("%next_form%", nextForm);
    if(resourceFilePath == null || isKeepResourcesInRam()) {
        resourceFile = res;
    }
    ((Form)root).addShowListener(new FormListener((Form)root, nextForm));
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:8,代码来源:UIBuilder.java

示例11: addLayoutComponent

import com.codename1.ui.Component; //导入方法依赖的package包/类
@Override
public void addLayoutComponent(Object value, Component comp, Container c) {
    if (value != null) {
        comp.putClientProperty("cons", value);
    }
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:7,代码来源:SolitaireLayout.java

示例12: endEditing

import com.codename1.ui.Component; //导入方法依赖的package包/类
/**
 * Finish the in-place editing of the given text area, release the edit lock, and allow the synchronous call
 * to 'edit' to return.
 */
private synchronized void endEditing(int reason, boolean forceVKBOpen, boolean forceVKBClose) {
    if (cursorTimer != null) {
        cursorTimer.cancel();
    }
    if (!mIsEditing || mEditText == null) {
        return;
    }
    // SJH: Setting visibility GONE causes a size change event to be fired even when the
    // input mode is adjustPan.  This causes problems and glitches with the layout because we
    // have to guess if a resize even is accurate or not.
    //setVisibility(GONE);
    mLastEndEditReason = reason;

    // If the IME action is set to NEXT, do not hide the virtual keyboard
    boolean isNextActionFlagSet = ((mEditText.getImeOptions() & 0xf) == EditorInfo.IME_ACTION_NEXT);
    boolean leaveKeyboardShowing = impl.isAsyncEditMode() || (reason == REASON_IME_ACTION) && isNextActionFlagSet || forceVKBOpen;
    if (forceVKBClose) {
        leaveKeyboardShowing = false;
    }
    if (!leaveKeyboardShowing) {
        showVirtualKeyboard(false);
    }
    int imo = mEditText.getImeOptions() & 0xf; // Get rid of flags
    if (reason == REASON_IME_ACTION
            && mEditText.mTextArea instanceof TextField
            && ((TextField) mEditText.mTextArea).getDoneListener() != null
            && ((imo & EditorInfo.IME_ACTION_DONE) != 0 || (imo & EditorInfo.IME_ACTION_SEARCH) != 0 || (imo & EditorInfo.IME_ACTION_SEND) != 0 || (imo & EditorInfo.IME_ACTION_GO) != 0)) {
        ((TextField) mEditText.mTextArea).fireDoneEvent();
        showVirtualKeyboard(false);
    }

    // Call this in onComplete instead
    //mIsEditing = false;
    mLastEditText = mEditText;
    removeView(mEditText);
    Component editingComponent = mEditText.mTextArea;
    mEditText.removeTextChangedListener(mEditText.mTextWatcher);
    mEditText = null;

    if (impl.isAsyncEditMode()) {
        Runnable onComplete = (Runnable)editingComponent.getClientProperty("android.onAsyncEditingComplete");
        editingComponent.putClientProperty("android.onAsyncEditingComplete", null);
        if (onComplete != null) {
            Display.getInstance().callSerially(onComplete);
        }
    }

    waitingForSynchronousEditingCompletion = false;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:54,代码来源:InPlaceEditView.java

示例13: addHint

import com.codename1.ui.Component; //导入方法依赖的package包/类
/**
 * Places a hint within the glass in a position relative to the destinationComponent, the position
 * is indicated with border layout attributes. Notice you can place multiple components on a single 
 * element and they will be rendered in order e.g. a component with a border can be used to "circle"
 * the destination by placing it in the CENTER position and another arrow with text can be places in 
 * the south position below.
 * 
 * @param hintComponent The component that would be renderered in the given position
 * @param destinationComponent the "hinted" component over which the hint will show
 * @param position the position relative to the destinationComponent in BorderLayout values e.g. to place the hint
 * above the component just place it in BorderLayout.NORTH. The center will stretch the component but the
 * other sides will give the component its exact preferred size.
 */
public void addHint(Component hintComponent, Component destinationComponent, String position) {
    hintComponent.putClientProperty(POS, position);
    hintComponent.putClientProperty(DEST, destinationComponent);
    vec.addElement(hintComponent);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:GlassTutorial.java


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