What is the difference (in purpose and/or behavior) between a FormControlLabel and an InputLabel in Material-UI (React) version 4+?
See Comparison:
An InputLabel is a specific kind of FormLabel. It has class MuiInputLabel-root and MuiFormLabel-root applied in the DOM
A FormLabel only has class MuiInputLabel-root applied and so is not an InputLabel
An InputLabel component is both a standalone component and is a compositional component inside a TextField.
Related
According to https://www.zkoss.org/wiki/ZK_Component_Reference/Essential_Components/Button#Autodisable, I have customized our ZK app to enable autodisable for all buttons by specifying the following in the custom language addon:
<language-addon>
<component>
<component-name>button</component-name>
<extends>button</extends>
<property>
<property-name>autodisable</property-name>
<property-value>self</property-value>
</property>
</component>
It works fine for buttons defined in ZUL files but not for buttons defined in Java, for example when I have to display a button in each row of a table (listbox), and so I define the buttons in the renderer class.
I could also set the necessary functioning individually for a button:
myButton.setAutodisable("self");
but it would be nice to arrange it in a similar central way as for the normal buttons. How to achieve it?
Since you have access to the button class in Java, the simplest solution would be to create a ButtonExt (or any class name that makes sense in your project's name patterns), generate constructors based on the super class and add this.setAutodisable("self"); in the constructors (after super(...);)
This is basically what the zul parser does. The component config described in your post is just an instruction to tell the parser to always call newComponent.setAutodisable("self"); every time that it instantiate a button.
Since your ButtonExt will be extending the default button class, you can then just instantiate it in Java:
Button myButton = new ButtonExt();
and it will act as a standard button, with your extra initialization code.
In my application I want to change the editable var at once for 3 nstextfields in a custom NSView. Is it possible to do that using only one line of code (turning something on and of in the NSView perhaps?) or do I have to change it for every object individually? Again all the nstextfields are 'grouped' in one NSView. Hiding the nsview is no option, because it will seem like the entire program is nearly empty.
I have (for example) 3 NSTextFields in a custom NSView and I want to change their edibility option for all of them at once (if that is possible). So that I don't have to do: 'textfield1.editable=false' three times
Use Cocoa Bindings:
Create a dynamic variable editable in the target class
dynamic var editable = true
In Interface Builder bind Editable of each text field to the target class , Model Key Path editable.
Now changing the value of the variable affects all text fields simultaneously.
I understand that getInitialState is called once in the component's lifecycle and componentDidMount is called when the component is rendered.
So does that mean both will get called just once in the component's lifecycle? What's the difference?
getInitialState is called at first instantiation of the component. It should always return an object and this object will be the initial state of this.state within the component. You don't have to define getInitialState if you don't want to, perhaps you don't need an internal state, in which case don't define it.
componentDidMount is called once the component is actually mounted to the DOM. But not, as you suggested, every time the component is rendered. If you're looking for something that runs every time the component is rendered (other than the render) take a look at componentWillUpdate and/or componentDidUpdate.
As for the main differences, getInitialState is quite literally just supposed to return the initial state for that component, nothing else. The function is executed long before the component is actually rendered to the DOM. componentDidMount is executed directly after the component has been rendered to the DOM, so for example you could now do things which require the component to be on the DOM first, such as using this.getDOMNode() to check the exact height of your component's root HTML element, or modifying it's scroll position.
You're right though, both will only be called once in the lifetime of an instance of your React component.
I have a TabPanel wdget that will have an unknow number of TabItems widgets each of them will have an unknow number of FieldSet classes each of them implements
Editor<Foo>
TabItem class has a method to add a FieldSet and TabPanel has a method to add a TabItem.
I would like to know what kind of Editor should I implement on the TabItem class or/and on the TabPanel class in order to provide a FooEditor that will hanlder all the FieldSets as a whole.
I mean when I define:
myDriver implements SimpleBeanEditorDriver<Foo, FooEditor>
I need that FooEditor will see each FieldSet as a sub-editor.
Any help will be appreciated.
Daniel
In your case I believe you would have a regular (TabPanel implements Editor< TabItem>) which you use to edit the normal fields TabItem, then within that Editor you would have (FieldSets implements ListEditor< FieldSet, FieldSetEditor>), where field set is an editor such as (FieldSetEditor implements Editor< FieldSet>).
You would need a driver for each type editor, I recommend googling around for examples of ListEditor and taking a look at the dev guide:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiEditors.html
I've written a custom widget with its own set of styles. These styles are defined in a little resource interface contained in the widget, and applied in the constructor of the widget.
I'd like to use the widget in a uibinder xml file, and apply additional styles there. Unfortunately, setting the styleName attribute seems to remove the styles applied in the constructor, and indeed the setStyleName javadoc indicates that it clears other style names.
What's the best solution here? I could override setStyleName, but that takes away options later. Is there a way to call addStyleName instead of setStyleName from the ui.xml file?
Did you try addStyleNames in your ui binder file?