Package org.openstreetmap.josm.gui.tagging.ac

Examples of org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField


    /**
     * constructor
     */
    public TagCellEditor() {
        editor = new AutoCompletingTextField();
        editor.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    }
View Full Code Here


        pnl.add(scrollPane, gc);

        // --- role editing
        JPanel p3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
        p3.add(new JLabel(tr("Apply Role:")));
        tfRole = new AutoCompletingTextField(10);
        tfRole.setToolTipText(tr("Enter a role and apply it to the selected relation members"));
        tfRole.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                tfRole.selectAll();
View Full Code Here

        return comp;
    }
   
    protected final void createColumns() {
       
        AutoCompletingTextField roleEditor = new AutoCompletingTextField();
        RelationMemberConflictDecisionRenderer decisionRenderer = new RelationMemberConflictDecisionRenderer();
        RelationMemberConflictDecisionEditor decisionEditor = new RelationMemberConflictDecisionEditor();

        TableColumn col = null;
View Full Code Here

    /**
     * constructor
     */
    public MemberRoleCellEditor(DataSet ds) {
        this.ds = ds;
        editor = new AutoCompletingTextField();
        editor.setBorder(BorderFactory.createEmptyBorder(1,1,1,1));
        autoCompletionList = new AutoCompletionList();
        editor.setAutoCompletionList(autoCompletionList);
    }
View Full Code Here

        @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {

            // find out if our key is already used in the selection.
            Usage usage = determineTextUsage(sel, key);
            AutoCompletingTextField textField = new AutoCompletingTextField();
            if (alternative_autocomplete_keys != null) {
                initAutoCompletionField(textField, (key + "," + alternative_autocomplete_keys).split(","));
            } else {
                initAutoCompletionField(textField, key);
            }
            if (length != null && !length.isEmpty()) {
                textField.setMaxChars(Integer.valueOf(length));
            }
            if (usage.unused()){
                if (auto_increment_selected != && auto_increment != null) {
                    try {
                        textField.setText(Integer.toString(Integer.parseInt(LAST_VALUES.get(key)) + auto_increment_selected));
                    } catch (NumberFormatException ex) {
                        // Ignore - cannot auto-increment if last was non-numeric
                    }
                }
                else if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) {
                    // selected osm primitives are untagged or filling default values feature is enabled
                    if (!"false".equals(use_last_as_default) && LAST_VALUES.containsKey(key) && !presetInitiallyMatches) {
                        textField.setText(LAST_VALUES.get(key));
                    } else {
                        textField.setText(default_);
                    }
                } else {
                    // selected osm primitives are tagged and filling default values feature is disabled
                    textField.setText("");
                }
                value = textField;
                originalValue = null;
            } else if (usage.hasUniqueValue()) {
                // all objects use the same value
                textField.setText(usage.getFirst());
                value = textField;
                originalValue = usage.getFirst();
            } else {
                // the objects have different values
                JosmComboBox<String> comboBox = new JosmComboBox<>(usage.values.toArray(new String[0]));
View Full Code Here

            combo = new JosmComboBox<>(lhm.values().toArray(new PresetListEntry[0]));
            component = combo;
            combo.setRenderer(getListCellRenderer());
            combo.setEditable(editable);
            combo.reinitialize(lhm.values());
            AutoCompletingTextField tf = new AutoCompletingTextField();
            initAutoCompletionField(tf, key);
            if (length != null && !length.isEmpty()) {
                tf.setMaxChars(Integer.valueOf(length));
            }
            AutoCompletionList acList = tf.getAutoCompletionList();
            if (acList != null) {
                acList.add(getDisplayValues(), AutoCompletionItemPriority.IS_IN_STANDARD);
            }
            combo.setEditor(tf);
View Full Code Here

    protected JPanel buildRoleEditingPanel() {
        JPanel pnl = new JPanel();
        pnl.setLayout(new FlowLayout(FlowLayout.LEFT));
        pnl.add(new JLabel(tr("Role:")));
        pnl.add(tfRole = new AutoCompletingTextField(10));
        tfRole.setToolTipText(tr("Enter a role for all relation memberships"));
        pnl.add(new JButton(new ApplyRoleAction()));
        tfRole.addActionListener(new ApplyRoleAction());
        tfRole.addFocusListener(
                new FocusAdapter() {
View Full Code Here

        cbTagRelations.setToolTipText(
                tr("<html>Select to enable entering a tag which will be applied<br>"
                        + "to all modified relations.</html>"));
        pnl.add(cbTagRelations);
        pnl.add(new JLabel(trc("tag", "Key:")));
        pnl.add(tfKey = new AutoCompletingTextField(10));
        tfKey.setToolTipText(tr("<html>Enter a tag key, e.g. <strong><tt>fixme</tt></strong></html>"));
        pnl.add(new JLabel(tr("Value:")));
        pnl.add(tfValue = new AutoCompletingTextField(10));
        tfValue.setToolTipText(tr("<html>Enter a tag value, e.g. <strong><tt>check members</tt></strong></html>"));
        cbTagRelations.setSelected(false);
        tfKey.setEnabled(false);
        tfValue.setEnabled(false);
        return pnl;
View Full Code Here

    public void prepareForEditing() {
        AutoCompletionList acList = new AutoCompletionList();
        Main.main.getEditLayer().data.getAutoCompletionManager().populateWithMemberRoles(acList);
        tfRole.setAutoCompletionList(acList);
        AutoCompletingTextField editor = (AutoCompletingTextField) tblResolver.getColumnModel().getColumn(2).getCellEditor();
        if (editor != null) {
            editor.setAutoCompletionList(acList);
        }
        AutoCompletionList acList2 = new AutoCompletionList();
        Main.main.getEditLayer().data.getAutoCompletionManager().populateWithKeys(acList2);
        tfKey.setAutoCompletionList(acList2);
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField

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.