本文整理汇总了Java中com.kotcrab.vis.ui.widget.spinner.Spinner类的典型用法代码示例。如果您正苦于以下问题:Java Spinner类的具体用法?Java Spinner怎么用?Java Spinner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Spinner类属于com.kotcrab.vis.ui.widget.spinner包,在下文中一共展示了Spinner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildNumberSelector
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public <T> Spinner buildNumberSelector(ConfigurableAttribute<T> attr) {
Integer min = getValue(Integer.class, attr.params().get("min"));
Integer max = getValue(Integer.class, attr.params().get("max"));
Integer precision = getValue(Integer.class, attr.params().get("precision"));
SimpleFloatSpinnerModel model = new SimpleFloatSpinnerModel(Float.parseFloat(attr.get().toString()), min, max, 1, precision);
Spinner spinner = new Spinner("", model);
fixVisSpinners(spinner);
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
attr.setSafe(model.getValue()+"");
}
});
return spinner;
}
示例2: onSettingsIntSpinnerChanged
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("onSettingsIntSpinnerChanged") void onSettingsIntSpinnerChanged(Spinner spinner) {
PackModel pack = getSelectedPack();
if (pack == null) return;
TexturePacker.Settings settings = pack.getSettings();
IntSpinnerModel model = (IntSpinnerModel) spinner.getModel();
switch (spinner.getName()) {
case "spnMinPageWidth": settings.minWidth = model.getValue(); break;
case "spnMinPageHeight": settings.minHeight = model.getValue(); break;
case "spnMaxPageWidth": settings.maxWidth = model.getValue(); break;
case "spnMaxPageHeight": settings.maxHeight = model.getValue(); break;
case "spnAlphaThreshold": settings.alphaThreshold = model.getValue(); break;
case "spnPaddingX": settings.paddingX = model.getValue(); break;
case "spnPaddingY": settings.paddingY = model.getValue(); break;
}
}
示例3: updateLeftPadFromView
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateLeftPadFromView") void updateLeftPadFromView(Spinner spinner) {
GridValues gridValues = getActiveGridValues();
IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();
int maxValue = model.texture.getWidth() - gridValues.right.get() - 1;
if (spinnerModel.getValue() > maxValue) {
spinnerModel.setValue(maxValue);
return;
}
gridValues.left.set(spinnerModel.getValue());
}
示例4: updateRightPadFromView
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateRightPadFromView") void updateRightPadFromView(Spinner spinner) {
GridValues gridValues = getActiveGridValues();
IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();
int maxValue = model.texture.getWidth() - gridValues.left.get() - 1;
if (spinnerModel.getValue() > maxValue) {
spinnerModel.setValue(maxValue);
return;
}
gridValues.right.set(spinnerModel.getValue());
}
示例5: updateBottomPadFromView
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateBottomPadFromView") void updateBottomPadFromView(Spinner spinner) {
GridValues gridValues = getActiveGridValues();
IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();
int maxValue = model.texture.getHeight() - gridValues.top.get() - 1;
if (spinnerModel.getValue() > maxValue) {
spinnerModel.setValue(maxValue);
return;
}
gridValues.bottom.set(spinnerModel.getValue());
}
示例6: updateTopPadFromView
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateTopPadFromView") void updateTopPadFromView(Spinner spinner) {
GridValues gridValues = getActiveGridValues();
IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();
int maxValue = model.texture.getHeight() - gridValues.bottom.get() - 1;
if (spinnerModel.getValue() > maxValue) {
spinnerModel.setValue(maxValue);
return;
}
gridValues.top.set(spinnerModel.getValue());
}
示例7: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
if (!(actor.getModel() instanceof ArraySpinnerModel<?>)) {
parser.throwErrorIfStrict(
"Spinner array attribute is available only for spinners with ArraySpinnerModel. Found array attribute on tag: "
+ tag.getTagName());
return;
}
final ArraySpinnerModel<Object> model = (ArraySpinnerModel<Object>) actor.getModel();
model.getItems().addAll((Object[]) parser.fullyParseArray(rawAttributeData, actor));
}
示例8: determinePolicy
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
/**
* @param parser parses the tag.
* @param actor requires text field event policy..
* @param rawAttributeData unparsed attribute's value.
* @return chosen {@link FileChooser.FileSorting}. Throws exception if ID not valid and parser is strict; returns
* default value if parser not strict.
*/
protected Spinner.TextFieldEventPolicy determinePolicy(final LmlParser parser, final Spinner actor,
final String rawAttributeData) {
final String modeName = Strings.toUpperCase(parser.parseString(rawAttributeData, actor).trim());
try {
return Spinner.TextFieldEventPolicy.valueOf(modeName);
} catch (final Exception exception) {
// Unknown ID.
parser.throwErrorIfStrict("Unable to determine text field event policy with data: " + rawAttributeData,
exception);
}
return Spinner.TextFieldEventPolicy.ON_FOCUS_LOST;
}
示例9: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
LmlUtilities.getLmlUserObject(actor).addOnCloseAction(new ActorConsumer<Void, Object>() {
@Override
public Void consume(final Object spinner) {
final SpinnerModel model = actor.getModel();
if (model instanceof IntSpinnerModel) {
((IntSpinnerModel) model).setValue(parser.parseInt(rawAttributeData, actor), false);
} else if (model instanceof FloatSpinnerModel) {
try {
((FloatSpinnerModel) model)
.setValue(new BigDecimal(parser.parseString(rawAttributeData, actor)), false);
} catch (final NumberFormatException exception) {
parser.throwErrorIfStrict("Invalid numeric value: " + rawAttributeData, exception);
}
} else if (model instanceof SimpleFloatSpinnerModel) {
((SimpleFloatSpinnerModel) model).setValue(parser.parseFloat(rawAttributeData, actor), false);
} else if (model instanceof ArraySpinnerModel<?>) {
((ArraySpinnerModel<?>) model).setCurrent(parser.parseInt(rawAttributeData, actor), false);
} else {
parser.throwErrorIfStrict("Unknown model: " + model + ". Unable to select value.");
}
actor.notifyValueChanged(false);
return null;
}
});
}
示例10: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
final SpinnerModel model = actor.getModel();
final int precision = parser.parseInt(rawAttributeData, actor);
if (model instanceof FloatSpinnerModel) {
((FloatSpinnerModel) model).setScale(precision);
} else if (model instanceof SimpleFloatSpinnerModel) {
((SimpleFloatSpinnerModel) model).setPrecision(precision);
} else {
parser.throwErrorIfStrict(
"Precision (scale) attribute can be used only for spinners with models storing decimal values. Found attribute in tag: "
+ tag.getTagName());
}
}
示例11: getHandledType
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public Class<Spinner> getHandledType() {
return Spinner.class;
}
示例12: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(LmlParser parser, LmlTag tag, Spinner spinner, String rawAttributeData) {
spinner.setTextFieldEventPolicy(determinePolicy(parser, spinner, rawAttributeData));
}
示例13: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
actor.getModel().setWrap(parser.parseBoolean(rawAttributeData, actor));
}
示例14: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
actor.setProgrammaticChangeEvents(parser.parseBoolean(rawAttributeData, actor));
}
示例15: process
import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
actor.setSelectorName(parser.parseString(rawAttributeData, actor));
}