Package net.helipilot50.stocktrade.framework

Examples of net.helipilot50.stocktrade.framework.TextData$qq_Resolver


            }
            else if (valueType.equals(String.class)) {
              return value.toString();
            }
            else if (TextData.class.isAssignableFrom(valueType)) {
              TextData result;
              try {
                result = (TextData)valueType.newInstance();
                result.setValue(value.toString());
              }
              catch (InstantiationException e) {
                result = new TextData(value.toString());
              }
              catch (IllegalAccessException e) {
                result = new TextData(value.toString());
              }
              return result;
            }
           
            // CraigM:07/10/2008 - Handle conversion from something to an int (won't be an number to an int, as that is handled in the first if condition).  JIRA: JCT-605.
            else if (valueType == Integer.TYPE) {
              try {
                return Integer.parseInt(value.toString());
              }
              catch (NumberFormatException e) {
                return 0; // Just return 0 if it is not possible to convert (Forte would do this)
              }
            }

            // CraigM:02/12/2008 - Handle BooleanData and sub classes of BooleanData
            else if (BooleanData.class.isAssignableFrom(valueType)) {
              if (value instanceof Boolean) {
                BooleanData result;
          try {
            result = (BooleanData)valueType.newInstance();
                  result.setBooleanValue((Boolean)value);
          } catch (InstantiationException e) {
            result = new BooleanData((Boolean)value);
          } catch (IllegalAccessException e) {
            result = new BooleanData((Boolean)value);
          }
View Full Code Here


            try {
                if (pObjectDataType == Constants.SD_IMAGE && contents.isDataFlavorSupported(DataFlavor.imageFlavor)) {
                    result = new ImageData((Image)contents.getTransferData(DataFlavor.imageFlavor));
                }
                else if (pObjectDataType == Constants.SD_TEXT && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                    result = new TextData((String)contents.getTransferData(DataFlavor.stringFlavor));
                }
            }
            catch (IOException ex) {}
            catch (UnsupportedFlavorException ex) {}
        }
View Full Code Here

    {
//        System.out.println("setValue(" + newValue + ") subjectType [" + subjectType.getName() + "]");
        if (newValue instanceof String) {
            // This can be the case in an editable droplist, in which case it can only be mapped to a string or TextData
            if (TextData.class.isAssignableFrom(subjectType)) {
                TextData newObject;
                try {
                    // Map the string back to the underlying type for proper mapping
                    newObject = (TextData) subjectType.newInstance();
                    newObject.setValue((String)newValue);
                    subject.setValue(newObject);
                } catch (Exception e) {
                    throw new UsageException("Could not instantiate an instance of " + subjectType.getName(), e);
                }
            }
            else if (String.class.equals(subjectType)) {
                subject.setValue(newValue.toString());
            }
        }
        else if (newValue instanceof ListElement) {
            ListElement element = (ListElement) newValue;

            if (Integer.class.equals(subjectType) || Integer.TYPE.equals(subjectType)) {
                subject.setValue(new Integer(element.getIntegerValue()));
            }
            else if (IntegerData.class.equals(subjectType)) {
                subject.setValue(new IntegerData(element.getIntegerValue()));
            }
            else if (IntegerNullable.class.equals(subjectType)) {
                subject.setValue(new IntegerNullable(element.getIntegerValue()));
            }
            else if (IntegerData.class.isAssignableFrom(subjectType)) {
                try {
                    IntegerData anIntData = (IntegerData)subjectType.newInstance();
                    anIntData.setValue(element.getIntegerValue());
                    subject.setValue(anIntData);
                }
                catch (Exception e) {
                    // No default constructor
                    _log.debug("Could not instantiate class " + subjectType.getName(), e);
                }
            }
            else if (TextData.class.equals(subjectType)) {
                // TF:27/8/07:We need to clone the return value, otherwise we'll be returning the actual textdata mapped to the listelement
                // and any changes on this list element will erroneously affect the underlying list
                subject.setValue(CloneHelper.clone(element.getTextValue(), false));
            }
            else if (TextNullable.class.equals(subjectType)) {
        subject.setValue(new TextNullable(element.getTextValue()));
      }
            else if (TextData.class.isAssignableFrom(subjectType)) {
                try {
                    TextData aTextData = (TextData)subjectType.newInstance();
                    aTextData.setValue(element.getTextValue());
                    subject.setValue(aTextData);
                }
                catch (Exception e) {
                    // No default constructor
                    _log.debug("Could not instantiate class " + subjectType.getName(), e);
View Full Code Here

    JFrame root = (JFrame)((JPanel)e.getSource()).getTopLevelAncestor();
    JComponent comp = (JComponent)root.getFocusOwner();

    while (comp != null) {
      TextData topic = (TextData)comp.getClientProperty("HelpTopic");
      if ((topic != null) && (topic.isNotEqual("").getValue())) {
        topicDetails = topic.toString();
        break;
      }

      Object parent = comp.getParent();
      if (!parent.equals(root)) {
View Full Code Here

        ListElement tempStockName = null;

        if (pOwnHoldingList != null) {
            for (Holding row : pOwnHoldingList) {
                tempStockName = new ListElement();
                tempStockName.setTextValue(new TextData(row.getStockName()));
                custStockList.add(tempStockName);
            }
        }

        return custStockList;
View Full Code Here

        }
    }

    public static String dataValueToString(DataValue value)
    {
        TextData buffer = new TextData();
        value.fillString(buffer);
        return buffer.toString();
    }
View Full Code Here

    private int getCaptionWidth(Container parent) {
        // calculate caption width if one exists
        int captionWidth = 0;
        if (parent instanceof Panel){
            Panel parentPanel = (Panel)parent;
            TextData tdCaption = parentPanel.getCaption();
            String caption = (tdCaption == null) ? "": tdCaption.toString();
            if ("".equals(caption)) {
                captionWidth = 0;
            }
            else {
                Font font = null;
View Full Code Here

    public static void set(DataField field, TextData format){
            ActionMgr.addAction(new CharacterTemplate(field, format));
    }
    public static void set(DataField field, String format){
            ActionMgr.addAction(new CharacterTemplate(field, new TextData(format)));
    }
View Full Code Here

    }
    public static void set(DataField field, String format){
            ActionMgr.addAction(new CharacterTemplate(field, new TextData(format)));
    }
    public static TextData get(DataField field){
        TextData value;
        CharacterTemplate action = ActionMgr.getAction(field, CharacterTemplate.class);
        if (action != null) {
            value = ((CharacterTemplate)action).format;
        } else {
            value = new TextData(field.getOriginalFormatText());
        }
        return value;
    }
View Full Code Here

public class NumericTemplate extends PendingAction {

    private TextData value;
    public NumericTemplate(DataField pComponent, String pValue) {
        super(pComponent);
        this.value = new TextData(pValue);
    }
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.framework.TextData$qq_Resolver

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.