当前位置: 首页>>代码示例>>Java>>正文


Java IntSpinnerModel类代码示例

本文整理汇总了Java中com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel的典型用法代码示例。如果您正苦于以下问题:Java IntSpinnerModel类的具体用法?Java IntSpinnerModel怎么用?Java IntSpinnerModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntSpinnerModel类属于com.kotcrab.vis.ui.widget.spinner包,在下文中一共展示了IntSpinnerModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createModel

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
@Override
protected SpinnerModel createModel(final LmlActorBuilder builder) {
    final IntRangeLmlActorBuilder rangeBuilder = (IntRangeLmlActorBuilder) builder;
    return new IntSpinnerModel(rangeBuilder.getValue(), rangeBuilder.getMin(), rangeBuilder.getMax(), rangeBuilder.getStep()) {
        @Override
        public void textChanged() {
            super.textChanged();

            String text = spinner.getTextField().getText();
            if (checkInputBounds(text)) {
                spinner.notifyValueChanged(true);
            }
        }

        private boolean checkInputBounds (String input) {
            try {
                float x = Integer.parseInt(input);
                return x >= getMin() && x <= getMax();
            } catch (NumberFormatException e) {
                return false;
            }
        }
    };
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:25,代码来源:FixedIntSpinnerLmlTag.java

示例2: onSettingsIntSpinnerChanged

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的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;
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:17,代码来源:MainController.java

示例3: updatePadValuesFromView

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
@LmlAction("updatePadValuesFromView") void updatePadValuesFromView() {
    GridValues gridValues = getActiveGridValues();
    gridValues.set(
            ((IntSpinnerModel) spnValueLeft.getModel()).getValue(),
            ((IntSpinnerModel) spnValueRight.getModel()).getValue(),
            ((IntSpinnerModel) spnValueBottom.getModel()).getValue(),
            ((IntSpinnerModel) spnValueTop.getModel()).getValue());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:9,代码来源:NinePatchEditorDialog.java

示例4: updateLeftPadFromView

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的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());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例5: updateRightPadFromView

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的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());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例6: updateBottomPadFromView

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的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());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例7: updateTopPadFromView

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的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());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例8: updatePadValuesFromModel

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
private void updatePadValuesFromModel() {
    GridValues gridValues = getActiveGridValues();
    ((IntSpinnerModel) spnValueLeft.getModel()).setValue(gridValues.left.get());
    ((IntSpinnerModel) spnValueRight.getModel()).setValue(gridValues.right.get());
    ((IntSpinnerModel) spnValueBottom.getModel()).setValue(gridValues.bottom.get());
    ((IntSpinnerModel) spnValueTop.getModel()).setValue(gridValues.top.get());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:8,代码来源:NinePatchEditorDialog.java

示例9: process

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的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;
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:28,代码来源:SpinnerSelectedLmlAttribute.java

示例10: updateViewsFromPack

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
private void updateViewsFromPack(PackModel pack) {
    if (actorsPacks.packListAdapter.getSelected() != pack) {
        actorsPacks.packListAdapter.getSelectionManager().deselectAll();
        if (pack != null) {
            actorsPacks.packListAdapter.getSelectionManager().select(pack);
        }
    }

    // Update pack list item
    PackListAdapter.ViewHolder viewHolder = actorsPacks.packListAdapter.getViewHolder(pack);
    if (viewHolder != null) {
        viewHolder.updateViewData();
    }

    if (pack != null) {
        actorsPacks.edtOutputDir.setText(pack.getOutputDir());
        actorsPacks.edtFileName.setText(pack.getFilename());
        actorsPacks.edtFileName.setMessageText(pack.getName() + ".atlas");
    } else {
        actorsPacks.edtOutputDir.setText(null);
        actorsPacks.edtFileName.setText(null);
    }

    if (pack != null) {
        TexturePacker.Settings settings = pack.getSettings();

        actorsPackSettings.cbUseFastAlgorithm.setChecked(settings.fast);
        actorsPackSettings.cbEdgePadding.setChecked(settings.edgePadding);
        actorsPackSettings.cbStripWhitespaceX.setChecked(settings.stripWhitespaceX);
        actorsPackSettings.cbStripWhitespaceY.setChecked(settings.stripWhitespaceY);
        actorsPackSettings.cbAllowRotation.setChecked(settings.rotation);
        actorsPackSettings.cbBleeding.setChecked(settings.bleed);
        actorsPackSettings.cbDuplicatePadding.setChecked(settings.duplicatePadding);
        actorsPackSettings.cbForcePot.setChecked(settings.pot);
        actorsPackSettings.cbUseAliases.setChecked(settings.alias);
        actorsPackSettings.cbIgnoreBlankImages.setChecked(settings.ignoreBlankImages);
        actorsPackSettings.cbDebug.setChecked(settings.debug);
        actorsPackSettings.cbUseIndices.setChecked(settings.useIndexes);
        actorsPackSettings.cbPremultiplyAlpha.setChecked(settings.premultiplyAlpha);
        actorsPackSettings.cbGrid.setChecked(settings.grid);
        actorsPackSettings.cbSquare.setChecked(settings.square);
        actorsPackSettings.cbLimitMemory.setChecked(settings.limitMemory);

        ((IntSpinnerModel) actorsPackSettings.spnMinPageWidth.getModel()).setValue(settings.minWidth, false);
        ((IntSpinnerModel) actorsPackSettings.spnMinPageHeight.getModel()).setValue(settings.minHeight, false);
        ((IntSpinnerModel) actorsPackSettings.spnMaxPageWidth.getModel()).setValue(settings.maxWidth, false);
        ((IntSpinnerModel) actorsPackSettings.spnMaxPageHeight.getModel()).setValue(settings.maxHeight, false);
        ((IntSpinnerModel) actorsPackSettings.spnAlphaThreshold.getModel()).setValue(settings.alphaThreshold, false);
        ((IntSpinnerModel) actorsPackSettings.spnPaddingX.getModel()).setValue(settings.paddingX, false);
        ((IntSpinnerModel) actorsPackSettings.spnPaddingY.getModel()).setValue(settings.paddingY, false);

        actorsPackSettings.cboMinFilter.setSelected(settings.filterMin);
        actorsPackSettings.cboMagFilter.setSelected(settings.filterMag);
        actorsPackSettings.cboWrapX.setSelected(settings.wrapX);
        actorsPackSettings.cboWrapY.setSelected(settings.wrapY);

        // Scale factors
        {
            StringBuilder sb = new StringBuilder();
            Array<ScaleFactorModel> scaleFactors = pack.getScaleFactors();
            for (int i = 0; i < scaleFactors.size; i++) {
                ScaleFactorModel scaleFactor = scaleFactors.get(i);
                sb.append(String.format(Locale.US, "%.2f", scaleFactor.getFactor()));
                if (i < scaleFactors.size-1) { sb.append(", "); }
            }
            actorsPackSettings.eetbScaleFactors.setText(sb.toString());
        }
    }

    // Update pane lockers
    for (Actor locker : packPaneLockers) {
        locker.setVisible(pack == null);
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:75,代码来源:MainController.java

示例11: onLevelValueChanged

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
@LmlAction("onLevelValueChanged") void onLevelValueChanged() {
    int level = ((IntSpinnerModel) spnLevel.getModel()).getValue();
    compressionModel.setLevel(level);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:5,代码来源:PngtasticCompDialogController.java

示例12: updateValuesFromModel

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
private void updateValuesFromModel() {
    ((IntSpinnerModel) spnLevel.getModel()).setValue(compressionModel.getLevel());
    chbRemoveGamma.setChecked(compressionModel.isRemoveGamma());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:5,代码来源:PngtasticCompDialogController.java

示例13: onIterationsValueChanged

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
@LmlAction("onIterationsValueChanged") void onIterationsValueChanged() {
    int level = ((IntSpinnerModel) spnIterations.getModel()).getValue();
    compressionModel.setIterations(level);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:5,代码来源:ZopfliCompDialogController.java

示例14: updateValuesFromModel

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
private void updateValuesFromModel() {
    ((IntSpinnerModel) spnLevel.getModel()).setValue(compressionModel.getLevel());
    ((IntSpinnerModel) spnIterations.getModel()).setValue(compressionModel.getIterations());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:5,代码来源:ZopfliCompDialogController.java

示例15: createModel

import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; //导入依赖的package包/类
@Override
protected SpinnerModel createModel(final LmlActorBuilder builder) {
    final IntRangeLmlActorBuilder rangeBuilder = (IntRangeLmlActorBuilder) builder;
    return new IntSpinnerModel(rangeBuilder.getValue(), rangeBuilder.getMin(), rangeBuilder.getMax(),
            rangeBuilder.getStep());
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:7,代码来源:IntSpinnerLmlTag.java


注:本文中的com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。