Package lcmc.common.domain

Examples of lcmc.common.domain.Unit


    private Application application;
    @Inject
    private StartTests startTests;

    public static Unit getUnitMilliSec() {
        return new Unit("ms", "ms", "Millisecond", "Milliseconds");
    }
View Full Code Here


        super.init(regexp, enableAccessMode, fieldButton);
        final JPanel newComp = new JPanel();
        newComp.setLayout(new SpringLayout());

        final String number;
        final Unit unit;
        if (selectedValue == null) {
            number = null;
            unit = null;
        } else {
            number = selectedValue.getValueForConfig();
View Full Code Here

        unitComboBox.setMinimumSize(unitComboBox.getPreferredSize());
        unitComboBox.setMaximumSize(unitComboBox.getPreferredSize());
    }

    private Unit addItems(final Collection<Unit> comboList, final Unit selectedValue, final Unit[] items) {
        Unit selectedUnit = null;
        if (items != null) {
            for (final Unit item : items) {
                if (item.equals(selectedValue)) {
                    selectedUnit = item;
                }
View Full Code Here

                                        final Unit[] items,
                                        final String regexp,
                                        final Map<String, String> abbreviations) {
        final List<Unit> comboList = new ArrayList<Unit>();

        final Unit selectedValueInfo = addItems(comboList, selectedValue, items);
        final MComboBox<Unit> cb = new MComboBox<Unit>(comboList.toArray(new Unit[comboList.size()]));
        final JTextComponent editor = (JTextComponent) cb.getEditor().getEditorComponent();
        if (regexp != null) {
            editor.setDocument(new PatternDocument(regexp, abbreviations));
        }
View Full Code Here

    /** Return value, that user have chosen in the field or typed in. */
    @Override
    protected Value getValueInternal() {
        final String text = textFieldPart.getText();
        final Unit unit = (Unit) unitComboBox.getSelectedItem();
        if (unit != null) {
            if (unit.isPlural() == "1".equals(text)) {
                unit.setPlural(!"1".equals(text));
                unitComboBox.repaint();
            }
            final boolean accessible = application.isAccessible(getEnableAccessMode());
            if (text == null || text.isEmpty()) {
                if (!unit.isEmpty()) {
                    unit.setEmpty(true);
                    unitEnabled = false;
                    application.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            unitComboBox.repaint();
                            unitComboBox.setEnabled(false);
                        }
                    });
                }
            } else {
                if (unit.isEmpty()) {
                    unit.setEmpty(false);
                    if (textFieldPart.isEnabled()) {
                        unitEnabled = true;
                        application.invokeLater(new Runnable() {
                            @Override
                            public void run() {
View Full Code Here

        HARDCODED_DEFAULTS.put("on-no-data-accessible", new StringValue("io-error"));
        HARDCODED_DEFAULTS.put("on-congestion", new StringValue("block"));
    }

    public static Unit getUnitBytes(final String unitPart) {
        return new Unit("", "", "Byte" + unitPart, "Bytes" + unitPart);
    }
View Full Code Here

    public static Unit getUnitBytes(final String unitPart) {
        return new Unit("", "", "Byte" + unitPart, "Bytes" + unitPart);
    }

    public static Unit getUnitKiBytes(final String unitPart) {
        return new Unit("K", "k", "KiByte" + unitPart, "KiBytes" + unitPart);
    }
View Full Code Here

    public static Unit getUnitKiBytes(final String unitPart) {
        return new Unit("K", "k", "KiByte" + unitPart, "KiBytes" + unitPart);
    }

    public static Unit getUnitMiBytes(final String unitPart) {
        return new Unit("M", "m", "MiByte" + unitPart, "MiBytes" + unitPart);
    }
View Full Code Here

    public static Unit getUnitMiBytes(final String unitPart) {
        return new Unit("M", "m", "MiByte" + unitPart, "MiBytes" + unitPart);
    }

    public static Unit getUnitGiBytes(final String unitPart) {
        return new Unit("G", "g", "GiByte" + unitPart, "GiBytes" + unitPart);
    }
View Full Code Here

    public static Unit getUnitGiBytes(final String unitPart) {
        return new Unit("G", "g", "GiByte" + unitPart, "GiBytes" + unitPart);
    }

    public static Unit getUnitTiBytes(final String unitPart) {
        return new Unit("T", "t", "TiByte" + unitPart, "TiBytes" + unitPart);
    }
View Full Code Here

TOP

Related Classes of lcmc.common.domain.Unit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.