Package DisplayProject.controls

Examples of DisplayProject.controls.AutoResizingComboBox$ComboBoxResizer


            }
           
            // Now we've got the top level manager, we need to bind our component to it.
            if (topLevelManager != null) {
              if (newComponent instanceof AutoResizingComboBox) {
                AutoResizingComboBox box = (AutoResizingComboBox)newComponent;
                topLevelManager.bindComponent(box, BindingManager.getDataObjectPath(origComponent), ElementList.get(box));
              }
              else if (newComponent instanceof PaletteList) {
                PaletteList list = (PaletteList)newComponent;
                topLevelManager.bindComponent(list, BindingManager.getDataObjectPath(origComponent), ElementList.get(list));
View Full Code Here


     * appropriate element will be displayed, or an empty combobox. Otherwise the passed
     * value will be displayed within the combobox.
     */
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
    {
        AutoResizingComboBox aComboBox = null;
        try {
            aComboBox = (AutoResizingComboBox)this.comboBox.getClass().newInstance();  
        }
        catch (InstantiationException e) {
            aComboBox = new AutoResizingComboBox();
        }
        catch (IllegalAccessException e) {
            aComboBox = new AutoResizingComboBox();
        }
        ArrayFieldCellHelper.setUpCellRenderer(this.comboBox, aComboBox); // CraigM: 28/03/2008
       
        // TF:12/11/07:Added the sizing in of a combo box.
        aComboBox.setSize(this.comboBox.getWidth(), this.comboBox.getHeight());

        if (GridCell.get(this.comboBox).getWidthPolicy() == Constants.SP_EXPLICIT) {
          aComboBox.setPreferredSize(new Dimension(this.comboBox.getWidth(), this.comboBox.getHeight()));
        }
        // CraigM:06/11/2008 - If sized natural, size to minimum (this is calculated based on the contents of the list)
        else if (GridCell.get(this.comboBox).getWidthPolicy() == Constants.SP_NATURAL) {
          aComboBox.setPreferredSize(this.comboBox.getMinimumSize());
        }
        else {
          aComboBox.setPreferredSize(this.comboBox.getPreferredSize());
        }
        aComboBox.setMinimumSize(aComboBox.getPreferredSize());
        aComboBox.setName(table.getName() + "." + row + "." + col);
        Array_Of_ListElement<ListElement> elements = null;
        if (rowElements != null){
            //PM:10/8/07
            /*
             * customize the element list per row, if there is
             * no customisation for the row
             * use the default
             */
            elements = (Array_Of_ListElement<ListElement>)rowElements.get(row);
        }
        if (elements == null){
            //PM:17/7/07 add a DropListModel with the correct data
            elements =((DropListModel)this.comboBox.getModel()).getElementList();
        }
        aComboBox.setModel(new DropListModel(elements, aComboBox));
        // TF:17/07/07: Added check to ensure it's editable
        aComboBox.setEditable(this.comboBox.isEditable());
        if (isSelected)
        {
            aComboBox.setForeground(table.getSelectionForeground());
            aComboBox.setBackground(table.getSelectionBackground());
        }
        else
        {
          // TF:19/01/2010:DET-140:We want the background colour to be the colour of the template.
//            aComboBox.setForeground(this.defaultforeground);
//            aComboBox.setBackground(this.defaultBackground);
            aComboBox.setForeground(this.comboBox.getForeground());
            aComboBox.setBackground(this.comboBox.getBackground());
        }

        if (value != null)
        {
            if (value instanceof Number || value instanceof IntegerData)
            {
                // Scan through the list to find a match for this number
                int num;
                if (value instanceof Number) {
                    num = ((Number)value).intValue();
                }
                else {
                    IntegerData anInt = (IntegerData)value;
                    if (anInt.isNull()) {
                        return aComboBox;
                    }
                    else {
                        num = anInt.intValue();
                    }
                }
                aComboBox.setSelectedItem(null);
                int limit = aComboBox.getModel().getSize();             // KM changed this.comboBox to aComboBox
                for (int i = 0; i < limit; i++) {
                    Object o = aComboBox.getModel().getElementAt(i);    // KM changed this.comboBox to aComboBox
                    if (o instanceof ListElement) {
                        if (((ListElement)o).getIntegerValue() == num)
                        {
                            //PM:9/8/07 selecting the correct value
                            aComboBox.setSelectedIndex(i);
                            return aComboBox;
                        }
                    }
                }
                // TF:04/09/2009:Changed this to be aComboBox. See JIRA DET-114
                if (aComboBox.getModel().getSize() > 0
                {
                    //PM:17/7/07 added test to cater for FillInField
                    //Do not select the value if the item does not exist
                    if (!aComboBox.isEditable()){
                        // aComboBox.addItem(comboBox.getModel().getElementAt(0));
                        aComboBox.setSelectedIndex(0);  
                    } else {
                        aComboBox.getEditor().setItem(value);
                    }
                }
            }
            //PM:17/8/07 handle text correctly
            else if (value instanceof String || value instanceof TextData){
                aComboBox.setSelectedItem(null);
                int limit = aComboBox.getModel().getSize();                 // KM changed this.comboBox to aComboBox
                for (int i = 0; i < limit; i++) {
                    Object o = aComboBox.getModel().getElementAt(i);        // KM changed this.comboBox to aComboBox
                    if (o instanceof ListElement) {
                        if (((ListElement)o).getTextValue().toString().equalsIgnoreCase(value.toString()))
                        {
                            aComboBox.setSelectedIndex(i);
                            return aComboBox;
                        }
                    }
                }
                // TF:04/09/2009:Changed this to be aComboBox. See JIRA DET-114
                if (aComboBox.getModel().getSize() > 0
                {
                    if (!aComboBox.isEditable()){
                        aComboBox.setSelectedIndex(0);  
                    } else {
                        aComboBox.getEditor().setItem(value);
                    }
                }
            }
            else
            {
                //PM:17/7/07 added test to cater for FillInField
                //Do not select the value if the item does not exist
                if (!aComboBox.isEditable()){
                    //TF:17/07/07 We cannot add a value easily, just assume it's in the list
                    // aComboBox.addItem(value);
                    aComboBox.setSelectedItem(value);  
                } else {
                    aComboBox.getEditor().setItem(value);
                }
            }
        }

        return aComboBox;
View Full Code Here

                                                    int row,
                                                    int column) {
        Component result = super.getTableCellEditorComponent(table, value, isSelected, row, column);
       // AD:26/6/2008 Change JComboBox to AutoResizingComboBox to reduce casting later
        if (result instanceof AutoResizingComboBox) {
            AutoResizingComboBox cb = (AutoResizingComboBox)result;
            if (cb.getModel() instanceof DropListModel){
              DropListModel model = (DropListModel)cb.getModel();
             
                Array_Of_ListElement<ListElement> elements = null;
                if (rowElements != null){
                    //PM:10/8/07
                    /*
                     * customize the element list per row, if there is
                     * no customisation for the row
                     * use the default
                     */
                    elements = rowElements.get(row);
                }
                if (elements == null){
                    //PM:17/7/07 add a DropListModel with the correct data
                    elements = this.defaultElements;
                }
                cb.setModel(new DropListModel(elements, cb));
           
              if (value instanceof Integer) {
                  model.setIntegerValue(((Integer)value).intValue());
              }
              else if (value instanceof IntegerData) {
View Full Code Here

            }
            Component result = super.getTableCellEditorComponent(table, value, isSelected, row, column);
         // AD:26/6/2008 Change JComboBox to AutoResizingComboBox to reduce casting later
            if (result instanceof AutoResizingComboBox)
            {
                final AutoResizingComboBox cb = (AutoResizingComboBox) result;
                cb.setComponentPopupMenu(table.getComponentPopupMenu());
                // Tf:26/9/07:Removed this as it's not needed, providing we don't un-popup the drop list
                // in the arrayField when the editor activate mouse click gets re-posted to the editor
                // On a mouse click, we want to show the drop list.  CraigM 02/09/2007.
    //            cb.addMouseListener(new MouseAdapter() {
    //                @Override
    //                public void mousePressed(MouseEvent e) {
    //                    SwingUtilities.invokeLater(new Runnable() {
    //                        public void run() {
    //                            Integer state = (Integer)cb.getClientProperty("qq_state");
    //
    //                            if (state == Constants.FS_UPDATE) {
    //                                cb.setPopupVisible(true);
    //                            }
    //                        }
    //                    });
    //                }
    //            });

                Array_Of_ListElement<ListElement> elements = null;
                if (rowElements != null){
                    //PM:10/8/07
                    /*
                     * customize the element list per row, if there is
                     * no customisation for the row
                     * use the default
                     */
                    elements = rowElements.get(row);
                }
                if (elements == null){
                    //PM:17/7/07 add a DropListModel with the correct data
                    elements =((DropListModel)cb.getModel()).getElementList();
                }
                cb.setModel(new DropListModel(elements, cb));

                if (value instanceof DataValue && ((DataValue)value).isNull())
                    return result;

                for (int i = 0; i < cb.getModel().getSize(); i++)
                {
                    ListElement element = (ListElement) cb.getModel().getElementAt(i);
                    if (value instanceof Number || value instanceof IntegerData)
                    {
                        int num;
                        if (value instanceof Number)
                            num = ((Number)value).intValue();
                        else
                            num = ((IntegerData)value).intValue();

                        if (num == element.getIntegerValue())
                        {
                            cb.getModel().setSelectedItem(element);
                            return result;
                        }
                    }
                    else {
                        if (value != null) {
                            String aString = value.toString();
                            if (aString.equals(element.getTextValue().toString())) {
                                cb.getModel().setSelectedItem(element);
                                return result;
                            }
                        }
                    }
                }

                if (cb.getModel().getSize() > 0 && !cb.isEditable()) {
                    ListElement element = (ListElement)cb.getModel().getElementAt(0);

                    if (row >-1 && column > -1) {
                        // Convert the column to the column model index, incase they have removed some columns.  CraigM: 01/02/3008.
                        int modelIndex = table.getColumnModel().getColumn(column).getModelIndex();
                        table.getModel().setValueAt(this.getListElementValue(element),row, modelIndex);
                    }
                    cb.setSelectedIndex(0);
                } else if (value != null){
                    String aString = value.toString();
                    cb.getModel().setSelectedItem(aString);
                }
            }
            return result;
        }
        finally {
View Full Code Here

                tvSet = Integer.valueOf(defaultSet);
            }
            if (tvSet.intValue() < 1) {
                return;
            }
            AutoResizingComboBox rl = (AutoResizingComboBox) comp;
            for (int i = 0; i < rl.getItemCount(); i++) {
                ListElement le = (ListElement) rl.getItemAt(i);
                le.reloadLabelText(mcat, tvSet.intValue());
            }
            return;
        }
        // ScrollList
        if ((comp instanceof JList) && !(comp instanceof RadioList) && !(comp instanceof JListView)) {
            Integer tvSet = (Integer) comp.getClientProperty("qq_TextValueSet");
            if ((tvSet == null) || (tvSet.intValue() < 1)) {
                tvSet = Integer.valueOf(defaultSet);
            }
            if (tvSet.intValue() < 1) {
                return;
            }
            JList rl = (JList) comp;
            for (int i = 0; i < rl.getModel().getSize(); i++) {
                ListElement le = (ListElement) rl.getModel().getElementAt(i);
                le.reloadLabelText(mcat, tvSet.intValue());
            }
            return;
        }

            if (msgSet > 0 && msgNumber > 0) {
                if (comp instanceof JLabel) {
                    JLabel jl = (JLabel) comp;
                    jl.setText(mcat.getString(msgSet, msgNumber, jl.getText()));
                    labelWidth(jl);
                    return;
                }
                else if (comp instanceof JButton) {
                    JButton jb = (JButton) comp;
                    jb.setText(mcat.getString(msgSet, msgNumber, jb.getText()));
                    processMnemonic(jb);
                    packButton(jb);
                    return;
                }
                else if (comp instanceof JTabbedPane) {
                    JTabbedPane jtp = (JTabbedPane) comp;
                    for (int i = 0; i < jtp.getComponentCount(); i++) {
                        if (jtp.getComponentAt(i) instanceof JPanel) {
                            JPanel kid = (JPanel) jtp.getComponentAt(i);
                            int s = UIutils.getMsgSet(kid);
                            int n = UIutils.getMsgNumber(kid);
                            jtp.setTitleAt(i, mcat.getString(s, n, jtp.getTitleAt(i)));
                        }
                    }

                }
                else if (comp instanceof GridField) {
                    GridField gf = (GridField) comp;
                    TextData cap = gf.getCaption();
                    if (cap != null) {
                        gf.setCaption(new TextData(mcat.getString(msgSet, msgNumber, gf.getCaption().asString())));
                    }
                    else {
                        gf.setCaption(new TextData(mcat.getString(msgSet, msgNumber)));
                    }

                }
                else if (comp instanceof JPanel) {
                    JPanel gf = (JPanel) comp;
                    String cap = getCaption(gf);
                    if (cap != null) {
                      // TF:Mar 11, 2010:Changed this to use Caption.set instead of setCaption
//                        setCaption(gf, mcat.getString(msgSet, msgNumber, getCaption(gf)));
                        Caption.set(gf, mcat.getString(msgSet, msgNumber, getCaption(gf)));
                    }
                    else {
                      // TF:Mar 11, 2010:Changed this to use Caption.set instead of setCaption
//                      setCaption(gf, mcat.getString(msgSet, msgNumber));
                        Caption.set(gf, mcat.getString(msgSet, msgNumber));
                    }
                    if ((gf.getParent() != null) && (gf.getParent() instanceof JTabbedPane)) {
                        JTabbedPane jt = (JTabbedPane) comp.getParent();
                        int index = jt.indexOfComponent(comp);
                        if (index != -1) {
                            jt.setTitleAt(index, mcat.getString(msgSet, msgNumber, jt.getTitleAt(index)));
                        }
                    }

                }
                else if (comp instanceof JCheckBox) {
                    JCheckBox jtb = (JCheckBox) comp;
                    jtb.setText(mcat.getString(msgSet, msgNumber, jtb.getText()));
                    packCheck(jtb);
                }
                else {
                    _log.debug("UIutils.reloadLabelText() is not implemented for " + comp.getClass().getName());
                }
            }
              if (comp instanceof RadioList) {
                  Integer tvSet = (Integer) comp.getClientProperty("qq_TextValueSet");
                  if ((tvSet == null) || (tvSet.intValue() < 1)) {
                      tvSet = Integer.valueOf(defaultSet);
                  }
                  if (tvSet.intValue() < 1) {
                      return;
                  }
                  RadioList rl = (RadioList) comp;
                  if (msgNumber > 0) {
                    rl.setCaption(mcat.getString(msgSet, msgNumber, TextData.valueOf(rl.getCaption())));
                  }
                  for (ListElement le : rl.getElementList()) {
                      le.reloadLabelText(mcat, tvSet.intValue());
                  }
//                  rl.update();
                  return;
              }
View Full Code Here

        }
        /*
         * DropList and FillInFields
         */
        else if (comp instanceof AutoResizingComboBox) {
          AutoResizingComboBox acr = (AutoResizingComboBox)comp;
          Object oldValue = acr.getPreviousValue();
          s.push(new DropFillinFocus(acr, oldValue));
        }
        oldComp = comp;
        Container c = (Container)comp.getParent();
        if (c instanceof JComponent) {
View Full Code Here

            }
            Component result = super.getTableCellEditorComponent(table, value, isSelected, row, column);
         // AD:26/6/2008 Change JComboBox to AutoResizingComboBox to reduce casting later
            if (result instanceof AutoResizingComboBox)
            {
                final AutoResizingComboBox cb = (AutoResizingComboBox) result;
                cb.setComponentPopupMenu(table.getComponentPopupMenu());
                // Tf:26/9/07:Removed this as it's not needed, providing we don't un-popup the drop list
                // in the arrayField when the editor activate mouse click gets re-posted to the editor
                // On a mouse click, we want to show the drop list.  CraigM 02/09/2007.
    //            cb.addMouseListener(new MouseAdapter() {
    //                @Override
    //                public void mousePressed(MouseEvent e) {
    //                    SwingUtilities.invokeLater(new Runnable() {
    //                        public void run() {
    //                            Integer state = (Integer)cb.getClientProperty("qq_state");
    //
    //                            if (state == Constants.FS_UPDATE) {
    //                                cb.setPopupVisible(true);
    //                            }
    //                        }
    //                    });
    //                }
    //            });

                Array_Of_ListElement<ListElement> elements = null;
                if (rowElements != null){
                    //PM:10/8/07
                    /*
                     * customize the element list per row, if there is
                     * no customisation for the row
                     * use the default
                     */
                    elements = rowElements.get(row);
                }
                if (elements == null){
                    //PM:17/7/07 add a DropListModel with the correct data
                    elements =((DropListModel)cb.getModel()).getElementList();
                }
                cb.setModel(new DropListModel(elements, cb));

                if (value instanceof DataValue && ((DataValue)value).isNull())
                    return result;

                for (int i = 0; i < cb.getModel().getSize(); i++)
                {
                    ListElement element = (ListElement) cb.getModel().getElementAt(i);
                    if (value instanceof Number || value instanceof IntegerData)
                    {
                        int num;
                        if (value instanceof Number)
                            num = ((Number)value).intValue();
                        else
                            num = ((IntegerData)value).intValue();

                        if (num == element.getIntegerValue())
                        {
                            cb.getModel().setSelectedItem(element);
                            return result;
                        }
                    }
                    else {
                        if (value != null) {
                            String aString = value.toString();
                            if (aString.equals(element.getTextValue().toString())) {
                                cb.getModel().setSelectedItem(element);
                                return result;
                            }
                        }
                    }
                }

                if (cb.getModel().getSize() > 0 && !cb.isEditable()) {
                    ListElement element = (ListElement)cb.getModel().getElementAt(0);

                    if (row >-1 && column > -1) {
                        // Convert the column to the column model index, incase they have removed some columns.  CraigM: 01/02/3008.
                        int modelIndex = table.getColumnModel().getColumn(column).getModelIndex();
                        table.getModel().setValueAt(this.getListElementValue(element),row, modelIndex);
                    }
                    cb.setSelectedIndex(0);
                } else if (value != null){
                    String aString = value.toString();
                    cb.getModel().setSelectedItem(aString);
                }
            }
            return result;
        }
        finally {
View Full Code Here

     * appropriate element will be displayed, or an empty combobox. Otherwise the passed
     * value will be displayed within the combobox.
     */
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
    {
        AutoResizingComboBox aComboBox = null;
        try {
            aComboBox = (AutoResizingComboBox)this.comboBox.getClass().newInstance();  
        }
        catch (InstantiationException e) {
            aComboBox = new AutoResizingComboBox();
        }
        catch (IllegalAccessException e) {
            aComboBox = new AutoResizingComboBox();
        }
        ArrayFieldCellHelper.setUpCellRenderer(this.comboBox, aComboBox); // CraigM: 28/03/2008
       
        // TF:12/11/07:Added the sizing in of a combo box.
        aComboBox.setSize(this.comboBox.getWidth(), this.comboBox.getHeight());

        if (GridCell.get(this.comboBox).getWidthPolicy() == Constants.SP_EXPLICIT) {
          aComboBox.setPreferredSize(new Dimension(this.comboBox.getWidth(), this.comboBox.getHeight()));
        }
        // CraigM:06/11/2008 - If sized natural, size to minimum (this is calculated based on the contents of the list)
        else if (GridCell.get(this.comboBox).getWidthPolicy() == Constants.SP_NATURAL) {
          aComboBox.setPreferredSize(this.comboBox.getMinimumSize());
        }
        else {
          aComboBox.setPreferredSize(this.comboBox.getPreferredSize());
        }
        aComboBox.setMinimumSize(aComboBox.getPreferredSize());
        aComboBox.setName(table.getName() + "." + row + "." + col);
        Array_Of_ListElement<ListElement> elements = null;
        if (rowElements != null){
            //PM:10/8/07
            /*
             * customize the element list per row, if there is
             * no customisation for the row
             * use the default
             */
            elements = (Array_Of_ListElement<ListElement>)rowElements.get(row);
        }
        if (elements == null){
            //PM:17/7/07 add a DropListModel with the correct data
            elements =((DropListModel)this.comboBox.getModel()).getElementList();
        }
        aComboBox.setModel(new DropListModel(elements, aComboBox));
        // TF:17/07/07: Added check to ensure it's editable
        aComboBox.setEditable(this.comboBox.isEditable());
        if (isSelected)
        {
            aComboBox.setForeground(table.getSelectionForeground());
            aComboBox.setBackground(table.getSelectionBackground());
        }
        else
        {
          // TF:19/01/2010:DET-140:We want the background colour to be the colour of the template.
//            aComboBox.setForeground(this.defaultforeground);
//            aComboBox.setBackground(this.defaultBackground);
            aComboBox.setForeground(this.comboBox.getForeground());
            aComboBox.setBackground(this.comboBox.getBackground());
        }

        if (value != null)
        {
            if (value instanceof Number || value instanceof IntegerData)
            {
                // Scan through the list to find a match for this number
                int num;
                if (value instanceof Number) {
                    num = ((Number)value).intValue();
                }
                else {
                    IntegerData anInt = (IntegerData)value;
                    if (anInt.isNull()) {
                        return aComboBox;
                    }
                    else {
                        num = anInt.intValue();
                    }
                }
                aComboBox.setSelectedItem(null);
                int limit = aComboBox.getModel().getSize();             // KM changed this.comboBox to aComboBox
                for (int i = 0; i < limit; i++) {
                    Object o = aComboBox.getModel().getElementAt(i);    // KM changed this.comboBox to aComboBox
                    if (o instanceof ListElement) {
                        if (((ListElement)o).getIntegerValue() == num)
                        {
                            //PM:9/8/07 selecting the correct value
                            aComboBox.setSelectedIndex(i);
                            return aComboBox;
                        }
                    }
                }
                // TF:04/09/2009:Changed this to be aComboBox. See JIRA DET-114
                if (aComboBox.getModel().getSize() > 0
                {
                    //PM:17/7/07 added test to cater for FillInField
                    //Do not select the value if the item does not exist
                    if (!aComboBox.isEditable()){
                        // aComboBox.addItem(comboBox.getModel().getElementAt(0));
                        aComboBox.setSelectedIndex(0);  
                    } else {
                        aComboBox.getEditor().setItem(value);
                    }
                }
            }
            //PM:17/8/07 handle text correctly
            else if (value instanceof String || value instanceof TextData){
                aComboBox.setSelectedItem(null);
                int limit = aComboBox.getModel().getSize();                 // KM changed this.comboBox to aComboBox
                for (int i = 0; i < limit; i++) {
                    Object o = aComboBox.getModel().getElementAt(i);        // KM changed this.comboBox to aComboBox
                    if (o instanceof ListElement) {
                        if (((ListElement)o).getTextValue().toString().equalsIgnoreCase(value.toString()))
                        {
                            aComboBox.setSelectedIndex(i);
                            return aComboBox;
                        }
                    }
                }
                // TF:04/09/2009:Changed this to be aComboBox. See JIRA DET-114
                if (aComboBox.getModel().getSize() > 0
                {
                    if (!aComboBox.isEditable()){
                        aComboBox.setSelectedIndex(0);  
                    } else {
                        aComboBox.getEditor().setItem(value);
                    }
                }
            }
            else
            {
                //PM:17/7/07 added test to cater for FillInField
                //Do not select the value if the item does not exist
                if (!aComboBox.isEditable()){
                    //TF:17/07/07 We cannot add a value easily, just assume it's in the list
                    // aComboBox.addItem(value);
                    aComboBox.setSelectedItem(value);  
                } else {
                    aComboBox.getEditor().setItem(value);
                }
            }
        }

        return aComboBox;
View Full Code Here

                tvSet = Integer.valueOf(defaultSet);
            }
            if (tvSet.intValue() < 1) {
                return;
            }
            AutoResizingComboBox rl = (AutoResizingComboBox) comp;
            for (int i = 0; i < rl.getItemCount(); i++) {
                ListElement le = (ListElement) rl.getItemAt(i);
                le.reloadLabelText(mcat, tvSet.intValue());
            }
            return;
        }
        // ScrollList
        if ((comp instanceof JList) && !(comp instanceof RadioList) && !(comp instanceof JListView)) {
            Integer tvSet = (Integer) comp.getClientProperty("qq_TextValueSet");
            if ((tvSet == null) || (tvSet.intValue() < 1)) {
                tvSet = Integer.valueOf(defaultSet);
            }
            if (tvSet.intValue() < 1) {
                return;
            }
            JList rl = (JList) comp;
            for (int i = 0; i < rl.getModel().getSize(); i++) {
                ListElement le = (ListElement) rl.getModel().getElementAt(i);
                le.reloadLabelText(mcat, tvSet.intValue());
            }
            return;
        }

            if (msgSet > 0 && msgNumber > 0) {
                if (comp instanceof JLabel) {
                    JLabel jl = (JLabel) comp;
                    jl.setText(mcat.getString(msgSet, msgNumber, jl.getText()));
                    labelWidth(jl);
                    return;
                }
                else if (comp instanceof JButton) {
                    JButton jb = (JButton) comp;
                    jb.setText(mcat.getString(msgSet, msgNumber, jb.getText()));
                    processMnemonic(jb);
                    packButton(jb);
                    return;
                }
                else if (comp instanceof JTabbedPane) {
                    JTabbedPane jtp = (JTabbedPane) comp;
                    for (int i = 0; i < jtp.getComponentCount(); i++) {
                        if (jtp.getComponentAt(i) instanceof JPanel) {
                            JPanel kid = (JPanel) jtp.getComponentAt(i);
                            int s = UIutils.getMsgSet(kid);
                            int n = UIutils.getMsgNumber(kid);
                            jtp.setTitleAt(i, mcat.getString(s, n, jtp.getTitleAt(i)));
                        }
                    }

                }
                else if (comp instanceof GridField) {
                    GridField gf = (GridField) comp;
                    TextData cap = gf.getCaption();
                    if (cap != null) {
                        gf.setCaption(new TextData(mcat.getString(msgSet, msgNumber, gf.getCaption().asString())));
                    }
                    else {
                        gf.setCaption(new TextData(mcat.getString(msgSet, msgNumber)));
                    }

                }
                else if (comp instanceof JPanel) {
                    JPanel gf = (JPanel) comp;
                    String cap = getCaption(gf);
                    if (cap != null) {
                      // TF:Mar 11, 2010:Changed this to use Caption.set instead of setCaption
//                        setCaption(gf, mcat.getString(msgSet, msgNumber, getCaption(gf)));
                        Caption.set(gf, mcat.getString(msgSet, msgNumber, getCaption(gf)));
                    }
                    else {
                      // TF:Mar 11, 2010:Changed this to use Caption.set instead of setCaption
//                      setCaption(gf, mcat.getString(msgSet, msgNumber));
                        Caption.set(gf, mcat.getString(msgSet, msgNumber));
                    }
                    if ((gf.getParent() != null) && (gf.getParent() instanceof JTabbedPane)) {
                        JTabbedPane jt = (JTabbedPane) comp.getParent();
                        int index = jt.indexOfComponent(comp);
                        if (index != -1) {
                            jt.setTitleAt(index, mcat.getString(msgSet, msgNumber, jt.getTitleAt(index)));
                        }
                    }

                }
                else if (comp instanceof JCheckBox) {
                    JCheckBox jtb = (JCheckBox) comp;
                    jtb.setText(mcat.getString(msgSet, msgNumber, jtb.getText()));
                    packCheck(jtb);
                }
                else {
                    _log.debug("UIutils.reloadLabelText() is not implemented for " + comp.getClass().getName());
                }
            }
              if (comp instanceof RadioList) {
                  Integer tvSet = (Integer) comp.getClientProperty("qq_TextValueSet");
                  if ((tvSet == null) || (tvSet.intValue() < 1)) {
                      tvSet = Integer.valueOf(defaultSet);
                  }
                  if (tvSet.intValue() < 1) {
                      return;
                  }
                  RadioList rl = (RadioList) comp;
                  if (msgNumber > 0) {
                    rl.setCaption(mcat.getString(msgSet, msgNumber, TextData.valueOf(rl.getCaption())));
                  }
                  for (ListElement le : rl.getElementList()) {
                      le.reloadLabelText(mcat, tvSet.intValue());
                  }
//                  rl.update();
                  return;
              }
View Full Code Here

        postEvent((JComponent)e.getSource());
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() instanceof AutoResizingComboBox) {
            AutoResizingComboBox cb = (AutoResizingComboBox)e.getSource();
            DropListModel model = (DropListModel)cb.getModel();

            if (model.isAdjusting() || !cb.isEnabled()) {
                return;
            }
            // TF:28/3/07: Editable comboboxes will post an afterValueChange event when they lose the
            // focus, because their value is not necessarily equal to their selected value. However,
            // in this case we'll have a data field that will post the AfterValueChange event for us.184157
View Full Code Here

TOP

Related Classes of DisplayProject.controls.AutoResizingComboBox$ComboBoxResizer

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.