Re: Inserting/Persisting data into the DB

2015-08-27 Thread Martin Grigorov
Hi,

Your question is not related to Wicket. You better ask in Hibernate/Spring
forums.

I'd remove readOnly = true from @Transactional.

On Thu, Aug 27, 2015 at 3:12 AM, smoothe19 sakinl...@justassociates.com
wrote:

 Having trouble getting my setTestValue method to persist my data in the db
 ..
 i do not see any exceptions but data is not hitting the database.. I am
 using Hibernate and postgres db


 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
 @Service
 public class TestValueService implements ITestValueService
 {
/**
 *
 */
private static final long serialVersionUID = -1027211428586214287L;

@Autowired
GenericDao genericDao;

private static final Logger LOG =
 Logger.getLogger(TestValueService.class);
private TestValue defaultValue;

public TestValueService()
{

}

@Transactional(readOnly = false)
private void setTestValue(TestValue defaultValue){
   genericDao.makePersistent(defaultValue);
   LOG.info(ballingss);
}
/*
 * Method to read the defaults csv file and store into the common table
 */
@Override
//@Transactional(readOnly = false)
public void readCSVFile(String fileLocation, Long clientJobId){
   String csvFile = fileLocation;
   BufferedReader br = null;
   String line = ;
   String cvsSplitBy = ,;

   try {
  br = new BufferedReader(new FileReader(csvFile));
  while ((line = br.readLine()) != null) {

 // use comma as separator
 String[] currentLine = line.split(cvsSplitBy);


 TestValue defaultValue = new TestValue();
 Date date = new Date();
 defaultValue.setClient_job_id(clientJobId);
 defaultValue.setCreate_dt(date);
 defaultValue.setActive(true);
 defaultValue.setDef_keyfield(currentLine[0].toUpperCase());
 defaultValue.setDef_value(currentLine[1].toUpperCase());
 setTestValue(defaultValue);

  }

   } catch (FileNotFoundException e) {
  LOG.error(File Not found );
   } catch (IOException e) {
  e.printStackTrace();
   } finally {
  if (br != null) {
 try {
br.close();
 } catch (IOException e) {
e.printStackTrace();
 }
  }
   }

}




 }


 here is the table object:

 @Entity
 @Table(name = TEST_VALUE)
 public class TestValue implements Serializable {
 private static final long serialVersionUID = 1L;

 @Id
 @GeneratedValue(strategy = GenerationType.AUTO, generator =
 default_values_def_id_seq)
 @SequenceGenerator(name = default_values_def_id_seq, sequenceName =
 default_values_def_id_seq)
 private Long def_id;

 private Long client_job_id;

 @Temporal(TemporalType.TIMESTAMP)
 private Date create_dt;

 @Basic
 private String def_keyfield;

 @Basic
 private String def_value;

 @Basic
 boolean active  = false;

public Long getDef_id()
{
   return def_id;
}

public void setDef_id(Long def_id)
{
   this.def_id = def_id;
}

public Long getClient_job_id()
{
   return client_job_id;
}

public void setClient_job_id(Long client_job_id)
{
   this.client_job_id = client_job_id;
}

public Date getCreate_dt()
{
   return create_dt;
}

public void setCreate_dt(Date create_dt)
{
   this.create_dt = create_dt;
}

public String getDef_keyfield()
{
   return def_keyfield;
}

public void setDef_keyfield(String def_keyfield)
{
   this.def_keyfield = def_keyfield;
}

public String getDef_value()
{
   return def_value;
}

public void setDef_value(String def_value)
{
   this.def_value = def_value;
}

public boolean isActive()
{
   return active;
}

public void setActive(boolean active)
{
   this.active = active;
}

public static long getSerialversionuid()
{
   return serialVersionUID;
}



 }


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Inserting-Persisting-data-into-the-DB-tp4671856.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Modal closed callback

2015-08-27 Thread Marco Di Sabatino Di Diodoro

Hi,

I'm using de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal, 
how can I implement a Modal Closed Callback? I must refresh a ListView 
after submit from a Modal.


Thanks
Marco

--
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/



Re: Modal closed callback

2015-08-27 Thread Gabriel Landon
You mean something like this :

