I am new with declarative UI in vaadin,
how to get the java instance like TextField that was declare in xml ?
I want to set value to it. not found how to get it.
With the #Id annotation
#Id("my-textfield")
private TextField myTextfield;
Please read the documentation:
https://vaadin.com/docs/latest/flow/templates/components
For Jmix, you can directly inject the field in screen controllers by using #Autowired annotation.
You can find examples here: https://demo.jmix.io/sampler/#main/3/sample?id=textfield-trim
Notice: the injects property name should be the same as id property in the XML.
btw, you can ask Jmix questions on https://forum.jmix.io
Related
As per documentation, I am creating a new custom field type in atlassian-plugin.xml using the SDK CLI. Now I want to use that new custom field type and create a custom field in another module when the plugin is enabled. However, that module is throwing null pointer exceptions, because the new type is not yet available. The class implementing the type is not annotated as a component - it only gets scanned by spring. It appears the class is instantiated by Jira some time after the plugin has been enabled. How do I know when it is safe to use the new type?
You can go with "/rest/api/2/field" POST option for creating custom fields.
Please refer the URL :
https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/field-createCustomField
I have problems to check if a persistent property in grails has an specific annotation for fields that belong to superclass ... ane then get it's name and value.
I am getting the persistence properties as:
GrailsDomainClassProperty[] persistentProperties = new DefaultGrailsDomainClass(entityClass).getPersistentProperties();
That works great ... but later i found that getDeclaredFields only retrieves the actual class fields (not superclass) and things starts to look not very Groovy.
Is there a prefered Groovy way to do this?
No, you should use this code for all super classes. The same will be for children classes.
recently, I get some code like rendered="#{bean.show()}". and it works. since jsf 2, we can do things like this, even in the js, like if("#{bean.show()}) alert('I am here!');
I want to know, what is the difference call a method or use a getter? Is there a performance issue?
thanks in advance
Liu
Call method it means what you do action and handle response: do navigation for example.
Every field should have getter and setter for get data and set data from web page. If you have field for example
private String username;
you should have also getter and setter, and get/set value with that method according java requirements,you cant have
public String username
//never do this
and access field directly.
also getter/setter does not connect with performance, till your code is correct.
You should review java core part and also JSF tutorial
JSF tutorial
I need to append a suffix to the config value "grails.plugin.springsecurity.auth.loginFormUrl = /login/auth" dynamically at runtime. So I think I would have to change the field "loginFormUrl" in class "LoginUrlAuthenticationEntryPoint". The method "setLoginFormUrl" is deprecated so I wonder how can I change that at runtime? Should I inject/create a new "LoginUrlAuthenticationEntryPoint" everytime I need to do that? How/where would I do that?
So the solution is quite simple. I implemented my own AuthenticationEntryPoint which is pretty much like the LoginUrlAuthenticationEntryPoint but has a different implementation of the determineUrlToUseForThisRequest method.
Then you only have to add this to your resources.groovy:
authenticationEntryPoint(MyCustomEntryPoint) {}
I'm writing a Groovy script (as part of a Grails plugin) and I want to get a list of properties for a GrailsDomainClass that a user of my plugin might define. I can do this using domainClass.properties (where domainClass is a GrailsDomainClass).
However, suppose a user has the grails domain class:
class Example {
String name
static constraints = {
}
def getSomeNonExistingProperty(){
return "Not-a-real-property"
}
}
In this case, domainClass.properties returns a list with both name and someNoneExistingProperty
I understand that this is because of Grails is generating a read-only property on-the-fly for use where someone has a getBlah() method. That's great, but in my script I want to perform some actions with the "real" properties only (or at least non read-only properties).
That is, I would like some way of distinguishing or identifying someNonExistingProperty as a read-only property, or, alternatively, as a property generated by Grails and not entered explicitly as a field in the domainClass by the user of my plugin.
I've looked at the GrailsDomainClassProperty Class and it has a range of methods providing information about the property. However, none of them appear to tell me whether a property is read-only or not, or to allow me to distinguish between a field defined in the domainClass and a field created on-the-fly by Grails as a result of a "getSomeNonExistingProperty()" method.
Am I missing something obvious here? Is there a way of getting a list of just the explicitly user-defined fields (eg name, in the above example)?
I believe transient properties are what you are trying to exclude
I've run into this problem a few times, and instead of trying to work around it I typically just end up renaming my getX() method. It's probably the easiest option.
Edit:
Alternatively, I wonder if you could use reflection to see which methods are defined on the class, and while iterating over your properties see if the property has an explicit getter defined, and omit it. I'm not very familiar with reflection when it comes to Groovy and Grails, especially with the dynamic methods, but it's a possible route of investigation.