Get the menu icon.
@param record The menu record.
@return The icon filename for this menu item.
422770
public String getMenuIcon(FieldList record)
    {
        FieldInfo field = record.getField("IconResource");
        String strIcon = null;
        if (field != null)
        {
            strIcon = field.toString();
            if ((strIcon != null) && (strIcon.length() > 0))
                return strIcon;
        }
        field = record.getField("Type");
        if ((field != null) && (!field.isNull()))
        {
            strIcon = field.toString();
            if ((strIcon != null) && (strIcon.length() > 0))
            {
                strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
                return strIcon;
            }
        }
        return Constants.BLANK;
    }
1209510
@Override
    public Image getIcon(int iconType) {
        Pair<String, Image> pair = iconInformation.get(iconType);
        String imagePath = pair.first;
        Image imageOrNull = pair.second;
        if ((imageOrNull == null) && (imagePath != null)) {
            imageOrNull = loadImage(imagePath);
        }
        return imageOrNull;
    }
819775
@Override
	protected Icon getIcon(JTable table, int column) {
		SortKey sortKey = getSortKey(table, column);
		if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) {
			SortOrder sortOrder = sortKey.getSortOrder();
			switch (sortOrder) {
			case ASCENDING:
				return VerticalSortIcon.ASCENDING;
			case DESCENDING:
				return VerticalSortIcon.DESCENDING;
			case UNSORTED:
				return VerticalSortIcon.ASCENDING;
			}
		}
		return null;
	}
729103
public Record getScreenRecord()
    {
        Record record = m_vRecordList.getScreenRecord();
        if (record == null)
            record = super.getScreenRecord(); // Look thru the parent window now
        return record;
    }
555260
public String getHtmlString(Record recMenu)
    {
        String strCellFormat = null;
        if ((strCellFormat == null) || (strCellFormat.length() == 0))
        {
            ResourceBundle reg = ((BaseApplication)((BaseMenuScreen)this.getScreenField()).getTask().getApplication()).getResources(HtmlConstants.HTML_RESOURCE, false);
            strCellFormat = reg.getString("htmlAppMenu");
        }
        if ((strCellFormat == null) || (strCellFormat.length() == 0))
            strCellFormat = "<items columns=\"5\"><td align=center valign=\"top\"><a href=\""
                + HtmlConstants.LINK_TAG + "\"><img src=\"" + HtmlConstants.HTML_ROOT + HtmlConstants.ICON_TAG
                + "\" width=\"24\" height=\"24\"><br/>" + HtmlConstants.TITLE_TAG + "</a></td></items>";
        return strCellFormat;
    }
994723
public static Icon getImageIcon(UrlProvider urlProvider, String fileName) throws UrlProviderException
	{
		URL _icon = urlProvider.getUrl(fileName);
		return new ImageIcon(_icon);
	}
