⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 anchortagdesigner.java

📁 WAP ide 代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
   * @return SimpleAttributeSet set - the attributeset.   */  private SimpleAttributeSet processAttributes() {    String href = "";    String charset = "";    String method = "";    String extra = "";    String sendreferer = "";    String cache = "";    String enctype = "";    String s = PropertiesText.getText();    int start = s.indexOf("href");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          href = s.substring(start + 1, end);        }      }    }    start = s.indexOf("accept-charset");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          charset = s.substring(start + 1, end);        }      }    }    start = s.indexOf("method");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          method = s.substring(start + 1, end);        }      }    }    start = s.indexOf("sendreferer");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          sendreferer = s.substring(start + 1, end);        }      }    }    start = s.indexOf("cache-control");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          cache = s.substring(start + 1, end);        }      }    }    start = s.indexOf("enctype");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          enctype = s.substring(start + 1, end);        }      }    }    start = s.indexOf("id=\"");    if (start > -1) {      start = start + 4;      int end = s.indexOf("\"", start);      extra = extra + " " + s.substring(start - 4, end + 1);    }    start = s.indexOf("class=\"");    if (start > -1) {      start = start + 7;      int end = s.indexOf("\"", start);      extra = extra + " " + s.substring(start - 7, end + 1);    }    start = s.indexOf("xml:lang=\"");    if (start > -1) {      start = start + 10;      int end = s.indexOf("\"", start);      extra = extra + " " + s.substring(start - 10, end + 1);    }    SimpleAttributeSet attributes = new SimpleAttributeSet();    if (!(href.equals("")))      attributes.addAttribute("href", href);    if (!(charset.equals("")))      attributes.addAttribute("accept-charset", charset);    if (!(method.equals("")))      attributes.addAttribute("method", method);    if (!(sendreferer.equals("")))      attributes.addAttribute("sendreferer", sendreferer);    if (!(cache.equals("")))      attributes.addAttribute("cache-control", cache);    if (!(enctype.equals("")))      attributes.addAttribute("enctype", enctype);    if (!(extra.equals("")))      attributes.addAttribute("extra", extra);    return attributes;  }  /**   * Used to collate data from a list item into a SimpleAttributeSet for   * further processing.   * @param int num - the list item's index.   * @return SimpleAttribute set - the item's attributes.   */  private SimpleAttributeSet getListAttributes(int num) {    // num indicates which element to get from the list    String value = "";    String name = "";    String extra = "";    String s = (String) AdditionalActionList.getModel().getElementAt(num);    int start = s.indexOf("value");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          value = s.substring(start + 1, end);        }      }    }    start = s.indexOf("name");    if (start > -1) {      start = s.indexOf("=" , start + 1);      if (start > -1) {        start = s.indexOf("\"" , start + 1);        if (start > -1) {          int end = s.indexOf("\"" , start + 1);          if (end < 0)            end = s.length();          name = s.substring(start + 1, end);        }      }    }    start = s.indexOf("id=\"");    if (start > -1) {      start = start + 4;      int end = s.indexOf("\"", start);      extra = extra + " " + s.substring(start - 4, end + 1);    }    start = s.indexOf("class=\"");    if (start > -1) {      start = start + 7;      int end = s.indexOf("\"", start);      extra = extra + " " + s.substring(start - 7, end + 1);    }    start = s.indexOf("xml:lang=\"");    if (start > -1) {      start = start + 10;      int end = s.indexOf("\"", start);      extra = extra + " " + s.substring(start - 10, end + 1);    }    // get the tag type: postfield || setvar    String tagType = s.substring(s.indexOf("<") + 1, s.indexOf(" "));    tagType = tagType + new Integer(num).toString();    // setup the attributes and the final tag    SimpleAttributeSet attributes = new SimpleAttributeSet();    attributes.addAttribute("value", value);    attributes.addAttribute("name", name);    if (extra.length() > 0)      attributes.addAttribute("extra", extra);    SimpleAttributeSet tag = new SimpleAttributeSet();    tag.addAttribute(tagType, attributes);    return tag;  }  /**   * Used to initialize the dialog with specific data.   * @param SimpleAttributeSet set - the data to initialize the dialog with.   */  public void setData(SimpleAttributeSet set) {    if (!((SimpleAttributeSet) set.getAttribute("go") == null)) {      GoToggleButton.doClick();      SimpleAttributeSet control = (SimpleAttributeSet) set.getAttribute("go");      String href = (String) control.getAttribute("href");      String charset = (String) control.getAttribute("accept-charset");      String method = (String) control.getAttribute("method");      String sendreferer = (String) control.getAttribute("sendreferer");      String cache = (String) control.getAttribute("cache-control");      String enctype = (String) control.getAttribute("enctype");      String extra = (String) control.getAttribute("extra");      String text;      if (!(href == null))        text = "href=\"" + href + "\"";      else        text = "href=\"\"";      if (!(charset == null))        text = text + " " + "accept-charset=\"" + charset + "\"";      if (!(method == null))        text = text + " " + "method=\"" + method + "\"";      if (!(sendreferer == null))        text = text + " " + "sendreferer=\"" + sendreferer + "\"";      if (!(cache == null))        text = text + " " + "cache-control=\"" + cache + "\"";      if (!(enctype == null))        text = text + " " + "enctype=\"" + enctype + "\"";      if (!(extra == null))        text = text + " " + extra;      PropertiesText.setText(text);      processExtraControls(control);    }    else if (!((SimpleAttributeSet) set.getAttribute("prev") == null)) {      PrevToggleButton.doClick();      SimpleAttributeSet control = (SimpleAttributeSet) set.getAttribute("prev");      String text = "";      String extra = (String) control.getAttribute("extra");      if (!(extra == null))        text = text + " " + extra;        PropertiesText.setText(text);      processExtraControls(control);    }    else if (!((SimpleAttributeSet) set.getAttribute("refresh") == null)) {      RefreshToggleButton.doClick();      SimpleAttributeSet control = (SimpleAttributeSet) set.getAttribute("refresh");      String text = "";      String extra = (String) control.getAttribute("extra");      if (!(extra == null))        text = text + " " + extra;        PropertiesText.setText(text);      processExtraControls(control);    }    else { // no extra tags exist so just click none button      NoneToggleButton.doClick();    }  }  /**   * A helper function for the setData() function, processes "postfield" and   * "setvar" controls.   * @param SimpleAttributeSet set - the attributes to search for "postfield"   * and "setvar" items.   */  private void processExtraControls(SimpleAttributeSet set) {    Vector data = new Vector();    String[] search = {"postfield", "setvar"};    int count = 0;    SimpleAttributeSet control = new SimpleAttributeSet();    while (!(control == null)) {      String num = new Integer(count).toString();      String found = "";      for (int x = 0; x < 2; x++) {        found = search[x];        String key = search[x] + num;        control = (SimpleAttributeSet) set.getAttribute(key);        if (!(control == null)) {          x = 2;        }      }      count++;      if (!(control == null)) {        String name = (String) control.getAttribute("name");        if (name == null)          name = "";        String value = (String) control.getAttribute("value");        if (value == null)          value = "";        String extra = (String) control.getAttribute("extra");        if (extra == null)          extra = "";        String finalText = "<" + found + " name=\"" + name + "\" value=\"" + value + "\"";        if (extra.length() > 0)          finalText = finalText + " " + extra.trim();        finalText = finalText + "/>";        listData.add(finalText);        AdditionalActionList.setListData(listData);        AdditionalActionList.setSelectedIndex(listData.size() - 1);      }    }  }  /**   * A class for rendering icons within a list control.   */  private class CustomCellRenderer extends JLabel implements ListCellRenderer {    private Icon icon;    /**     * default constructor.     * @param Icon icon - the icon to render.     */    public CustomCellRenderer(Icon icon) {      this.icon = icon;      setOpaque(true);    }    /**     * Performs the actual rendering of icon and text     */    public Component getListCellRendererComponent(JList list,                                                  Object value,                                                  int index,                                                  boolean isSelected,                                                  boolean cellHasFocus) {      // set label text      if (value != null) {        String text = value.toString();        setText(text);      }      // set the icon      if (value.toString().indexOf("setvar") > -1)        setIcon(SetVarButton.getIcon());      else        setIcon(PostfieldButton.getIcon());      if (isSelected) {        setBackground(list.getSelectionBackground());        setForeground(list.getSelectionForeground());      }      else {        setBackground(list.getBackground());        setForeground(list.getForeground());      }      return this;    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -