środa, 5 października 2016
How to change text inside the component to have vertical position
Assuming that your text is inside span component you can just add css:
Primefaces Datatable with editable rows, add button and remove button
So the goal is to implement something like that:
So as you can see we have editable component. It is possible to add new row. When the row is being edited Apply button is disabled and also when you add new row the row is automatically set to edit mode.
Let's take a look at the implementation:
This is an implementation of a from containing datable:
As you can see we used jsf compositions here. Take a look at the implementation of datatable:
And finally bean implementation:
Notice that Remove button inside third column is in the same line as Edit, Check and Close buttons. This is not a default behaviour - in order to achieve that you need to add following css:
So as you can see we have editable component. It is possible to add new row. When the row is being edited Apply button is disabled and also when you add new row the row is automatically set to edit mode.
Let's take a look at the implementation:
This is an implementation of a from containing datable:
As you can see we used jsf compositions here. Take a look at the implementation of datatable:
And finally bean implementation:
Notice that Remove button inside third column is in the same line as Edit, Check and Close buttons. This is not a default behaviour - in order to achieve that you need to add following css:
Implementing commandButton which looses focus after onmouseup
I noticed that on chrome - commandButton from Primefaces doesn't loose focus after clicking on it. This is different behaviour than on Firefox. In order to change it you need to just add attribute
onmouseup="this.blur();"
So your commandButton implementation may look like this:
onmouseup="this.blur();"
So your commandButton implementation may look like this:
<p:commandButton
id="moveUpButton" process="@this" immediate="true"
onmouseup="this.blur();" update="orchestrationTaskDiagram moveDownButton moveUpButton"
actionListener="#{projectAdminBean.moveUpActionListener}"
icon="ui-icon ui-icon-arrowthick-1-n" title="Move Task Up"
styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
disabled="#{!canSaveChanges or !projectAdminBean.editMode or !projectAdminBean.isMoveUpEnabled()}" />
sobota, 28 marca 2015
How to determine which version of Windows you are running
Go to your Command Prompt and enter the following commands:
wmic os get caption wmic os get osarchitecture
piątek, 20 marca 2015
Using files from resources in your tests
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
URL infoFileURL = ProjectServiceImplTest.class.getResource("/log4jINFO.properties");
testLogFileWithINFOLevel = new File(infoFileURL.toURI());
import java.net.URISyntaxException;
import java.net.URL;
URL infoFileURL = ProjectServiceImplTest.class.getResource("/log4jINFO.properties");
testLogFileWithINFOLevel = new File(infoFileURL.toURI());
poniedziałek, 7 stycznia 2013
Java programming interview questions:
- What is immutable object? Can you write immutable object?
- Immutable classes are java classes whose object can not be modified once created. Any modification in Immutable object result in new object. For example String is immutable object. Mostly immutable are also final in order to prevent sub class to overriding method in Java. You can achieve the same functionality by making member as non final but private and not modifying them except constructors.
- What is Static and Dynamic binding in Java
- Overloading and Overriding method
- How to override compareTo method
- final variable, method and class in Java
- What is static variable, class, method and keyword in Java
- static keyword may be applied with variable, method or nested class (cannot be applied with top level class)
- static variables are asociated with class instead of object, and keeps same value for every single object
- you can not use non-static variable inside a static method
- static binding, class loading
- How Garbage collector works, and how System.gc() method works
- What is reflection
- Reflection is the ability of running program to examine/analyse itself and its software environment. To perform this self-examination, a program needs to have a representation of itself. This information we call metadata. In object oriented world metadata is organized into objects, called metaobjects and the run time self examination of the metaobjects is called introspection.
- I didn't use reflection very oftenby myself, but I know that it is used in many java frameworks - for example Spring container uses reflection to create the objects.
- Why main method is static in Java
- Class loading in Java
- Immutable classes are java classes whose object can not be modified once created. Any modification in Immutable object result in new object. For example String is immutable object. Mostly immutable are also final in order to prevent sub class to overriding method in Java. You can achieve the same functionality by making member as non final but private and not modifying them except constructors.
- static keyword may be applied with variable, method or nested class (cannot be applied with top level class)
- static variables are asociated with class instead of object, and keeps same value for every single object
- you can not use non-static variable inside a static method
- static binding, class loading
- Reflection is the ability of running program to examine/analyse itself and its software environment. To perform this self-examination, a program needs to have a representation of itself. This information we call metadata. In object oriented world metadata is organized into objects, called metaobjects and the run time self examination of the metaobjects is called introspection.
- I didn't use reflection very oftenby myself, but I know that it is used in many java frameworks - for example Spring container uses reflection to create the objects.
sobota, 5 stycznia 2013
Spring interview questions
- What is IOC
- Inversion of Control means that we have inverted the control of creating the object from our own using new operator to container or framework. It's the responsibility of container to create object as required. We maintain one xml file where we configure our components, services and all classes and their property. We just need to mention which service is needed by which component and container will create the object for us. This concept is known as dependency injection
- Explain Bean LifeCycle
- Container will look the bean definition inside the configuration file (bean.xml)
- Using reflection container will create the object and if any property is defined inside the bean definition then it will be also set
- If the bean implements the BeanNameAware interface the factory calls setBeanName() passing the bean's ID
- If the bean implements the BeanFactoryAware interface the factory calls setBeanFactory() passing an instance of itself
- If there are any BeanPostProcessors associated with the bean their post- ProcessBeforeInitialization() methods will be called before the properties for the Bean are set.
- If an init() method is specified for the bean, it will be called
- If the Bean class implements the DisposableBean interface, then the method destroy() will be called when the Application no longer needs the bean reference.
- If the Bean definition in the Configuration file contains a 'destroy-method' attribute, then the corresponding method definition in the Bean class will be called.
- What is BeanFactory
- Difference between BeanFactory and ApplicationContext
- What are the different modules in Spring
- Difference between Singleton and Prototype bean
- What type of Transaction Management Spring support.
- What is AOP
- Explain advice
- What is joing point and pointcut
- How to configure Hibernate with Spring
- Transaction propagation types in Spring
Subskrybuj:
Posty (Atom)