402216
public static String createXMLStringRecord(Record record)
    {
        String string = DBConstants.BLANK;

        DocumentBuilder db = Utility.getDocumentBuilder();
        DocumentBuilder stringdb = Utility.getDocumentBuilder();
        Document doc = null;
        synchronized (db)
        {
            doc = db.newDocument();

            Element elRoot = (Element)doc.createElement(ROOT_TAG);
            doc.appendChild(elRoot);
            try   {
                XmlInOut.enableAllBehaviors(record, false, true); // Disable file behaviors
    
                createXMLRecord(stringdb, record, doc, elRoot);
    
                elRoot.appendChild(doc.createTextNode(XmlUtilities.NEWLINE));
            } catch (DBException ex)    {
                ex.printStackTrace();
                return DBConstants.BLANK;
            }
        }
        try   {
            StringWriter out = new StringWriter();  //, MIME2Java.convert("UTF-8"));

            // Use a Transformer for output
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(out);
            transformer.transform(source, result);
            out.close();
            string = out.toString();

            int iStartString = string.indexOf("<" + ROOT_TAG + ">") + 3 + ROOT_TAG.length();
            int iEndString = string.indexOf("</" + ROOT_TAG + ">");
            if (iStartString >= iEndString)
                string = DBConstants.BLANK;
            else
                string = string.substring(iStartString, iEndString);
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser
            tce.printStackTrace();
        } catch (TransformerException te) {
            // Error generated by the parser
            te.printStackTrace();
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        XmlInOut.enableAllBehaviors(record, true, true);
        return string;
    }
1294005
public String getSubMenuXML()
    {
        StringBuffer sbMenuArea = new StringBuffer();
        
        if (this.getEditMode() == Constants.EDIT_CURRENT)
        {
            if (this.getField(Menus.ICON_RESOURCE).isNull())
            {
                String strIcon = this.getField(Menus.TYPE).toString();
                if (strIcon.length() > 0)
                    strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
                this.getField(Menus.ICON_RESOURCE).setString(strIcon);
            }
            sbMenuArea.append(XmlUtilities.createXMLStringRecord(this));
            sbMenuArea = this.addLinkTag(sbMenuArea);
        }
        
        if (sbMenuArea.length() == 0)
            sbMenuArea.append(
                    Utility.startTag(this.getTableNames(false)) +
                    " <Name>Name</Name>" +
                    " <Description>Description</Description>" +
                    " <Program>Program</Program>" +
                    " <Params>Params</Params>" +
                    " <IconResource>IconResource</IconResource>" +
                    " <Keywords>Keywords</Keywords>" +
                    " <Html>Html</Html>" +
                    Utility.endTag(this.getTableNames(false)));
        
        StringBuffer sbContentArea = new StringBuffer();
        sbContentArea.append(Utility.startTag(XMLTags.MENU_LIST));
        try   {
            String strMenu = this.getField(Menus.ID).toString();
            this.setKeyArea(Menus.PARENT_FOLDER_ID_KEY);
            FileListener behavior = new StringSubFileFilter(strMenu, this.getField(Menus.PARENT_FOLDER_ID), null, null, null, null);
            this.addListener(behavior);
            this.close();
            while (this.hasNext())
            {
                this.next();
                if (this.getField(Menus.ICON_RESOURCE).isNull())
                {
                    String strIcon = this.getField(Menus.TYPE).toString();
                    if (strIcon.length() > 0)
                        strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
                    this.getField(Menus.ICON_RESOURCE).setString(strIcon);
                }
                StringBuffer sbMenuItem = new StringBuffer();
                sbMenuItem.append(XmlUtilities.createXMLStringRecord(this));
                sbMenuItem = this.addLinkTag(sbMenuItem);
                sbContentArea.append(sbMenuItem);
            }
            this.removeListener(behavior, true);
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        sbContentArea.append(Utility.endTag(XMLTags.MENU_LIST));
        sbMenuArea.insert(sbMenuArea.lastIndexOf(Utility.endTag(this.getTableNames(false))), sbContentArea);
        return sbMenuArea.toString();
    }
407231
public static String findIconUrl( AbstractApplication app ) {

		StringBuilder sb = new StringBuilder();
		File iconFile = findIcon( app );
		if( iconFile != null ) {
			sb.append( "/" );
			sb.append( app.getName());

			if( app instanceof ApplicationTemplate ) {
				sb.append( "/" );
				sb.append(((ApplicationTemplate) app).getVersion());
			}

			sb.append( "/" );
			sb.append( iconFile.getName());
		}

		return sb.toString();
	}
908583
public String getMenuLink(FieldList record)
    {
        FieldInfo field = record.getField("Type");
        if ((field != null) && (!field.isNull()))
        {
            String strType = field.toString();
            String strParams = record.getField("Params").toString();
            if (strParams == null)
                strParams = Constants.BLANK;
            else if (strParams.length() > 0)
                strParams = '&' + strParams;
            if ((strType != null) && (strType.length() > 0))
            {
                String strProgram = record.getField("Program").toString();
                if (strType.equalsIgnoreCase(Params.MENU))
                {
                    field = record.getField("ID");
                    String strID = field.toString();
                    return '?' + strType + '=' + strID + strParams;
                }
                else if (strType.equalsIgnoreCase("applet"))
                {
                    return '?' + strType + '=' + strProgram + strParams;
                }
                else if (strType.equalsIgnoreCase("link"))
                {
                    strParams = strProgram;
                    if (((strParams.indexOf('.') < strParams.indexOf('/'))
                        && (strParams.indexOf('.') != -1))
                        || ((strParams.indexOf('/') == -1) && (strParams.indexOf(':') == -1)))
                            strParams = "http://" + strParams; // Default command = html link
                    return strParams;
                }
            }
        }
        return this.getMenuName(record);            // Command = name
    }
581903
public Record openMainRecord()
    {
        String strClassName = this.getProperty(MenuConstants.RECORD);
        Record record = Record.makeRecordFromClassName(strClassName, this);
        return record;
    }
1175854
public Record getMainRecord()
    {
        Record record = null;
        if (this.size() > 0)
        {
            record = (Record)this.firstElement();
            if (record != null) if (record == this.getScreenRecord())
            {
                record = null;
                if (this.size() >= 2)
                    record = (Record)this.elementAt(1);
            }
        }
        return record;
    }
680447
@Override
	public String getLabel() {
		ResourceStore rs;
		ResourceRef rr;
		synchronized(lock) {
			rs = this.resourceStore;
			rr = this.resourceRef;
		}
		if(rr != null) {
			String path = rr.getPath().toString();
			boolean isDirectory = path.endsWith(Path.SEPARATOR_STRING);
			int slashBefore;
			if(isDirectory) {
				slashBefore = path.lastIndexOf(Path.SEPARATOR_CHAR, path.length() - 2);
			} else {
				slashBefore = path.lastIndexOf(Path.SEPARATOR_CHAR);
			}
			String filename = path.substring(slashBefore + 1);
			if(filename.isEmpty()) throw new IllegalArgumentException("Invalid filename for file: " + path);
			if(!isDirectory) {
				if(rs != null) {
					try {
						try (ResourceConnection conn = rs.getResource(rr.getPath()).open()) {
							if(conn.exists()) {
								return
									filename
									+ " ("
									+ StringUtility.getApproximateSize(conn.getLength())
									+ ')'
								;
							}
						}
					} catch(FileNotFoundException e) {
						// Resource removed between calls to exists() and getLength()
						// fall-through to return filename
					} catch(IOException e) {
						throw new WrappedException(e);
					}
				}
			}
			return filename;
		}
		throw new IllegalStateException("Path not set");
	}
198586
public Object getValue(final Object record) {
        Objects.requireNonNull(record);
        
        if(!getDeclaredClass().equals(record.getClass())) {
            throw new IllegalArgumentException(String.format("not match record class type. expected=%s. actual=%s, ",
                    type.getName(), record.getClass().getName()));
        }
        
        try {
            return field.get(record);
        } catch (IllegalArgumentException | IllegalAccessException e) {
            throw new SuperCsvReflectionException("fail get field value.", e);
        }
        
    }
131289
public List evaluate(Record record) {
    // fast path (not functionally necessary):
    if (fields.size() == 1) {
      Object first = fields.get(0);
      if (first instanceof String) {
        return Collections.singletonList(first);
      } else {
        String ref = ((Field) first).getName();
        if (ref.length() != 0) {
          List resolvedValues = record.get(ref);
          return resolvedValues;
        }
      }
    }

    // slow path:
    ArrayList<Object> results = new ArrayList<Object>(1);
    evaluate2(0, record, new StringBuilder(), results);
    return results;
  }
808041
public int handleGetRawRecordData(Rec record)
    {
        int iErrorCode = Constant.NORMAL_RETURN;
        record = this.setNodeIndex(RESET_INDEX, record);   // Being careful
        int iNodeCount = 1;
        if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            iNodeCount = this.getMessage().getNodeCount(this.getFullKey(null));
        for (int index = 1; index <= iNodeCount; index++)
        {
            if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
                record = this.setNodeIndex(index, record);
            
            iErrorCode = super.handleGetRawRecordData(record);
            
            if (iErrorCode != Constant.NORMAL_RETURN)
                break;
        }
        if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            this.setNodeIndex(END_OF_NODES, record);
        return iErrorCode;
    }
645823
protected void gotoEOR(ArchiveRecord record) throws IOException {
        if (getIn().available() <= 0) {
            return;
        }
        
        // Remove any trailing LINE_SEPARATOR
        int c = -1;
        while (getIn().available() > 0) {
            if (getIn().markSupported()) {
                getIn().mark(1);
            }
            c = getIn().read();
            if (c != -1) {
                if (c == LINE_SEPARATOR) {
                    continue;
                }
                if (getIn().markSupported()) {
                    // We've overread.  We're probably in next record.  There is
                    // no way of telling for sure. It may be dross at end of
                    // current record. Backup.
                        getIn().reset();
                    break;
                }
                ArchiveRecordHeader h = (getCurrentRecord() != null)?
                    record.getHeader(): null;
                throw new IOException("Read " + (char)c +
                    " when only " + LINE_SEPARATOR + " expected. " + 
                    getReaderIdentifier() + ((h != null)?
                        h.getHeaderFields().toString(): ""));
            }
        }
    }