public class PanelContentModal extends ModalVoid {
/** close callback. */
private WindowClosedCallback windowClosedCallback = null;


public PanelContentModal(final String varMarkupId) {
super(varMarkupId);
setUseCloseHandler(true);
}

@Override
protected void onClose(final AjaxRequestTarget paramTarget) {
if (windowClosedCallback != null) {
windowClosedCallback.onClose(paramTarget);
}
}

 public PanelContentModal setWindowClosedCallback(final
WindowClosedCallback callback) {
windowClosedCallback = callback;
return this;
}
} 

And then use it like a ModalWindow :

PanelContentModal  modal = new PanelContentModal(yourId);
modal.setWindowClosedCallback(new WindowClosedCallback() {
@Override
public void onClose(final AjaxRequestTarget paramTarget) {
// Do your refresh
}
});

regards,

Gabriel.
});

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modal-closed-callback-tp4671861p4671862.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Add components inside the footer and header of a Modal

2015-08-27 Thread Marco Di Sabatino Di Diodoro

Hi Martin,


Il 24/08/2015 22:06, Martin Grigorov ha scritto:

Hi,

On Mon, Aug 24, 2015 at 4:05 PM, Marco Di Sabatino Di Diodoro 
marco.disabat...@tirasa.net wrote:


Hi Martin,

Il 24/08/2015 12:16, Martin Grigorov ha scritto:


Hi,

1. File an issue so that becomes more user friendly.


I opened the issue on git

2. You can roll MyModal that extends from Modal and has MyModal.html with

the extra components in header and footer. In MyModal#onInitialize() you
can use get(header).add(anExtraHeaderComponent)


I followed your suggestion and I added a new button in the footer. At
first time I can see my Modal. If I close and reopen I have this exception:
org.apache.wicket.markup.MarkupNotFoundException: Failed to find markup
file associated

If I remove my button, I can open and close without problems.

Without giving us more information (e.g. code and/or stacktrace) we cannot
tell you what is wrong.

here is my source code.

public class BaseModalT extends ModalT {
...
...
public BaseModal(final String id) {
super(id);
container = new WebMarkupContainer(container);
container.add(new EmptyPanel(CONTENT));
container.setOutputMarkupId(true);
add(container);
}

@Override
public MarkupContainer addOrReplace(final Component... component) {
return container.addOrReplace(component);
}

public static String getModalContentId() {
return CONTENT;
}
}

BaseModal.html

html xmlns=http://www.w3.org/1999/xhtml; 
xmlns:wicket=http://wicket.apache.org;

  wicket:panel
div class=modal-dialog wicket:id=dialog
  div class=modal-content
div wicket:id=header class=modal-header
  button type=button class=close data-dismiss=modal 
aria-hidden=truetimes;/button
  h4 wicket:id=header-label class=modal-titleModal 
header/h4

/div
div class=modal-body
  div wicket:id=container
span wicket:id=modalContent[modalContent]/span
  /div
/div
div class=modal-footer
  span wicket:id=footer
wicket:fragment wicket:id=buttons
  button type=button wicket:id=button/button
/wicket:fragment
  /span
/div
  /div
/div
  /wicket:panel
/html

If I close and reopen I have this exception:

org.apache.wicket.markup.MarkupNotFoundException: Failed to find markup 
file associated. RealmModalPanel: [RealmModalPanel [Component id = 
modalContent]]
   at 
org.apache.wicket.markup.html.panel.AssociatedMarkupSourcingStrategy.getMarkup(AssociatedMarkupSourcingStrategy.java:98) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.MarkupContainer.getMarkup(MarkupContainer.java:453) 
~[wicket-core-7.0.0.jar:7.0.0]
   at org.apache.wicket.Component.getMarkup(Component.java:755) 
~[wicket-core-7.0.0.jar:7.0.0]
   at org.apache.wicket.Component.getMarkupTag(Component.java:1438) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.Component.getMarkupAttributes(Component.java:1467) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.updateAjaxAttributes(AjaxFormSubmitBehavior.java:148) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.updateAjaxAttributes(AjaxSubmitLink.java:103) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getAttributes(AbstractDefaultAjaxBehavior.java:146) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.renderExtraHeaderContributors(AbstractDefaultAjaxBehavior.java:119) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.renderHead(AbstractDefaultAjaxBehavior.java:104) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.ajax.AjaxEventBehavior.renderHead(AjaxEventBehavior.java:90) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.Component.internalRenderHead(Component.java:2726) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy$1.component(ChildFirstHeaderRenderStrategy.java:85) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:96) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87) 
