标签: custom-component

Delphi“E2161 错误:RLINK32:在构建全部期间打开文件 ________.drf 时出错”

我正在尝试解决一组显然存在依赖性问题的软件包的问题。有时在构建全部期间,我会收到此错误:

Delphi“E2161 错误:RLINK32:打开文件 ________.drf 时出错”

它是什么意思/表示什么?什么是“drf”文件?

delphi package custom-component

6
推荐指数
1
解决办法
1万
查看次数

JSF自定义组件失去了关注ajax更新的输入

我正在编写一个自动完成自定义组件作为JSF 2.1.3的学习练习.这个想法(可能非常熟悉)是输入一些文本和输入组件,并显示一个匹配值的列表框.想法是在输入上有一个keyup javascript事件,它调用jsf.ajax.request()来更新组件.到目前为止,我有一个组件,我可以包括这样:

<mycc:autocomplete id="myauto" searchMethod="#{bean.doSearch}"/>
Run Code Online (Sandbox Code Playgroud)

这会呈现这样的HTML:

<span id="myauto">
  <input type="text" id="myauto_input" name="myauto_input"
    onkeyup="com.myco.ajaxRequest(this, event)"/>
  <select id="myauto_listbox" name="myauto_listbox">
    <option value="1st">First</option>
    <option value="2nd">Second</option>
  </select>
</span>
Run Code Online (Sandbox Code Playgroud)

com.myco.ajaxRequest()javascript函数(keyup)执行此操作:

jsf.ajax.request(comp, null, {
                 execute: 'myauto',
                 render: 'myauto'
                 });
Run Code Online (Sandbox Code Playgroud)

因为我想用建议列表重建和重新呈现列表框,我重新渲染自定义组件'myauto'.通过指定execute:'myauto',decode()方法执行,我可以获取输入值.通过指定render:'myauto',执行encode ...()方法来重新生成html.

这一切都很好,但因为我正在渲染myauto_input组件的父级,所以每次keyup事件触发时都会丢失输入焦点.

如果我指定像render这样的东西:'myauto_listbox'(我真的只想重新渲染列表框)问题是编码...()方法不执行,因为它们是整个自定义组件,而不仅仅是列表框.它将在我重建包含建议的列表框的encode ...()方法之一中.

该组件扩展了UIInput,我在encodeEnd()方法中的单独渲染器(componentFamily ="javax.faces.Input")中生成标记(因此这总是在任何提供的转换器之后运行 - 尚未实现).我想强迫javascript的焦点是一个可怕的黑客,并且要避免.

我有点不确定该去哪里,但我怀疑我所看到的表明我正以某种方式以错误的方式接近这一点.如果有人能够指出我正确的方向,我会非常感激.

javascript ajax jsf custom-component

6
推荐指数
1
解决办法
3716
查看次数

将自定义属性添加到JSF中的Primefaces自动完成组件

我在一个不同的问题中询问了传递属性,发现我可以为<p:autocomplete>组件创建一个自定义渲染器,但问题是我的自定义渲染器将用于我项目中的每个p:autocomplete(站点范围).因此,我选择创建一个自定义组件,该组件扩展org.primefaces.component.autocomplete.AutoComplete并向文本框添加必要的属性.

我最初的想法是添加一个构造函数,但它似乎不起作用,因为此时属性map为null:

@FacesComponent("com.mycomponents.SiteSearch")
public class SiteSearch extends AutoComplete {

    public SiteSearch() {
        Map<String,Object> attrs = getAttributes();
        attrs.put("x-webkit-speech", null); 
        attrs.put("x-webkit-grammer", "builtin:search");
        attrs.put("onwebkitspeechchange", "this.form.submit();");
        attrs.put("placeholder", "Enter a Search Term");
    }   
}
Run Code Online (Sandbox Code Playgroud)

我的另一个想法是将此自定义组件留空(空类),然后指定一个自定义渲染器,用于扩展org.primefaces.component.autocomplete.AutoCompleteRenderer和修改那里的属性.

毕竟说完了之后,我只需要一种方法将这些属性与这一个文本框分开,这样只需在p:autoComplete上放一个自定义渲染器就行不通了(除非我可以使用renderType =属性这个)电话号码:自动完成?).

