public void registerEvent(IObservableValueListener manager, IProperty property) { Object host = manager.getHost(); IEventController controller = UserData.findEventController(host); if (controller == null) { controller = UserData.updateEventController(host); } IMetaclass metaclass = XWT.getMetaclass(host); EventProperty reaisedEventProperty = (EventProperty) property; String raisedName = reaisedEventProperty.getEvent().getName(); for (String name : getEventNames()) { if (name.equalsIgnoreCase(raisedName)) { continue; } String eventPropertyName = IEventConstants.getEventPropertyName(name); String eventName = IEventConstants.getEventName(name); IEvent event = metaclass.findEvent(eventName); IProperty eventProperty = metaclass.findProperty(eventPropertyName); try { controller.setEvent( event, UserData.getWidget(host), manager, eventProperty, IObservableValueListener.class.getDeclaredMethod( "changeValueHandle", Object.class, org.eclipse.swt.widgets.Event.class)); } catch (Exception e) { LoggerManager.log(e); return; } } }
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException { TableViewerColumn tableViewerColumn = (TableViewerColumn) target; TableColumn tableColumn = tableViewerColumn.getColumn(); UserData.setLocalData(tableColumn, getPropertyKey(), value); }
protected Object getDataContextHost() { Object control = getControl(); if (control == null) { return null; } Object data = UserData.getLocalDataContext(control); if (data == null || data == this) { if (data == null && UserData.hasLocalData(control, IUserDataConstants.XWT_DATACONTEXT_KEY)) { return control; } Widget parent = UserData.getParent(control); if (parent != null) { return UserData.getDataContextHost(parent); } return null; } return control; }
protected Object getDataContext() { if (control != null) { return UserData.getDataContext(control); } return null; }