~[wicket-core-7.0.0.jar:7.0.0]
   at 

Re: Add components inside the footer and header of a Modal

2015-08-27 Thread Martin Grigorov
On Thu, Aug 27, 2015 at 12:02 PM, Marco Di Sabatino Di Diodoro 
marco.disabat...@tirasa.net wrote:

 Hi Martin,


 Il 24/08/2015 22:06, Martin Grigorov ha scritto:

 Hi,

 On Mon, Aug 24, 2015 at 4:05 PM, Marco Di Sabatino Di Diodoro 
 marco.disabat...@tirasa.net wrote:

 Hi Martin,

 Il 24/08/2015 12:16, Martin Grigorov ha scritto:

 Hi,

 1. File an issue so that becomes more user friendly.

 I opened the issue on git

 2. You can roll MyModal that extends from Modal and has MyModal.html with

 the extra components in header and footer. In MyModal#onInitialize() you
 can use get(header).add(anExtraHeaderComponent)

 I followed your suggestion and I added a new button in the footer. At
 first time I can see my Modal. If I close and reopen I have this
 exception:
 org.apache.wicket.markup.MarkupNotFoundException: Failed to find markup
 file associated

 If I remove my button, I can open and close without problems.

 Without giving us more information (e.g. code and/or stacktrace) we cannot
 tell you what is wrong.

 here is my source code.

 public class BaseModalT extends ModalT {
 ...
 ...
 public BaseModal(final String id) {
 super(id);
 container = new WebMarkupContainer(container);
 container.add(new EmptyPanel(CONTENT));
 container.setOutputMarkupId(true);
 add(container);
 }

 @Override
 public MarkupContainer addOrReplace(final Component... component) {
 return container.addOrReplace(component);
 }

 public static String getModalContentId() {
 return CONTENT;
 }
 }

 BaseModal.html

 html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=
 http://wicket.apache.org;
   wicket:panel
 div class=modal-dialog wicket:id=dialog
   div class=modal-content
 div wicket:id=header class=modal-header
   button type=button class=close data-dismiss=modal
 aria-hidden=truetimes;/button
   h4 wicket:id=header-label class=modal-titleModal
 header/h4
 /div
 div class=modal-body
   div wicket:id=container
 span wicket:id=modalContent[modalContent]/span
   /div
 /div
 div class=modal-footer
   span wicket:id=footer
 wicket:fragment wicket:id=buttons
   button type=button wicket:id=button/button
 /wicket:fragment
   /span
 /div
   /div
 /div
   /wicket:panel
 /html

 If I close and reopen I have this exception:



 org.apache.wicket.markup.MarkupNotFoundException: Failed to find markup
 file associated. RealmModalPanel: [RealmModalPanel [Component id =
 modalContent]]


The error message says RealmModalPanel.html cannot be found.


at
 org.apache.wicket.markup.html.panel.AssociatedMarkupSourcingStrategy.getMarkup(AssociatedMarkupSourcingStrategy.java:98)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.MarkupContainer.getMarkup(MarkupContainer.java:453)
 ~[wicket-core-7.0.0.jar:7.0.0]
at org.apache.wicket.Component.getMarkup(Component.java:755)
 ~[wicket-core-7.0.0.jar:7.0.0]
at org.apache.wicket.Component.getMarkupTag(Component.java:1438)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.Component.getMarkupAttributes(Component.java:1467)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.updateAjaxAttributes(AjaxFormSubmitBehavior.java:148)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.updateAjaxAttributes(AjaxSubmitLink.java:103)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.getAttributes(AbstractDefaultAjaxBehavior.java:146)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.renderExtraHeaderContributors(AbstractDefaultAjaxBehavior.java:119)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.renderHead(AbstractDefaultAjaxBehavior.java:104)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.ajax.AjaxEventBehavior.renderHead(AjaxEventBehavior.java:90)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.Component.internalRenderHead(Component.java:2726)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy$1.component(ChildFirstHeaderRenderStrategy.java:85)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:96)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
 ~[wicket-core-7.0.0.jar:7.0.0]
at
 org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)