jsf custom-component primefaces jsf-2

6
推荐指数
1
解决办法
9319
查看次数

JSF自定义组件:支持自定义类型的参数,永远不会调用属性setter

我根据许多教程中的一个创建了我的自定义JSF组件(我使用的是PrimeFaces),我添加了一个成功传递给组件的参数.

<c:custom command="command"/>
Run Code Online (Sandbox Code Playgroud)
public void setCommand(String command) {
    log.debug("setCommand {}", command);
    this.command = command;
}
Run Code Online (Sandbox Code Playgroud)

但我需要自定义类型的参数,这是我在教程中找不到的,它只处理最琐碎的情况.

<c:custom image="#{currentImageBean.image}"/>
Run Code Online (Sandbox Code Playgroud)
public void setImage(Object image) {
    log.debug("setImage {}", image);
    this.image = (Image) image;
}
Run Code Online (Sandbox Code Playgroud)

bean返回Image类型的对象,但不调用setter.我希望这会有效,因为否则一个好的教程应该提到这种情况,但现在我遇到了更糟糕的错误:没有任何反应,日志中没有任何内容暗示为什么......那么,出了什么问题,我需要改变什么,在哪里寻找潜在的错误?

java jsf attributes custom-component jsf-2

6
推荐指数
1
解决办法
1963
查看次数

带有 f:ajax 的 JSF 2 自定义复合组件

我正在尝试使用这个 jQuery 插件http://www.eyecon.ro/colorpicker/创建一个自定义复合组件 colorPicker 。

我希望能够附加一个 jsf 标签 f:ajax , and when a color is selected, perform an ajax call to the server. 我一直在测试这个功能,看起来一切都是正确的,但显然我错过了一些东西,因为从未调用过监听器。

这是我的组件代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="label" />
<composite:clientBehavior name="customEvent" event="change" targets="#{cc.clientId}"/>
</composite:interface>
<composite:implementation>
    <h:outputStylesheet library="css" name="colorpicker/colorpicker.css" />
      <h:outputStylesheet library="css" name="colorpicker/layout.css" />
      <h:outputScript library="js" name="colorpicker/jquery.js" target="head"/>
      <h:outputScript library="js" name="colorpicker/colorpicker.js" target="head"/>
      <h:outputScript library="js" name="colorpicker/eye.js" target="head"/>
      <h:outputScript library="js" name="colorpicker/utils.js" target="head"/>
      <h:outputScript library="js" name="colorpicker/layout.js" target="head"/>
      <h:outputScript library="js" …
Run Code Online (Sandbox Code Playgroud)

ajax event-handling custom-component composite-component jsf-2

6
推荐指数
1
解决办法
4797
查看次数

活动缓慢转换:LogCat中多次"初始化膨胀状态"

为了在我的脑中提供自定义字体,我在这里ListActivity写了一个根据这个例子CustomAdapter扩展的类.BaseAdapter

但是,正如那里所描述的那样,我编写了getView()如下方法:

public View getView(int position, View convertView, ViewGroup parent){
    String gameName = gameNames[position]; // gameName ist the String[] of the Custom Adapter

    TextView tv = new TextView(context);
    tv.setText(gameName);
    tv.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/gulim.ttf"));

    return tv;
}
Run Code Online (Sandbox Code Playgroud)

这按预期工作.唯一令人不安的是,在列表显示之前需要大约三到四秒钟(在这种情况下这是一个很长的时间).但是,在ListActivity我设置onItemClickListeners像这样:

private void setOnItemClickListener(){
    getListView().setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int pos, long id){
            onClickEntryButton(((TextView) view).getText().toString());
        }
    });
}

