@Override public void onDrop(DragSource source, int x, int y, int offsetX, int offsetY) { MockComponent sourceComponent = ((SimplePaletteItem) source).createMockComponent(); // Add component to the form form.addComponent(sourceComponent); // Add component to this panel addComponent(sourceComponent); sourceComponent.select(); }
@Override public void configureComponent(MockComponent mockComponent) { String componentType = mockComponent.getType(); // Configure properties for (PropertyDefinition property : COMPONENT_DATABASE.getPropertyDefinitions(componentType)) { mockComponent.addProperty( property.getName(), property.getDefaultValue(), property.getCaption(), createPropertyEditor(property.getEditorType())); } }
/** * Instantiates the corresponding mock component. * * @return mock component */ public MockComponent createMockComponentFromPalette() { MockComponent mockComponent = createMockComponent(name, editor); mockComponent.onCreateFromPalette(); return mockComponent; }