Search in sources :

Example 1 with TextInputFigure

use of org.csstudio.swt.widgets.figures.TextInputFigure in project yamcs-studio by yamcs.

the class TextInputEditpart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    initFields();
    if (shouldBeTextInputFigure()) {
        TextInputFigure textInputFigure = (TextInputFigure) createTextFigure();
        initTextFigure(textInputFigure);
        setDelegate(new Draw2DTextInputEditpartDelegate(this, getWidgetModel(), textInputFigure));
    } else {
        setDelegate(new NativeTextEditpartDelegate(this, getWidgetModel()));
    }
    getPVWidgetEditpartDelegate().setUpdateSuppressTime(-1);
    updatePropSheet();
    return delegate.doCreateFigure();
}
Also used : TextInputFigure(org.csstudio.swt.widgets.figures.TextInputFigure)

Example 2 with TextInputFigure

use of org.csstudio.swt.widgets.figures.TextInputFigure in project yamcs-studio by yamcs.

the class Draw2DTextInputEditpartDelegate method registerPropertyChangeHandlers.

@Override
public void registerPropertyChangeHandlers() {
    IWidgetPropertyChangeHandler selectorTypeHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((TextInputFigure) figure).setSelectorType(model.getSelectorType());
            return false;
        }
    };
    editpart.setPropertyChangeHandler(TextInputModel.PROP_SELECTOR_TYPE, selectorTypeHandler);
    IWidgetPropertyChangeHandler dateTimeFormatHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((TextInputFigure) figure).setDateTimeFormat((String) newValue);
            return false;
        }
    };
    editpart.setPropertyChangeHandler(TextInputModel.PROP_DATETIME_FORMAT, dateTimeFormatHandler);
    IWidgetPropertyChangeHandler fileSourceHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((TextInputFigure) figure).setFileSource(FileSource.values()[(Integer) newValue]);
            return false;
        }
    };
    editpart.setPropertyChangeHandler(TextInputModel.PROP_FILE_SOURCE, fileSourceHandler);
    IWidgetPropertyChangeHandler fileReturnPartHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((TextInputFigure) figure).setFileReturnPart(FileReturnPart.values()[(Integer) newValue]);
            return false;
        }
    };
    editpart.setPropertyChangeHandler(TextInputModel.PROP_FILE_RETURN_PART, fileReturnPartHandler);
}
Also used : IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) TextInputFigure(org.csstudio.swt.widgets.figures.TextInputFigure) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

TextInputFigure (org.csstudio.swt.widgets.figures.TextInputFigure)2 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)1 IFigure (org.eclipse.draw2d.IFigure)1