WXComponent implements IWXObject, IWXActivityStateListener { protected boolean setProperty(String key, Object param) { switch (key) { case Constants.Name.DISABLED: Boolean disabled = WXUtils.getBoolean(param,null); if (disabled != null) setDisabled(disabled); return true; case Constants.Name.POSITION: String position = WXUtils.getString(param,null); if (position != null) setSticky(position); return true; case Constants.Name.BACKGROUND_COLOR: String bgColor = WXUtils.getString(param,null); if (bgColor != null) setBackgroundColor(bgColor); return true; case Constants.Name.OPACITY: Float opacity = WXUtils.getFloat(param,null); if (opacity != null) setOpacity(opacity); return true; case Constants.Name.BORDER_RADIUS: case Constants.Name.BORDER_TOP_LEFT_RADIUS: case Constants.Name.BORDER_TOP_RIGHT_RADIUS: case Constants.Name.BORDER_BOTTOM_RIGHT_RADIUS: case Constants.Name.BORDER_BOTTOM_LEFT_RADIUS: Float radius = WXUtils.getFloat(param,null); if (radius != null) setBorderRadius(key,radius); return true; case Constants.Name.BORDER_WIDTH: case Constants.Name.BORDER_TOP_WIDTH: case Constants.Name.BORDER_RIGHT_WIDTH: case Constants.Name.BORDER_BOTTOM_WIDTH: case Constants.Name.BORDER_LEFT_WIDTH: Float width = WXUtils.getFloat(param,null); if (width != null) setBorderWidth(key,width); return true; case Constants.Name.BORDER_STYLE: case Constants.Name.BORDER_RIGHT_STYLE: case Constants.Name.BORDER_BOTTOM_STYLE: case Constants.Name.BORDER_LEFT_STYLE: case Constants.Name.BORDER_TOP_STYLE: String border_style = WXUtils.getString(param,null); if (border_style != null) setBorderStyle(key, border_style); return true; case Constants.Name.BORDER_COLOR: case Constants.Name.BORDER_TOP_COLOR: case Constants.Name.BORDER_RIGHT_COLOR: case Constants.Name.BORDER_BOTTOM_COLOR: case Constants.Name.BORDER_LEFT_COLOR: String border_color = WXUtils.getString(param,null); if (border_color != null) setBorderColor(key, border_color); return true; case Constants.Name.VISIBILITY: String visibility = WXUtils.getString(param,null); if (visibility != null) setVisibility(visibility); return true; case Constants.Name.WIDTH: case Constants.Name.MIN_WIDTH: case Constants.Name.MAX_WIDTH: case Constants.Name.HEIGHT: case Constants.Name.MIN_HEIGHT: case Constants.Name.MAX_HEIGHT: case Constants.Name.ALIGN_ITEMS: case Constants.Name.ALIGN_SELF: case Constants.Name.FLEX: case Constants.Name.FLEX_DIRECTION: case Constants.Name.JUSTIFY_CONTENT: case Constants.Name.FLEX_WRAP: case Constants.Name.MARGIN: case Constants.Name.MARGIN_TOP: case Constants.Name.MARGIN_LEFT: case Constants.Name.MARGIN_RIGHT: case Constants.Name.MARGIN_BOTTOM: case Constants.Name.PADDING: case Constants.Name.PADDING_TOP: case Constants.Name.PADDING_LEFT: case Constants.Name.PADDING_RIGHT: case Constants.Name.PADDING_BOTTOM: case Constants.Name.LEFT: case Constants.Name.TOP: case Constants.Name.RIGHT: case Constants.Name.BOTTOM: return true; default: return false; } } @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy);  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy); String getInstanceId(); void bindHolder(IFComponentHolder holder); WXSDKInstance getInstance(); Context getContext(); boolean isLazy(); void lazy(boolean lazy); void applyLayoutAndEvent(WXComponent component); void bindData(WXComponent component); void refreshData(WXComponent component); final void setLayout(WXDomObject domObject); void setPadding(Spacing padding, Spacing border); void updateExtra(Object extra); WXDomObject getDomObject(); void updateProperties(Map<String, Object> props); void addEvent(String type); View getRealView(); Scrollable getParentScroller(); WXVContainer getParent(); String getRef(); final void createView(WXVContainer parent, int index); T getHostView(); @Deprecated View getView(); int getAbsoluteY(); int getAbsoluteX(); void updateDom(WXDomObject dom); final void removeEvent(String type); final void removeAllEvent(); final void removeStickyStyle(); boolean isSticky(); void setDisabled(boolean disabled); void setSticky(String sticky); void setBackgroundColor(String color); void setOpacity(float opacity); void setBorderRadius(String key, float borderRadius); void setBorderWidth(String key, float borderWidth); void setBorderStyle(String key, String borderStyle); void setBorderColor(String key, String borderColor); @Nullable String getVisibility(); void setVisibility(String visibility); void registerActivityStateListener(); @Override void onActivityCreate(); @Override void onActivityStart(); @Override void onActivityPause(); @Override void onActivityResume(); @Override void onActivityStop(); @Override void onActivityDestroy(); @Override boolean onActivityBack(); void destroy(); View detachViewAndClearPreInfo(); void computeVisiblePointInViewCoordinate(PointF pointF); boolean containsGesture(WXGestureType WXGestureType); void notifyAppearStateChange(String wxEventType,String direction); boolean isUsing(); void setUsing(boolean using); boolean hasScrollParent(WXComponent component); static int mComponentNum; public T mHost; @Deprecated
  volatile WXVContainer mParent; @Deprecated
  volatile WXDomObject mDomObj; @Deprecated
  final String mInstanceId; }
@Test public void testSetProperty() throws Exception { component.setProperty(Constants.Name.POSITION, Constants.Value.FIXED); component.setProperty(Constants.Name.BORDER_RADIUS,0.5f); component.setProperty(Constants.Name.BORDER_RADIUS,null); component.setProperty(Constants.Name.BORDER_WIDTH,null); component.setProperty(Constants.Name.BORDER_WIDTH,10); component.setProperty(Constants.Name.BORDER_STYLE,null); component.setProperty(Constants.Name.BORDER_STYLE, "SOLID"); component.setProperty(Constants.Name.BORDER_COLOR,null); component.setProperty(Constants.Name.BORDER_COLOR, "#ff0000"); component.setProperty(Constants.Name.VISIBILITY,null); component.setProperty(Constants.Name.VISIBILITY, Constants.Value.VISIBLE); }