private void onClickEntryButton(String gameName){
    Intent intent = new Intent(this, GameActivity.class);
    intent.putExtra("gameName", gameName); …
Run Code Online (Sandbox Code Playgroud)

android custom-component android-listview android-logcat

6
推荐指数
1
解决办法
627
查看次数

如何在模板文件中加载自定义PHP Magento块

我已根据本教程创建了一个自定义块 http://blog.magikcommerce.com/how-to-show-most-viewed-best-selling-products-in-magento-store

我想从我的home.phtml模板文件中调用Block.

我打电话给我的静态块:

<?php
$helper = Mage::helper('cms');
$source = Mage::getModel('cms/block')->load('my-block');
$processor = $helper->getPageTemplateProcessor();
$html = $processor->filter($source->getContent());
echo $html;
?>
Run Code Online (Sandbox Code Playgroud)

当然,它就像一个魅力!'但是我如何在模板文件中加载动态块.

我的bestseller.phtml文件是:

app/design/frontend/default/default/template/catalog/product/bestseller.phtml
Run Code Online (Sandbox Code Playgroud)

我的班级是:

Mage_Catalog_Block_Product_Bestseller 
Run Code Online (Sandbox Code Playgroud)

templates block magento custom-component

6
推荐指数
1
解决办法
3万
查看次数

单选按钮的自定义图标

我正在尝试为android中的单选按钮实现自定义图标.即我希望单选按钮图标是我自己选择的一个.我可以使用android:button单选按钮内的属性来做到这一点,但我没有在用户单击它时如何定义它.在我的应用程序中,当用户点击它没有任何反应.我也在这里遵循了这个指南.

I have 2 images :
 A. tire.png (When the radio button is not clicked)
 B. tireinvert.png (When the radio button is clicked)
Run Code Online (Sandbox Code Playgroud)

我的RadioButton.xml文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.techfrk.customizeradiobutton.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

     <RadioGroup
                android:id="@+id/newexprgrp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                android:id="@+id/tvllocrbtn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="40dp"
                android:text="Travelling Expense (Local)"
                />

                  <RadioButton
                android:id="@+id/tvloutrbtn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="15dp"
                android:text="Travelling Expense (Outstation)"

                 />

               <RadioButton
                android:id="@+id/phnexprbtn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="15dp"
                android:text="Phone Expense" …
Run Code Online (Sandbox Code Playgroud)

android radio-button custom-component

6
推荐指数
2
解决办法
1万
查看次数

如何在自定义视图中嵌入 UITableView

目标

我想创建一个自定义视图,它有一个 UITableView 作为子视图。

在此处输入图片说明

自定义视图以编程方式创建表视图。但是,对于外部世界(即 ViewController),自定义视图本身似乎是一个表视图。

我试过的

import UIKit
class CustomTableView: UIView {
    
    // Do I make outlets?
    //@IBOutlet var dataSource: UITableViewDataSource?
    //@IBOutlet var delegate: UITableViewDelegate?
    
    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(frame: CGRect){
        super.init(frame: frame)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        var tableView: UITableView!
        tableView = UITableView(frame: self.bounds)
        // I'm not sure how to set the delegate and dataSource
        // tableView.dataSource = ???
        // tableView.delegate = ???
        
        self.addSubview(tableView)
       
    }
} …
Run Code Online (Sandbox Code Playgroud)

uitableview custom-component ios swift

6
推荐指数
1
解决办法
4288
查看次数

自定义 JSF 组件渲染器:如何围绕另一个元素渲染 HTML

我有 2 个元素,香蕉和一个 outputText,其中香蕉是一个自定义 JSF 组件,在香蕉渲染器中,我想生成包含指定元素的 HTML。

html:

<h:outputText id="theApple" value="This is an Apple" />
.
.
.
<my:banana for="theApple" link="http://www.banana.com" />
Run Code Online (Sandbox Code Playgroud)

香蕉渲染器(将目标元素包含在锚链接中):

@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    ResponseWriter responseWriter = context.getResponseWriter();
    Banana banana = Banana.class.cast(component);
    responseWriter.startElement("a", null);
    responseWriter.writeAttribute("id", banana.getClientId(context), null);
    responseWriter.writeAttribute("href", banana.getLink(), null);
}

@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    ResponseWriter responseWriter = context.getResponseWriter();
    Banana banana = Banana.class.cast(component);
    responseWriter.endElement("a");
}
Run Code Online (Sandbox Code Playgroud)

我想要达到的目标:

<a href="http://www.banana.com">This is an Apple</a>
.
.
.
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我不想在香蕉组件上编码,而是在它使用“for”属性定位的元素上进行编码。我看到的最接近的例子是 …

jsf encoding hyperlink custom-renderer custom-component

6
推荐指数
1
解决办法
1433
查看次数