Java, Groovy on Grails, PHP, Kohana

Блог о программировании на Java, Groovy on Grails, PHP, kohana

Currently Viewing Posts Tagged groovy

Create Grails + Vaadin project

Details:

  • java 1.7.0_25
  • grails 2.4.5
  • vaadin plugin 7.5.2

Create Grails app in ItelliJ IDEA 14 as in this manual –
https://vaadin.com/wiki/-/wiki/Main/Vaadin+on+Grails+-+Create+project+in+IntelliJ+IDEA
But use only 1. and 2. points.

After 2. point use next suggestions:

add to BuildConfig.groovy:
to dependencies – runtime ‘org.hibernate:hibernate-validator:5.1.1.Final’
to plugings – compile “:vaadin:7.5.2”
click Apply Grails changes to IDEA project structure

run – grails vaadin-quickstart

Next couple steps:

Screenshot 2015-08-26 23.25.28

Screenshot 2015-08-26 23.29.08

press “+” and select Grails:

Screenshot 2015-08-26 23.30.51

Screenshot 2015-08-26 23.30.51(2)

Screenshot 2015-08-26 23.30.52

select “your app” in Module:

Screenshot 2015-08-26 23.30.52(2)

change name on “your app name”:

Screenshot 2015-08-26 23.30.52(3)

result:

Screenshot 2015-08-26 23.30.52(4)

Thats all.

Maps in Groovy

def someMap = [
           'phones':['iPhone','Galaxy','Nexus'],
           'laptops':['HP','MacBook','Samsung'],
           'tablets':['Galaxy Tab','iPad','Asus'],
           ]

someMap.eachWithIndex{ k, v, index -> println "${k}:${v} - ${index}" }


Result:
phones:[iPhone, Galaxy, Nexus] – 0
laptops:[HP, MacBook, Samsung] – 1
tablets:[Galaxy Tab, iPad, Asus] – 2

def map = [a:"cc", b: "dd"]
println "map - " + map
println "map.keySet() - " + map.keySet()
println "map.values() - " + map.values()
println "map.entrySet() - " + map.entrySet()
println "map.entrySet().key - " + map.entrySet().key
println "map.entrySet().value - " + map.entrySet().value


Result:
map – [a:cc, b:dd]
map.keySet() – [a, b]
map.values() – [cc, dd]
map.entrySet() – [a=cc, b=dd]
map.entrySet().key – [a, b]
map.entrySet().value – [cc, dd]

  • Recent Posts