private JComboBox buildLineaControl() {
   final JComboBox box = new JComboBox();
   final EventList source =
       GlazedLists.eventList(
           ServiceLocator2.getHibernateTemplate().find("from Linea l order by l.nombre"));
   final TextFilterator filterator = GlazedLists.textFilterator(new String[] {"nombre"});
   AutoCompleteSupport support = AutoCompleteSupport.install(box, source, filterator);
   support.setFilterMode(TextMatcherEditor.STARTS_WITH);
   support.setCorrectsCase(true);
   return box;
 }
Beispiel #2
0
 public void setNodeTypes(Set nodeTypes) {
   comboBoxSet = new ComboBoxSet(nodeTypes, true);
   AutoCompleteSupport.install(
       nodeTypeCombo, GlazedLists.eventListOf(comboBoxSet.getStringArray()));
   nodeTypeCombo.setSelectedItem(initialSelection);
   if (lockSelection) {
     nodeTypeCombo.setEnabled(false);
   }
 }
Beispiel #3
0
 private JComponent buildProveedorControl(final ValueModel vm) {
   if (model.getValue("proveedor") == null) {
     final JComboBox box = new JComboBox();
     final EventList source =
         GlazedLists.eventList(ServiceLocator2.getProveedorManager().getAll());
     final TextFilterator filterator =
         GlazedLists.textFilterator(new String[] {"clave", "nombre", "rfc"});
     AutoCompleteSupport support = AutoCompleteSupport.install(box, source, filterator);
     support.setFilterMode(TextMatcherEditor.CONTAINS);
     support.setStrict(false);
     final EventComboBoxModel model = (EventComboBoxModel) box.getModel();
     model.addListDataListener(new Bindings.WeakListDataListener(vm));
     box.setSelectedItem(vm.getValue());
     return box;
   } else {
     String prov = ((Proveedor) vm.getValue()).getNombreRazon();
     JLabel label = new JLabel(prov);
     return label;
   }
 }
  public StockpileItemDialog(final Program program) {
    super(program, TabsStockpile.get().addStockpileItem(), Images.TOOL_STOCKPILE.getImage());

    ListenerClass listener = new ListenerClass();

    JLabel jItemsLabel = new JLabel(TabsStockpile.get().item());
    jItems = new JComboBox();
    AutoCompleteSupport<Item> itemAutoComplete =
        AutoCompleteSupport.install(
            jItems, EventModels.createSwingThreadProxyList(items), new ItemFilterator());
    itemAutoComplete.setStrict(true);
    itemAutoComplete.setCorrectsCase(true);
    jItems.addItemListener(listener); // Must be added after AutoCompleteSupport

    JLabel jCountMinimumLabel = new JLabel(TabsStockpile.get().countMinimum());
    jCountMinimum = new JTextField();
    jCountMinimum.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(final FocusEvent e) {
            jCountMinimum.selectAll();
          }
        });
    jCountMinimum.addCaretListener(listener);

    jCopy = new JCheckBox(TabsStockpile.get().copy());
    jCopy.setActionCommand(StockpileItemAction.COPY.name());
    jCopy.addActionListener(listener);

    jOK = new JButton(TabsStockpile.get().ok());
    jOK.setActionCommand(StockpileItemAction.OK.name());
    jOK.addActionListener(listener);
    jOK.setEnabled(false);

    jCancel = new JButton(TabsStockpile.get().cancel());
    jCancel.setActionCommand(StockpileItemAction.CANCEL.name());
    jCancel.addActionListener(listener);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.TRAILING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(jItemsLabel)
                            .addComponent(jCountMinimumLabel))
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(jItems, 300, 300, 300)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(jCountMinimum, 100, 100, Short.MAX_VALUE)
                                    .addComponent(jCopy))))
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        jOK, Program.BUTTONS_WIDTH, Program.BUTTONS_WIDTH, Program.BUTTONS_WIDTH)
                    .addComponent(
                        jCancel,
                        Program.BUTTONS_WIDTH,
                        Program.BUTTONS_WIDTH,
                        Program.BUTTONS_WIDTH)));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(
                        jItemsLabel,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jItems,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(
                        jCountMinimumLabel,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jCountMinimum,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jCopy,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(
                        jOK, Program.BUTTONS_HEIGHT, Program.BUTTONS_HEIGHT, Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jCancel,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)));
  }