Small refactor for comming converters
This commit is contained in:
parent
75b3d5e0a0
commit
1c308a684a
178 changed files with 5865 additions and 1531 deletions
|
|
@ -35,6 +35,12 @@
|
|||
<artifactId>juel</artifactId>
|
||||
<version>${juel.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-test-frontend-data</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.swing;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
|
||||
/**
|
||||
* SwingActionPanel renders some page and download actions.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 20, 2012
|
||||
*/
|
||||
public class SwingActionPanel extends JPanel implements VascEntryFrontendEventListener,ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -6935210323705891740L;
|
||||
private VascEntry vascEntry = null;
|
||||
private JTextField rowNumberField = null;
|
||||
private JComboBox gotoDirectPage = null;
|
||||
private JComboBox gotoDownload = null;
|
||||
private JLabel resultLabel = null;
|
||||
private boolean init = false;
|
||||
|
||||
public SwingActionPanel(VascEntry vascEntry) {
|
||||
|
||||
this.vascEntry=vascEntry;
|
||||
|
||||
JPanel result = this; //new JPanel();
|
||||
//result.setBackground(Color.pink);
|
||||
//result.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
|
||||
result.add(new JLabel("Row Numbers: "));
|
||||
rowNumberField = new JTextField(6);
|
||||
rowNumberField.addActionListener(this);
|
||||
rowNumberField.setText(""+vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize());
|
||||
result.add(rowNumberField);
|
||||
result.add(new JLabel("Go to: "));
|
||||
gotoDirectPage = new JComboBox();
|
||||
gotoDirectPage.addActionListener(this);
|
||||
result.add(gotoDirectPage);
|
||||
result.add(new JLabel("Download: "));
|
||||
gotoDownload = new JComboBox();
|
||||
gotoDownload.addActionListener(this);
|
||||
gotoDownload.setRenderer(new DownloadListCellRenderer());
|
||||
result.add(gotoDownload);
|
||||
|
||||
resultLabel = new JLabel(" ");
|
||||
result.add(resultLabel);
|
||||
|
||||
//add(result);
|
||||
|
||||
vascEntry.getVascFrontendData().addVascEntryFrontendEventListener(this);
|
||||
}
|
||||
|
||||
class DownloadListCellRenderer extends JLabel implements ListCellRenderer {
|
||||
private static final long serialVersionUID = -2143588238414900498L;
|
||||
public Component getListCellRendererComponent(JList list, Object value,int index, boolean isSelected, boolean hasFocus) {
|
||||
if (value==null) {
|
||||
setText("null");
|
||||
} else {
|
||||
setText(((GlobalVascAction)value).getName());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (init) {
|
||||
return;
|
||||
}
|
||||
if (rowNumberField.equals(event.getSource())) {
|
||||
int pageSize = new Integer(rowNumberField.getText());
|
||||
vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageSize(pageSize);
|
||||
vascEntry.getVascFrontendData().getVascFrontendActions().refreshData();
|
||||
}
|
||||
if (gotoDirectPage.equals(event.getSource())) {
|
||||
if (gotoDirectPage.getSelectedIndex()==0) {
|
||||
return;
|
||||
}
|
||||
vascEntry.getVascFrontendData().getVascFrontendActions().pageAction(gotoDirectPage.getSelectedIndex() - 1);
|
||||
gotoDirectPage.setSelectedIndex(0);
|
||||
}
|
||||
if (gotoDownload.equals(event.getSource())) {
|
||||
GlobalVascAction action = (GlobalVascAction)gotoDownload.getSelectedItem();
|
||||
if (action==null) {
|
||||
return;
|
||||
}
|
||||
String id = (String)action.getId();
|
||||
if (id==null) {
|
||||
return;
|
||||
}
|
||||
if ("null".equals(id)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
action.doGlobalAction(vascEntry);
|
||||
} catch (Exception e) {
|
||||
vascEntry.getVascFrontendData().getVascFrontendHelper().handleException(vascEntry, e);
|
||||
}
|
||||
|
||||
// restore normal view for next request.
|
||||
/*
|
||||
comp.setRenderFacetState("listView");
|
||||
VascEntryExporter ex = getSelectedExporter();
|
||||
|
||||
if (ex==null) {
|
||||
logger.fine("No exporter selected for download.");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
gotoDownload.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener#getEventTypes()
|
||||
*/
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
|
||||
init = true;
|
||||
|
||||
long pageSize = entry.getVascFrontendData().getVascFrontendPager().getPageSize();
|
||||
long pageStart = entry.getVascFrontendData().getVascFrontendPager().getPageStartCount();
|
||||
long pageStop = entry.getVascFrontendData().getVascFrontendPager().getPageStopCount();
|
||||
long pageTotalCount = entry.getVascFrontendData().getVascFrontendPager().getPageTotalRecordCount();
|
||||
String format = "Results %1$d-%2$d from %3$d rows";
|
||||
resultLabel.setText(String.format(format, pageStart, pageStop, pageTotalCount));
|
||||
rowNumberField.setText(""+pageSize);
|
||||
|
||||
gotoDirectPage.removeAllItems();
|
||||
gotoDirectPage.addItem("Goto...");
|
||||
|
||||
List<VascBackendPageNumber> pages = vascEntry.getVascFrontendData().getVascFrontendPager().getTablePagesFromBackend();
|
||||
int i=0;
|
||||
for (VascBackendPageNumber page:pages) {
|
||||
//pages.setRowIndex(i);
|
||||
//VascBackendPageNumber page = (VascBackendPageNumber)getTablePagesDataModel().getRowData();
|
||||
// = new SelectItem();
|
||||
//String name = i18nMap.get("generic.vasc.jsf.table.page.name");
|
||||
//String description = i18nMap.get("generic.vasc.jsf.table.page.description");
|
||||
/*
|
||||
s.setLabel(name+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize));
|
||||
s.setDescription(description+page.getPageNumber());
|
||||
s.setValue(page.getPageNumber());
|
||||
result.add(s);
|
||||
*/
|
||||
//if (page.getSelected()) {
|
||||
// setSelectedItem(arg0)
|
||||
// }
|
||||
gotoDirectPage.addItem("page: "+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SelectItem s = new SelectItem();
|
||||
s.setLabel(i18nMap.get("generic.vasc.jsf.table.export.select"));
|
||||
s.setDescription(i18nMap.get("generic.vasc.jsf.table.export.select.alt"));
|
||||
s.setValue("null");
|
||||
result.add(s);*/
|
||||
gotoDownload.removeAllItems();
|
||||
|
||||
GlobalVascAction empty = new GlobalVascAction() {
|
||||
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setHelpId(String helpId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "...";
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getHelpId() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void doGlobalAction(VascEntry vascEntry) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public GlobalVascAction clone() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
empty.setName("...");
|
||||
gotoDownload.addItem(empty);
|
||||
|
||||
for (GlobalVascAction a:entry.getGlobalActions()) {
|
||||
if (a.getId().contains("xport")) {
|
||||
//s = new SelectItem();
|
||||
//s.setLabel(i18nMap.get(a.getName()));
|
||||
//s.setDescription(i18nMap.get(a.getDescription()));
|
||||
//s.setValue(a.getId());
|
||||
//result.add(s);
|
||||
gotoDownload.addItem(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.swing;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
|
||||
/**
|
||||
* SwingPagerPanel renders dynamic pager for swing.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 21, 2012
|
||||
*/
|
||||
public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventListener,ActionListener {
|
||||
|
||||
private static final long serialVersionUID = 2651163640840746196L;
|
||||
private VascEntry vascEntry = null;
|
||||
private JPanel result = null;
|
||||
|
||||
public SwingPagerPanel(VascEntry vascEntry) {
|
||||
this.vascEntry=vascEntry;
|
||||
//result = this;
|
||||
result = new JPanel();
|
||||
// result.setBackground(Color.green);
|
||||
//result.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
|
||||
|
||||
add(result);
|
||||
vascEntry.getVascFrontendData().addVascEntryFrontendEventListener(this);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() instanceof JButton) {
|
||||
JButton but = (JButton)e.getSource();
|
||||
Integer page = new Integer(but.getText());
|
||||
vascEntry.getVascFrontendData().getVascFrontendActions().pageAction(page);
|
||||
}
|
||||
}
|
||||
|
||||
class NextAction implements ActionListener {
|
||||
boolean next = true;
|
||||
public NextAction(boolean next) {
|
||||
this.next=next;
|
||||
}
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int pageIndex = vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (next) {
|
||||
if (vascEntry.getVascFrontendData().getVascFrontendPager().getHasPageNextAction()) {
|
||||
vascEntry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex+1);
|
||||
}
|
||||
} else {
|
||||
if (vascEntry.getVascFrontendData().getVascFrontendPager().getHasPagePreviousAction()) {
|
||||
vascEntry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
|
||||
for(Component c:result.getComponents()) {
|
||||
if (c instanceof JButton) {
|
||||
((JButton)c).removeActionListener(this);
|
||||
}
|
||||
}
|
||||
result.removeAll();
|
||||
|
||||
|
||||
if (entry.getVascFrontendData().getVascFrontendPager().getHasExtendedPageMode()) {
|
||||
JButton prev = new JButton("Previous");
|
||||
prev.addActionListener(new NextAction(false));
|
||||
prev.setEnabled(entry.getVascFrontendData().getVascFrontendPager().getHasPagePreviousAction());
|
||||
result.add(prev);
|
||||
List<VascBackendPageNumber> pages = entry.getVascFrontendData().getVascFrontendPager().getTablePagesExtendedBegin();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
but.setEnabled(false);
|
||||
}
|
||||
result.add(but);
|
||||
}
|
||||
result.add(new JLabel("..."));
|
||||
if (entry.getVascFrontendData().getVascFrontendPager().getHasExtendedPageModeCenter()) {
|
||||
pages = entry.getVascFrontendData().getVascFrontendPager().getTablePagesExtendedCenter();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
but.setEnabled(false);
|
||||
}
|
||||
result.add(but);
|
||||
}
|
||||
result.add(new JLabel("..."));
|
||||
}
|
||||
pages = entry.getVascFrontendData().getVascFrontendPager().getTablePagesExtendedEnd();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
but.setEnabled(false);
|
||||
}
|
||||
result.add(but);
|
||||
}
|
||||
JButton next = new JButton("Next");
|
||||
next.setEnabled(entry.getVascFrontendData().getVascFrontendPager().getHasPageNextAction());
|
||||
next.addActionListener(new NextAction(true));
|
||||
result.add(next);
|
||||
} else {
|
||||
JButton prev = new JButton("Previous");
|
||||
prev.addActionListener(new NextAction(false));
|
||||
prev.setEnabled(entry.getVascFrontendData().getVascFrontendPager().getHasPagePreviousAction());
|
||||
result.add(prev);
|
||||
List<VascBackendPageNumber> pages = entry.getVascFrontendData().getVascFrontendPager().getTablePagesNormal();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
but.setEnabled(false);
|
||||
}
|
||||
result.add(but);
|
||||
}
|
||||
JButton next = new JButton("Next");
|
||||
next.setEnabled(entry.getVascFrontendData().getVascFrontendPager().getHasPageNextAction());
|
||||
next.addActionListener(new NextAction(true));
|
||||
result.add(next);
|
||||
}
|
||||
}
|
||||
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.swing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.ui.VascColumnValueModelListener;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
|
||||
/**
|
||||
* SwingVascEditDialog renders vasc entry edit dialog
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class SwingVascEditDialog extends JDialog {
|
||||
|
||||
private static final long serialVersionUID = 10L;
|
||||
private String headerText = null;
|
||||
private String headerTextValue = null;
|
||||
private Object result = null;
|
||||
private Object bean = null;
|
||||
private VascEntry entry = null;
|
||||
private SwingVascFrontend swingFrontend = null;
|
||||
|
||||
public SwingVascEditDialog(SwingVascFrontend swingFrontend,JComponent parent,VascEntry entry,Object bean,String beanValue) throws Exception {
|
||||
super();
|
||||
this.headerText = "vasc.dialog.edit.message";
|
||||
this.headerTextValue = beanValue;
|
||||
this.bean = bean;
|
||||
this.entry = entry;
|
||||
this.swingFrontend=swingFrontend;
|
||||
|
||||
setTitle(swingFrontend.i18n("vasc.dialog.edit.title"));
|
||||
setModal(true);
|
||||
|
||||
JPanel pane = new JPanel();
|
||||
pane.setLayout(new BorderLayout());
|
||||
|
||||
JPanel header = new JPanel();
|
||||
createHeader(header);
|
||||
pane.add(header,BorderLayout.NORTH);
|
||||
|
||||
JPanel body = new JPanel();
|
||||
createBody(body);
|
||||
pane.add(body,BorderLayout.CENTER);
|
||||
|
||||
JPanel footer = new JPanel();
|
||||
createFooter(footer);
|
||||
pane.add(footer,BorderLayout.SOUTH);
|
||||
|
||||
add(pane);
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
|
||||
//Ensure the text field always gets the first focus.
|
||||
//addComponentListener(new ComponentAdapter() {
|
||||
// public void componentShown(ComponentEvent ce) {
|
||||
// textField.requestFocusInWindow();
|
||||
// }
|
||||
/// });
|
||||
|
||||
pack();
|
||||
setLocationRelativeTo(parent);
|
||||
setResizable(false);
|
||||
}
|
||||
|
||||
|
||||
public Object openDialog() {
|
||||
setVisible(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void createHeader(JPanel header) {
|
||||
JLabel l = new JLabel();
|
||||
l.setText(swingFrontend.i18n(headerText,headerTextValue));
|
||||
l.setFont(new Font(null,Font.BOLD, 14));
|
||||
//l.setToolTipText(i18n(headerText));
|
||||
header.add(l);
|
||||
}
|
||||
|
||||
public void createBody(JPanel body) throws Exception {
|
||||
body.setLayout(new SpringLayout());
|
||||
int column = 0;
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (c.getEdit()==false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (c.isEditReadOnly()==true) {
|
||||
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(swingFrontend.i18n(c.getName()));
|
||||
label.createComponent(entry,c,model,body);
|
||||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
Object g = editor.createComponent(entry,c,model,body);
|
||||
|
||||
column++;
|
||||
if (i==0) {
|
||||
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,g);
|
||||
}
|
||||
}
|
||||
}
|
||||
//JComponent, rows, cols, initX, initY ,xPad, yPad
|
||||
SpringUtilities.makeCompactGrid(body, column,2, 6,6, 6,6);
|
||||
|
||||
}
|
||||
public void createFooter(JPanel footer) {
|
||||
|
||||
JButton saveButton = new JButton();
|
||||
saveButton.setIcon(swingFrontend.getImageIcon("vasc.dialog.save.image"));
|
||||
saveButton.setText(swingFrontend.i18n("vasc.dialog.save.name"));
|
||||
saveButton.setToolTipText(swingFrontend.i18n("vasc.dialog.save.tooltip"));
|
||||
saveButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
//if(entry.getVascFrontendData().getVascFrontendHelper().validateObject(entry, bean)) {
|
||||
// return;
|
||||
//}
|
||||
result = bean;
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
footer.add(saveButton);
|
||||
|
||||
JButton cancelButton = new JButton();
|
||||
cancelButton.setIcon(swingFrontend.getImageIcon("vasc.dialog.cancel.image"));
|
||||
cancelButton.setText(swingFrontend.i18n("vasc.dialog.cancel.name"));
|
||||
cancelButton.setToolTipText(swingFrontend.i18n("vasc.dialog.cancel.tooltip"));
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
result = null;
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
footer.add(cancelButton);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
package net.forwardfire.vasc.frontends.swing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
|
|
@ -33,44 +32,42 @@ import java.awt.event.MouseAdapter;
|
|||
import java.awt.event.MouseEvent;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.Spring;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.ui.VascColumnValueModelListener;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
|
||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontends.swing.ui.SwingBoolean;
|
||||
import net.forwardfire.vasc.frontends.swing.ui.SwingButton;
|
||||
import net.forwardfire.vasc.frontends.swing.ui.SwingColorChooser;
|
||||
|
|
@ -79,9 +76,8 @@ import net.forwardfire.vasc.frontends.swing.ui.SwingList;
|
|||
import net.forwardfire.vasc.frontends.swing.ui.SwingText;
|
||||
import net.forwardfire.vasc.frontends.swing.ui.SwingTextArea;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* SwingVascFrontend renders vasc entries in a swing panel.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
|
|
@ -90,6 +86,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
private Logger logger = null;
|
||||
private JComponent parent = null;
|
||||
private boolean initOnce = true;
|
||||
|
||||
public SwingVascFrontend(JComponent parent) {
|
||||
logger = Logger.getLogger(SwingVascFrontend.class.getName());
|
||||
|
|
@ -97,7 +94,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#getFrontendType()
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "swing";
|
||||
|
|
@ -169,7 +166,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
return;
|
||||
}
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(result);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
}
|
||||
|
||||
public void renderDelete() throws Exception {
|
||||
|
|
@ -193,7 +190,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
, null // Default button's label
|
||||
);
|
||||
if (response==JOptionPane.YES_OPTION) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().deleteObject();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +232,11 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
* @see net.forwardfire.vasc.core.VascViewRenderer#renderView(net.forwardfire.vasc.core.VascEntry)
|
||||
*/
|
||||
public void renderView() throws Exception {
|
||||
|
||||
|
||||
if (initOnce==false) {
|
||||
return;
|
||||
}
|
||||
|
||||
JPanel topPanel = new JPanel();
|
||||
topPanel.setLayout(new BorderLayout());
|
||||
//topPanel.setBackground(Color.PINK);
|
||||
|
|
@ -257,13 +258,15 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
//parent.setBackground(Color.CYAN);
|
||||
parent.setLayout(new BorderLayout());
|
||||
parent.add(topPanel);
|
||||
|
||||
initOnce = false;
|
||||
}
|
||||
|
||||
private void renderHeader(JComponent parent2) {
|
||||
|
||||
JPanel header = new JPanel();
|
||||
header.setLayout(new BorderLayout());
|
||||
header.setBackground(Color.WHITE);
|
||||
//header.setBackground(Color.WHITE);
|
||||
header.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
||||
if(entry.getListImage()!=null) {
|
||||
|
|
@ -278,42 +281,78 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
if(entry.getName()!=null) {
|
||||
JLabel l = new JLabel(i18n(entry.getName()));
|
||||
l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
//l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
l.setFont(new Font(null,Font.BOLD, 18));
|
||||
if (entry.getListDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getListDescription()));
|
||||
}
|
||||
header.add(l,BorderLayout.NORTH);
|
||||
}
|
||||
if (entry.getListDescription()!=null) {
|
||||
JLabel l = new JLabel(i18n(entry.getListDescription()));
|
||||
//l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
header.add(l,BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
JPanel top = new JPanel();
|
||||
//top.setBackground(Color.BLUE);
|
||||
for (GlobalVascAction action:entry.getGlobalActions()) {
|
||||
JButton but = new JButton();
|
||||
but.setText(i18n(action.getName()));
|
||||
but.setToolTipText(i18n(action.getDescription()));
|
||||
but.addActionListener(new GlobalActionListener(action));
|
||||
but.setIcon(getImageIcon(action.getImage()));
|
||||
top.add(but);
|
||||
}
|
||||
|
||||
|
||||
// create options
|
||||
JPanel optionPanel = new JPanel();
|
||||
//top.setBackground(Color.GREEN);
|
||||
//for(VascUserOption option:entry.getUserOptions()) {
|
||||
// option.createUserOptionRenderer(entry);
|
||||
//}
|
||||
|
||||
// create pager bar
|
||||
JPanel pagePanel = new JPanel();
|
||||
//optionPanel.setBackground(Color.GREEN);
|
||||
|
||||
JPanel body = optionPanel; //new JPanel();
|
||||
body.setLayout(new SpringLayout());
|
||||
int column = 0;
|
||||
try {
|
||||
for(VascEntryField c:entry.getListOptions()) {
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(i18n(c.getName()));
|
||||
label.createComponent(entry,c,model,body);
|
||||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
model.setValue(c.getDefaultValue());
|
||||
//model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
Object g = editor.createComponent(entry,c,model,body);
|
||||
|
||||
column++;
|
||||
if (i==0) {
|
||||
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,g);
|
||||
}
|
||||
body.add(new JLabel()); // fill :(
|
||||
}
|
||||
}
|
||||
|
||||
// add search
|
||||
column++;
|
||||
JLabel searchLabel = new JLabel("Search: ");
|
||||
body.add(searchLabel);
|
||||
final JTextField searchField = new JTextField();
|
||||
body.add(searchField);
|
||||
JButton searchButton = new JButton("Search");
|
||||
searchButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
entry.getVascFrontendData().getVascFrontendActions().searchAction(searchField.getText());
|
||||
}
|
||||
});
|
||||
body.add(searchButton);
|
||||
|
||||
} catch (VascException ve) {
|
||||
throw new RuntimeException(ve);
|
||||
}
|
||||
SpringUtilities.makeCompactGrid(body, column,3, 6,6, 6,6);
|
||||
//optionPanel.add(body);
|
||||
|
||||
|
||||
// create pager bar
|
||||
JPanel bottomPanel = new JPanel();
|
||||
bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.PAGE_AXIS));
|
||||
bottomPanel.add(new SwingPagerPanel(entry));
|
||||
bottomPanel.add(new SwingActionPanel(entry));
|
||||
|
||||
//top.add(header,BorderLayout.NORTH);
|
||||
parent2.setLayout(new BorderLayout());
|
||||
parent2.add(header,BorderLayout.NORTH);
|
||||
parent2.add(optionPanel,BorderLayout.CENTER);
|
||||
parent2.add(top,BorderLayout.EAST);
|
||||
parent2.add(pagePanel,BorderLayout.SOUTH);
|
||||
parent2.add(bottomPanel,BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
private void renderBody(JComponent parent2) {
|
||||
|
|
@ -328,6 +367,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
table.setModel(model);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
table.getTableHeader().addMouseListener(new ColumnListener(table));
|
||||
|
||||
// remove auto columns :(
|
||||
int cols = table.getColumnModel().getColumnCount();
|
||||
|
|
@ -376,6 +416,55 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
parent2.add(scrollPane);
|
||||
}
|
||||
class ColumnListener extends MouseAdapter {
|
||||
protected JTable table;
|
||||
private String sortField = null;
|
||||
private boolean sortOrder = true;
|
||||
|
||||
public ColumnListener(JTable t) {
|
||||
table = t;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
TableColumnModel colModel = table.getColumnModel();
|
||||
int columnModelIndex = colModel.getColumnIndexAtX(e.getX());
|
||||
//int modelIndex = colModel.getColumn(columnModelIndex).getModelIndex();
|
||||
/*
|
||||
if (modelIndex < 0)
|
||||
return;
|
||||
if (sortCol == modelIndex)
|
||||
isSortAsc = !isSortAsc;
|
||||
else
|
||||
sortCol = modelIndex;
|
||||
|
||||
for (int i = 0; i < columnsCount; i++) {
|
||||
TableColumn column = colModel.getColumn(i);
|
||||
column.setHeaderValue(getColumnName(column.getModelIndex()));
|
||||
}
|
||||
table.getTableHeader().repaint();
|
||||
*/
|
||||
|
||||
TableColumn tc = colModel.getColumn(columnModelIndex);
|
||||
VascEntryField field = (VascEntryField)tc.getHeaderValue();
|
||||
//VascEntry entry = comp.getVascEntry();
|
||||
//VascEntryField field = entry.getVascEntryFieldById(fieldIdString);
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendActions().sortAction(field);
|
||||
|
||||
sortOrder = entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending();
|
||||
sortField = field.getId();
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception ee) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, ee);
|
||||
}
|
||||
|
||||
//Collections.sort(vector,new MyComparator(isSortAsc));
|
||||
//table.tableChanged(new TableModelEvent(MyTableModel.this));
|
||||
table.repaint();
|
||||
}
|
||||
}
|
||||
class EntrySectionListener implements ListSelectionListener {
|
||||
JTable table;
|
||||
EntrySectionListener(JTable table) {
|
||||
|
|
@ -425,6 +514,13 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
|
||||
private void renderFooter(JComponent parent2) {
|
||||
|
||||
// create pager bar
|
||||
JPanel bottomPanel = new JPanel();
|
||||
bottomPanel.setLayout(new BorderLayout());
|
||||
bottomPanel.add(new SwingActionPanel(entry),BorderLayout.NORTH);
|
||||
bottomPanel.add(new SwingPagerPanel(entry),BorderLayout.CENTER);
|
||||
|
||||
logger.finest("Creating footer");
|
||||
JPanel panel = new JPanel();
|
||||
for(RowVascAction action:entry.getRowActions()) {
|
||||
|
|
@ -435,8 +531,11 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
but.addActionListener(new RowActionListener(action));
|
||||
panel.add(but);
|
||||
}
|
||||
parent2.setLayout(new BorderLayout());
|
||||
parent2.add(panel,BorderLayout.WEST);
|
||||
bottomPanel.add(panel,BorderLayout.SOUTH);
|
||||
|
||||
//parent2.setLayout(new BorderLayout());
|
||||
//parent2.add(bottomPanel,BorderLayout.WEST);
|
||||
parent2.add(bottomPanel);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.swing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
|
||||
/**
|
||||
* SwingVascTableModel table model for gui component.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class SwingVascTableModel extends AbstractTableModel implements VascEntryFrontendEventListener {
|
||||
|
||||
private static final long serialVersionUID = -7046372314261802293L;
|
||||
private VascEntry entry = null;
|
||||
|
||||
public SwingVascTableModel(VascEntry entry) {
|
||||
this.entry=entry;
|
||||
entry.getVascFrontendData().addVascEntryFrontendEventListener(this);
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object o) {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getColumnCount()
|
||||
*/
|
||||
public int getColumnCount() {
|
||||
int result = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (c.getList()==false) {
|
||||
continue;
|
||||
}
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getRowCount()
|
||||
*/
|
||||
public int getRowCount() {
|
||||
if (entry.getVascFrontendData().getVascEntryState().getEntryDataList()==null) {
|
||||
return 0;
|
||||
}
|
||||
return entry.getVascFrontendData().getVascEntryState().getEntryDataList().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getValueAt(int, int)
|
||||
*/
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataList().get(rowIndex);
|
||||
|
||||
// TODO: this is slowing....
|
||||
List<VascEntryField> list = new ArrayList<VascEntryField>();
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (c.getList()==false) {
|
||||
continue;
|
||||
|
||||
}
|
||||
list.add(c);
|
||||
}
|
||||
|
||||
VascEntryField vtc = list.get(columnIndex);
|
||||
try {
|
||||
//if (vtc.getVascColumnRenderer()!=null) {
|
||||
// return vtc.getVascColumnRenderer().rendererColumn(vtc,bean);
|
||||
//} else {
|
||||
return ""+vtc.getVascEntryFieldValue().getValue(vtc,bean);
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
return "Error";
|
||||
}
|
||||
}
|
||||
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascFrontendEventType.POST_UPDATE,VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,8 +31,12 @@ import javax.swing.JMenuBar;
|
|||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.frontends.swing.SwingVascFrontend;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.test.frontend.data.TestModelEntry;
|
||||
|
||||
|
||||
|
||||
|
|
@ -46,6 +50,8 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class SwingTest extends TestCase {
|
||||
|
||||
private TestModelEntry entry = null;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
// enable all logs
|
||||
//InputStream loggingProperties = this.getClass().getResourceAsStream("META-INF/logging.properties");
|
||||
|
|
@ -62,19 +68,32 @@ public class SwingTest extends TestCase {
|
|||
}
|
||||
|
||||
public static void main(String[] argu){
|
||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
||||
try {
|
||||
VascEntry entry = TestTable.getVascTable();
|
||||
|
||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
||||
SwingTest s = new SwingTest();
|
||||
JFrame frame = s.viewEntry(entry);
|
||||
try {
|
||||
s.open();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void open() throws Exception {
|
||||
|
||||
entry = new TestModelEntry();
|
||||
VascController vc = entry.getTestVascController();
|
||||
|
||||
VascEntry ve = entry.createVascEntry(vc);
|
||||
|
||||
((VascEntryControllerLocal)vc.getVascEntryController()).addVascEntry(ve,vc);
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vc.getVascEntryController(), vc);
|
||||
|
||||
DefaultVascFactory.fillVascEntryFrontend(ve, vc, DefaultVascFactory.getDefaultVascFrontendData(null));
|
||||
|
||||
JFrame frame = viewEntry(ve);
|
||||
|
||||
while (frame.isVisible()) {
|
||||
Thread.sleep(100000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
public JFrame viewEntry(final VascEntry entry) throws Exception {
|
||||
|
|
@ -93,7 +112,7 @@ public class SwingTest extends TestCase {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
VascEntry ee = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(id);
|
||||
TestTable.fill(ee,entry.getVascFrontendData().getVascController());
|
||||
//TestModelEntry.fill(ee,entry.getVascFrontendData().getVascController());
|
||||
viewEntry(ee);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
|
|
@ -116,7 +135,7 @@ public class SwingTest extends TestCase {
|
|||
render.renderView();
|
||||
|
||||
// get data
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().refreshData();
|
||||
|
||||
// view
|
||||
frame.pack();
|
||||
|
|
|
|||
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import net.forwardfire.vasc.annotations.VascDefaultValue;
|
||||
import net.forwardfire.vasc.annotations.VascEntry;
|
||||
import net.forwardfire.vasc.annotations.VascI18n;
|
||||
import net.forwardfire.vasc.annotations.VascModelReference;
|
||||
import net.forwardfire.vasc.annotations.VascStyle;
|
||||
import net.forwardfire.vasc.validators.VascDateFuture;
|
||||
import net.forwardfire.vasc.validators.VascObjectNotNull;
|
||||
import net.forwardfire.vasc.validators.VascStringLength;
|
||||
|
||||
/**
|
||||
* TestModel
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
@VascEntry(headerName="En een tooltip op het model")
|
||||
public class TestModel {
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private Float price = null;
|
||||
private Boolean active = null;
|
||||
private Date date = null;
|
||||
private TestModel testModel = null;
|
||||
private String hexColor = null;
|
||||
//private Node nonEditorField = null;
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
@VascDateFuture
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date the date to set
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
@VascI18n( name="omscheiving",
|
||||
description="De omscrijving",
|
||||
image="/resources/images/gabelfresser.gif",
|
||||
helpId="help.id")
|
||||
@VascDefaultValue(value="xxxxx")
|
||||
@VascStyle(sizeList=200)
|
||||
// @NotNull
|
||||
// @Max(value=10)
|
||||
@VascObjectNotNull
|
||||
@VascStringLength(max=10)
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the price
|
||||
*/
|
||||
public Float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param price the price to set
|
||||
*/
|
||||
public void setPrice(Float price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
|
||||
// @NotNull
|
||||
@VascObjectNotNull
|
||||
@VascModelReference
|
||||
@VascI18n(image="/resources/images/gabelfresser.gif")
|
||||
public TestModel getTestModel() {
|
||||
return testModel;
|
||||
}
|
||||
|
||||
public void setTestModel(TestModel testModel) {
|
||||
this.testModel = testModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hexColor
|
||||
*/
|
||||
public String getHexColor() {
|
||||
return hexColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hexColor the hexColor to set
|
||||
*/
|
||||
public void setHexColor(String hexColor) {
|
||||
this.hexColor = hexColor;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItemModel;
|
||||
import net.forwardfire.vasc.impl.entry.BeanPropertyVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.impl.entry.BeanVascEntryRecordCreator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class TestModelVascDataSource extends AbstractVascBackend implements VascSelectItemModel {
|
||||
|
||||
private List<Object> testModels = null;
|
||||
private String nullLabel = null;
|
||||
private String nullKeyValue = null;
|
||||
|
||||
public TestModelVascDataSource() {
|
||||
testModels = new ArrayList<Object>(2);
|
||||
|
||||
TestModel t = new TestModel();
|
||||
t.setDate(new Date());
|
||||
t.setDescription("yoyo test");
|
||||
t.setName("this Name");
|
||||
t.setPrice(34.1f);
|
||||
t.setActive(true);
|
||||
t.setHexColor("#FF66EE");
|
||||
testModels.add(t);
|
||||
|
||||
t = new TestModel();
|
||||
t.setDate(new Date());
|
||||
t.setDescription("Model2 test");
|
||||
t.setName("BeanSourde");
|
||||
t.setPrice(19.2f);
|
||||
t.setActive(false);
|
||||
t.setTestModel((TestModel)testModels.get(0));
|
||||
testModels.add(t);
|
||||
}
|
||||
public TestModelVascDataSource(List<Object> testModels) {
|
||||
this.testModels=testModels;
|
||||
}
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
return testModels;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
testModels.add(object);
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
if(testModels.contains(object)==false) {
|
||||
testModels.add(object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
testModels.remove(object);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
return new BeanPropertyVascEntryFieldValue(field.getBackendName());
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return new BeanVascEntryRecordCreator(TestModel.class);
|
||||
}
|
||||
|
||||
// --- VascSelectItemModel interface
|
||||
|
||||
public List<VascSelectItem> getVascSelectItems(VascEntry entry) {
|
||||
List<VascSelectItem> res = new ArrayList<VascSelectItem>(4);
|
||||
for (Object o:testModels) {
|
||||
TestModel t = (TestModel)o;
|
||||
VascSelectItem i = new VascSelectItem(t.getName(),t);
|
||||
res.add(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nullLabel
|
||||
*/
|
||||
public String getNullLabel() {
|
||||
return nullLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nullLabel the nullLabel to set
|
||||
*/
|
||||
public void setNullLabel(String nullLabel) {
|
||||
this.nullLabel = nullLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nullKeyValue
|
||||
*/
|
||||
public String getNullKeyValue() {
|
||||
return nullKeyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nullKeyValue the nullKeyValue to set
|
||||
*/
|
||||
public void setNullKeyValue(String nullKeyValue) {
|
||||
this.nullKeyValue = nullKeyValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.forwardfire.vasc.core.VascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFrontendHelper;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxyPaged;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxySearch;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxySort;
|
||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.CSVExportGlobalAction;
|
||||
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.EditRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.RefreshDataGlobalAction;
|
||||
import net.forwardfire.vasc.impl.actions.XMLExportGlobalAction;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 2, 2007
|
||||
*/
|
||||
public class TestTable {
|
||||
|
||||
static VascController getDefaultVascController() throws Exception {
|
||||
VascController c = DefaultVascFactory.getDefaultVascController(1234L,"Nice UserName","user","role_admin");
|
||||
|
||||
// for test
|
||||
TestModelVascDataSource backend = new TestModelVascDataSource();
|
||||
backend.setId("testBackend1");
|
||||
((VascBackendControllerLocal)c.getVascBackendController()).addVascBackend(backend);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static public void fill(VascEntry entry,VascController vascController) {
|
||||
|
||||
|
||||
VascFrontendData frontendData = DefaultVascFactory.getDefaultVascFrontendData(null); //DefaultVascFactory.getDefaultVascFrontendData("i18n.vasc", Locale.getDefault());
|
||||
frontendData.setVascController(vascController);
|
||||
entry.setVascFrontendData(frontendData);
|
||||
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
|
||||
frontendData.getVascEntryState().setVascBackend(backend);
|
||||
frontendData.getVascEntryState().setVascEntry(entry);
|
||||
|
||||
|
||||
entry.addRowAction(new AddRowAction());
|
||||
entry.addRowAction(new EditRowAction());
|
||||
entry.addRowAction(new DeleteRowAction());
|
||||
|
||||
entry.addGlobalAction(new XMLExportGlobalAction());
|
||||
entry.addGlobalAction(new CSVExportGlobalAction());
|
||||
entry.addGlobalAction(new RefreshDataGlobalAction());
|
||||
|
||||
// hackje om deze manuale actions van i18n keys te voorzien;
|
||||
// this is temp untill x4o templaing
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
try {
|
||||
f.finalizeVascEntry(entry, vascController);
|
||||
} catch (VascException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
VascParser parser = new VascParser(c);
|
||||
File f = File.createTempFile("test-vasc", ".xml");
|
||||
parser.setDebugOutputStream(new FileOutputStream(f));
|
||||
parser.parseResource("net/forwardfire/vasc/tables.xml");
|
||||
|
||||
VascEntry entry = parser.getVascController().getVascEntryController().getVascEntryById("test1");
|
||||
fill(entry,c);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static void printEntry(VascEntry e) throws Exception {
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("=== Printing entry ===");
|
||||
System.out.println("");
|
||||
|
||||
for (Method m:e.getClass().getMethods()) {
|
||||
if (m.getName().startsWith("get")==false) { //a bit dirty
|
||||
continue;
|
||||
}
|
||||
if (m.getParameterTypes().length>0) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("prop: "+m.getName()+" -> "+m.invoke(e));
|
||||
}
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("=== Fields ===");
|
||||
for (VascEntryField vef:e.getVascEntryFields()) {
|
||||
|
||||
System.out.println("=== Field: "+vef.getId());
|
||||
|
||||
for (Method m:vef.getClass().getMethods()) {
|
||||
if (m.getName().startsWith("get")==false) { //a bit dirty
|
||||
continue;
|
||||
}
|
||||
if (m.getParameterTypes().length>0) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("prop: "+m.getName()+" -> "+m.invoke(vef));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,8 +64,12 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-test-frontend-data</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.swt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
/**
|
||||
* SwtActionPanel renders action bar
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 13, 2009
|
||||
*/
|
||||
public class SwtActionPanel implements VascEntryFrontendEventListener {
|
||||
|
||||
private static final long serialVersionUID = 3747573488962487970L;
|
||||
private VascEntry entry = null;
|
||||
private Text rowNumberField = null;
|
||||
private Combo pageBox = null;
|
||||
private Combo downloadBox = null;
|
||||
private Label resultLabel = null;
|
||||
private boolean vascEvent = false;
|
||||
|
||||
public SwtActionPanel(VascEntry entry) {
|
||||
this.entry=entry;
|
||||
entry.getVascFrontendData().addVascEntryFrontendEventListener(this);
|
||||
}
|
||||
|
||||
public void createComposite(Composite parent) {
|
||||
Composite actionRow = new Composite(parent, SWT.NONE);
|
||||
GridLayout bodyLayout = new GridLayout();
|
||||
bodyLayout.numColumns = 8;
|
||||
actionRow.setLayout(bodyLayout);
|
||||
actionRow.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
//actionRow.setBackground(c);
|
||||
|
||||
Label l = new Label(actionRow, SWT.CENTER);
|
||||
l.setText("Row Numbers");
|
||||
rowNumberField = new Text(actionRow, SWT.NONE | SWT.BORDER);
|
||||
rowNumberField.setText(""+entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()+" ");
|
||||
rowNumberField.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent arg0) {
|
||||
if (vascEvent) {
|
||||
return;
|
||||
}
|
||||
int pageSize = new Integer(rowNumberField.getText());
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageSize(pageSize);
|
||||
entry.getVascFrontendData().getVascFrontendActions().refreshData();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
l = new Label(actionRow, SWT.CENTER);
|
||||
l.setText("Goto: ");
|
||||
pageBox = new Combo(actionRow,SWT.SINGLE | SWT.BORDER);
|
||||
pageBox.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
entry.getVascFrontendData().getVascFrontendActions().pageAction(pageBox.getSelectionIndex()-1);
|
||||
pageBox.select(0);
|
||||
}
|
||||
});
|
||||
|
||||
l = new Label(actionRow, SWT.CENTER);
|
||||
l.setText("Download: ");
|
||||
downloadBox = new Combo(actionRow,SWT.SINGLE | SWT.BORDER);
|
||||
downloadBox.add("...");
|
||||
for (GlobalVascAction a:entry.getGlobalActions()) {
|
||||
if (a.getId().contains("xport")) {
|
||||
downloadBox.add(a.getName());
|
||||
}
|
||||
}
|
||||
downloadBox.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
||||
downloadBox.select(0);
|
||||
}
|
||||
});
|
||||
|
||||
resultLabel = new Label(actionRow, SWT.CENTER);
|
||||
resultLabel.setText("Result......................................");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener#getEventTypes()
|
||||
*/
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
vascEvent = true;
|
||||
|
||||
long pageSize = entry.getVascFrontendData().getVascFrontendPager().getPageSize();
|
||||
long pageStart = entry.getVascFrontendData().getVascFrontendPager().getPageStartCount();
|
||||
long pageStop = entry.getVascFrontendData().getVascFrontendPager().getPageStopCount();
|
||||
long pageTotalCount = entry.getVascFrontendData().getVascFrontendPager().getPageTotalRecordCount();
|
||||
String format = "Results %1$d-%2$d from %3$d rows";
|
||||
resultLabel.setText(String.format(format, pageStart, pageStop, pageTotalCount));
|
||||
resultLabel.redraw();
|
||||
rowNumberField.setText(""+pageSize);
|
||||
rowNumberField.redraw();
|
||||
|
||||
pageBox.removeAll();
|
||||
pageBox.add("Goto...");
|
||||
List<VascBackendPageNumber> pages = entry.getVascFrontendData().getVascFrontendPager().getTablePagesFromBackend();
|
||||
int i=0;
|
||||
for (VascBackendPageNumber page:pages) {
|
||||
pageBox.add("page: "+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize));
|
||||
i++;
|
||||
}
|
||||
|
||||
vascEvent = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.swt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
/**
|
||||
* SwtPagerPanel renders pager bar
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 13, 2009
|
||||
*/
|
||||
public class SwtPagerPanel implements VascEntryFrontendEventListener {
|
||||
|
||||
private static final long serialVersionUID = 3747573488962487970L;
|
||||
private VascEntry entry = null;
|
||||
|
||||
public SwtPagerPanel(VascEntry entry) {
|
||||
this.entry=entry;
|
||||
entry.getVascFrontendData().addVascEntryFrontendEventListener(this);
|
||||
}
|
||||
|
||||
public void createComposite(Composite parent) {
|
||||
Composite actionRow = new Composite(parent, SWT.NONE);
|
||||
GridLayout bodyLayout = new GridLayout();
|
||||
bodyLayout.numColumns = 1;
|
||||
actionRow.setLayout(bodyLayout);
|
||||
actionRow.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
//actionRow.setBackground(c);
|
||||
|
||||
Label l = new Label(actionRow, SWT.CENTER);
|
||||
l.setText("Pagers");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener#getEventTypes()
|
||||
*/
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -47,6 +47,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
|
||||
/**
|
||||
* SwtVascEditDialog renders swt edit dialog
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 13, 2009
|
||||
|
|
@ -206,7 +207,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
if (error) {
|
||||
return;
|
||||
}
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
shell.dispose();
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -27,20 +27,19 @@ import java.io.OutputStream;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModelListener;
|
||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontends.swt.ui.SwtBoolean;
|
||||
import net.forwardfire.vasc.frontends.swt.ui.SwtButton;
|
||||
import net.forwardfire.vasc.frontends.swt.ui.SwtLabel;
|
||||
|
|
@ -86,6 +85,7 @@ import org.eclipse.swt.widgets.ToolItem;
|
|||
|
||||
|
||||
/**
|
||||
* SwtVascFrontend Vasc swt frontend.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
|
|
@ -95,6 +95,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
private Logger logger = null;
|
||||
private Composite parent = null;
|
||||
private boolean renderGlobalActions = true;
|
||||
private boolean initOnce = false;
|
||||
|
||||
public SwtVascFrontend(Composite parent) {
|
||||
logger = Logger.getLogger(SwtVascFrontend.class.getName());
|
||||
|
|
@ -102,7 +103,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#getFrontendType()
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "swt";
|
||||
|
|
@ -193,7 +194,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
return;
|
||||
}
|
||||
// yes
|
||||
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().deleteObject();
|
||||
}
|
||||
|
||||
private boolean askDelete(Shell shell) {
|
||||
|
|
@ -209,6 +210,10 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
|
||||
public void renderView() throws Exception {
|
||||
if (initOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
|
|
@ -235,6 +240,8 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
createHeader(header);
|
||||
createBody(body);
|
||||
createFooter(footer);
|
||||
|
||||
initOnce = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -325,7 +332,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
model.setValue(null);
|
||||
model.addListener(new VascValueModelListener() {
|
||||
public void valueUpdate(VascValueModel model) throws VascException {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);// mm
|
||||
entry.getVascFrontendData().getVascFrontendActions().refreshData();// mm
|
||||
}
|
||||
});
|
||||
Object edit = editor.createComponent(entry,option,model,headerOptions);
|
||||
|
|
@ -351,15 +358,21 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
public void modifyText(ModifyEvent e) {
|
||||
String value = text.getText();
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().searchAction(entry, value);
|
||||
entry.getVascFrontendData().getVascFrontendActions().searchAction(value);
|
||||
} catch (Exception ee) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SwtPagerPanel pagerBar = new SwtPagerPanel(entry);
|
||||
pagerBar.createComposite(header);
|
||||
|
||||
SwtActionPanel actionBar = new SwtActionPanel(entry);
|
||||
actionBar.createComposite(header);
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().headerOptionsCreatedFillData(entry);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -440,7 +453,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
table2.setSortDirection(dir);
|
||||
VascEntryField field = (VascEntryField)currentColumn.getData();
|
||||
entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field);
|
||||
entry.getVascFrontendData().getVascFrontendActions().sortAction(field);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -529,6 +542,13 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
public void createFooter(Composite footer) {
|
||||
logger.finest("Creating footer");
|
||||
|
||||
SwtActionPanel p = new SwtActionPanel(entry);
|
||||
p.createComposite(footer);
|
||||
|
||||
SwtPagerPanel pagerBar = new SwtPagerPanel(entry);
|
||||
pagerBar.createComposite(footer);
|
||||
|
||||
for( RowVascAction action:entry.getRowActions()) {
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,13 @@
|
|||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.frontends.swt.SwtVascFrontend;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.test.frontend.data.TestModelEntry;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
|
@ -43,13 +45,9 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class SWTTest extends TestCase {
|
||||
|
||||
private TestModelEntry entry = null;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
// enable all logs
|
||||
//InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
|
||||
//LogManager.getLogManager().readConfiguration( loggingProperties );
|
||||
//loggingProperties.close();
|
||||
|
||||
// load xtes queries
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
|
|
@ -72,10 +70,15 @@ public class SWTTest extends TestCase {
|
|||
// define redering and render
|
||||
SwtVascFrontend render = new SwtVascFrontend(shell);
|
||||
|
||||
entry = new TestModelEntry();
|
||||
VascController vc = entry.getTestVascController();
|
||||
VascEntry ve = entry.createVascEntry(vc);
|
||||
((VascEntryControllerLocal)vc.getVascEntryController()).addVascEntry(ve,vc);
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vc.getVascEntryController(), vc);
|
||||
DefaultVascFactory.fillVascEntryFrontend(ve, vc, DefaultVascFactory.getDefaultVascFrontendData(null));
|
||||
|
||||
VascEntry entry = TestTable.getVascTable();
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
render.initEntry(entry);
|
||||
ve.getVascFrontendData().getVascFrontendActions().refreshData();
|
||||
render.initEntry(ve);
|
||||
render.renderView();
|
||||
|
||||
// view
|
||||
|
|
|
|||
|
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import net.forwardfire.vasc.annotations.VascDefaultValue;
|
||||
import net.forwardfire.vasc.annotations.VascEntry;
|
||||
import net.forwardfire.vasc.annotations.VascI18n;
|
||||
import net.forwardfire.vasc.annotations.VascModelReference;
|
||||
import net.forwardfire.vasc.annotations.VascStyle;
|
||||
import net.forwardfire.vasc.validators.VascDateFuture;
|
||||
import net.forwardfire.vasc.validators.VascObjectNotNull;
|
||||
import net.forwardfire.vasc.validators.VascStringLength;
|
||||
|
||||
|
||||
//import org.hibernate.validator.NotNull;
|
||||
//import org.hibernate.validator.Max;
|
||||
|
||||
|
||||
/**
|
||||
* TestModel
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
@VascEntry(headerName="En een tooltip op het model")
|
||||
public class TestModel {
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private Float price = null;
|
||||
private Boolean active = null;
|
||||
private Date date = null;
|
||||
private TestModel testModel = null;
|
||||
private String hexColor = null;
|
||||
//private Node nonEditorField = null;
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
@VascDateFuture
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date the date to set
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
@VascI18n( name="omscheiving",
|
||||
description="De omscrijving",
|
||||
image="/resources/images/gabelfresser.gif",
|
||||
helpId="help.id")
|
||||
@VascDefaultValue(value="xxxxx")
|
||||
@VascStyle(sizeList=200)
|
||||
// @NotNull
|
||||
// @Max(value=10)
|
||||
@VascObjectNotNull
|
||||
@VascStringLength(max=10)
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the price
|
||||
*/
|
||||
public Float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param price the price to set
|
||||
*/
|
||||
public void setPrice(Float price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
|
||||
// @NotNull
|
||||
@VascObjectNotNull
|
||||
@VascModelReference
|
||||
@VascI18n(image="/resources/images/gabelfresser.gif")
|
||||
public TestModel getTestModel() {
|
||||
return testModel;
|
||||
}
|
||||
|
||||
public void setTestModel(TestModel testModel) {
|
||||
this.testModel = testModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hexColor
|
||||
*/
|
||||
public String getHexColor() {
|
||||
return hexColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hexColor the hexColor to set
|
||||
*/
|
||||
public void setHexColor(String hexColor) {
|
||||
this.hexColor = hexColor;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItemModel;
|
||||
import net.forwardfire.vasc.impl.entry.BeanPropertyVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.impl.entry.BeanVascEntryRecordCreator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class TestModelVascDataSource extends AbstractVascBackend implements VascSelectItemModel {
|
||||
|
||||
private List<Object> testModels = null;
|
||||
private String nullLabel = null;
|
||||
private String nullKeyValue = null;
|
||||
|
||||
public TestModelVascDataSource() {
|
||||
testModels = new ArrayList<Object>(2);
|
||||
|
||||
TestModel t = new TestModel();
|
||||
t.setDate(new Date());
|
||||
t.setDescription("yoyo test");
|
||||
t.setName("this Name");
|
||||
t.setPrice(34.1f);
|
||||
t.setActive(true);
|
||||
t.setHexColor("#FF66EE");
|
||||
testModels.add(t);
|
||||
|
||||
t = new TestModel();
|
||||
t.setDate(new Date());
|
||||
t.setDescription("Model2 test");
|
||||
t.setName("BeanSourde");
|
||||
t.setPrice(19.2f);
|
||||
t.setActive(false);
|
||||
t.setTestModel((TestModel)testModels.get(0));
|
||||
testModels.add(t);
|
||||
}
|
||||
public TestModelVascDataSource(List<Object> testModels) {
|
||||
this.testModels=testModels;
|
||||
}
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
return testModels;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
testModels.add(object);
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
if(testModels.contains(object)==false) {
|
||||
testModels.add(object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
testModels.remove(object);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
return new BeanPropertyVascEntryFieldValue(field.getBackendName());
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return new BeanVascEntryRecordCreator(TestModel.class);
|
||||
}
|
||||
|
||||
// --- VascSelectItemModel interface
|
||||
|
||||
public List<VascSelectItem> getVascSelectItems(VascEntry entry) {
|
||||
List<VascSelectItem> res = new ArrayList<VascSelectItem>(4);
|
||||
for (Object o:testModels) {
|
||||
TestModel t = (TestModel)o;
|
||||
VascSelectItem i = new VascSelectItem(t.getName(),t);
|
||||
res.add(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nullLabel
|
||||
*/
|
||||
public String getNullLabel() {
|
||||
return nullLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nullLabel the nullLabel to set
|
||||
*/
|
||||
public void setNullLabel(String nullLabel) {
|
||||
this.nullLabel = nullLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nullKeyValue
|
||||
*/
|
||||
public String getNullKeyValue() {
|
||||
return nullKeyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nullKeyValue the nullKeyValue to set
|
||||
*/
|
||||
public void setNullKeyValue(String nullKeyValue) {
|
||||
this.nullKeyValue = nullKeyValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.forwardfire.vasc.core.VascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFrontendHelper;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxyPaged;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxySearch;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxySort;
|
||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.CSVExportGlobalAction;
|
||||
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.EditRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.RefreshDataGlobalAction;
|
||||
import net.forwardfire.vasc.impl.actions.XMLExportGlobalAction;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 2, 2007
|
||||
*/
|
||||
public class TestTable {
|
||||
|
||||
static VascController getDefaultVascController() throws Exception {
|
||||
VascController c = DefaultVascFactory.getDefaultVascController(2288L,"vasc.forwardfire.net","user","admin");
|
||||
|
||||
// for test
|
||||
TestModelVascDataSource backend = new TestModelVascDataSource();
|
||||
backend.setId("testBackend1");
|
||||
((VascBackendControllerLocal)c.getVascBackendController()).addVascBackend(backend);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static public void fill(VascEntry entry,VascController vascController) {
|
||||
|
||||
|
||||
VascFrontendData frontendData = DefaultVascFactory.getDefaultVascFrontendData(null);
|
||||
frontendData.setVascController(vascController);
|
||||
entry.setVascFrontendData(frontendData);
|
||||
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
|
||||
frontendData.getVascEntryState().setVascBackend(backend);
|
||||
frontendData.getVascEntryState().setVascEntry(entry);
|
||||
|
||||
|
||||
entry.addRowAction(new AddRowAction());
|
||||
entry.addRowAction(new EditRowAction());
|
||||
entry.addRowAction(new DeleteRowAction());
|
||||
|
||||
entry.addGlobalAction(new XMLExportGlobalAction());
|
||||
entry.addGlobalAction(new CSVExportGlobalAction());
|
||||
entry.addGlobalAction(new RefreshDataGlobalAction());
|
||||
|
||||
// hackje om deze manuale actions van i18n keys te voorzien;
|
||||
// this is temp untill x4o templaing
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
try {
|
||||
f.finalizeVascEntry(entry, vascController);
|
||||
} catch (VascException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
VascParser parser = new VascParser(c);
|
||||
File f = File.createTempFile("test-vasc", ".xml");
|
||||
parser.setDebugOutputStream(new FileOutputStream(f));
|
||||
parser.parseResource("vasc/tables.xml");
|
||||
|
||||
VascEntry entry = parser.getVascController().getVascEntryController().getVascEntryById("dg2_profiles");
|
||||
fill(entry,c);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static void printEntry(VascEntry e) throws Exception {
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("=== Printing entry ===");
|
||||
System.out.println("");
|
||||
|
||||
for (Method m:e.getClass().getMethods()) {
|
||||
if (m.getName().startsWith("get")==false) { //a bit dirty
|
||||
continue;
|
||||
}
|
||||
if (m.getParameterTypes().length>0) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("prop: "+m.getName()+" -> "+m.invoke(e));
|
||||
}
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("=== Fields ===");
|
||||
for (VascEntryField vef:e.getVascEntryFields()) {
|
||||
|
||||
System.out.println("=== Field: "+vef.getId());
|
||||
|
||||
for (Method m:vef.getClass().getMethods()) {
|
||||
if (m.getName().startsWith("get")==false) { //a bit dirty
|
||||
continue;
|
||||
}
|
||||
if (m.getParameterTypes().length>0) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("prop: "+m.getName()+" -> "+m.invoke(vef));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,12 +21,12 @@
|
|||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
package net.forwardfire.vasc.frontends.web.jsf;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
|
||||
public abstract class AbstractJSFVascFacesControllerBase {
|
||||
|
||||
abstract VascFrontendData getNewVascFrontendData();
|
||||
abstract VascController getVascController();
|
||||
|
||||
public void setVascController(VascController vascController) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public List<Object> executeVascList(String entryId,Map<String,Object> para) {
|
||||
try {
|
||||
// plug all object
|
||||
VascEntry entry = getVascController().getVascEntryController().getVascEntryById(entryId);
|
||||
DefaultVascFactory.fillVascEntryFrontend(entry, getVascController(), getNewVascFrontendData());
|
||||
|
||||
// set def para
|
||||
VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
|
||||
for (String key2:entry.getEntryParameterKeys()) {
|
||||
Object value = entry.getEntryParameter(key2);
|
||||
state.setDataParameter(key2, value);
|
||||
}
|
||||
|
||||
// set list para
|
||||
for (VascEntryField vef:entry.getListOptions()) {
|
||||
Object def = vef.getDefaultValue();
|
||||
if (def==null) {
|
||||
continue;
|
||||
}
|
||||
String backendName = vef.getBackendName();
|
||||
state.setDataParameter(backendName, def);
|
||||
}
|
||||
|
||||
// copy para
|
||||
if (para!=null) {
|
||||
for (String key:para.keySet()) {
|
||||
entry.setEntryParameter(key, para.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
// done, execute and return data.
|
||||
entry.getVascFrontendData().getVascFrontendActions().refreshData();
|
||||
return entry.getVascFrontendData().getVascEntryState().getEntryDataList();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not execute list: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,23 +38,23 @@ import javax.faces.context.FacesContext;
|
|||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import net.forwardfire.vasc.core.VascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2010
|
||||
*/
|
||||
abstract public class AbstractJSFVascFacesController {
|
||||
abstract public class AbstractJSFVascFacesControllerEJB extends AbstractJSFVascFacesControllerBase {
|
||||
|
||||
private VascController vascController = null;
|
||||
|
||||
|
|
@ -167,51 +167,7 @@ abstract public class AbstractJSFVascFacesController {
|
|||
return vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public List<Object> executeVascList(String entryId,Map<String,Object> para) {
|
||||
try {
|
||||
// plug all object
|
||||
VascEntry entry = getVascController().getVascEntryController().getVascEntryById(entryId);
|
||||
entry.setVascFrontendData(getNewVascFrontendData());
|
||||
entry.getVascFrontendData().setVascController(getVascController());
|
||||
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
|
||||
entry.getVascFrontendData().getVascEntryState().setVascBackend(backend);
|
||||
entry.getVascFrontendData().getVascEntryState().setVascEntry(entry);
|
||||
|
||||
// set def para
|
||||
VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
|
||||
for (String key2:entry.getEntryParameterKeys()) {
|
||||
Object value = entry.getEntryParameter(key2);
|
||||
//System.out.println("Copy paras name: "+key2+" value: "+value+" class: "+value.getClass().getName());
|
||||
state.setDataParameter(key2, value);
|
||||
}
|
||||
|
||||
// set list para
|
||||
for (VascEntryField vef:entry.getListOptions()) {
|
||||
Object def = vef.getDefaultValue();
|
||||
if (def==null) {
|
||||
continue;
|
||||
}
|
||||
String backendName = vef.getBackendName();
|
||||
state.setDataParameter(backendName, def);
|
||||
}
|
||||
|
||||
// copy para
|
||||
if (para!=null) {
|
||||
for (String key:para.keySet()) {
|
||||
entry.setEntryParameter(key, para.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
// done, execute and return data.
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
return entry.getVascFrontendData().getVascEntryState().getEntryDataList();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not execute list: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class RemoteVascBackend implements VascBackend {
|
||||
|
||||
|
|
@ -445,7 +401,4 @@ abstract public class AbstractJSFVascFacesController {
|
|||
throw new RuntimeException("Could not create remote based vasc controller; "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setVascController(VascController vascController) {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.frontends.web.jsf;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Base faces session object for managing vasc entries.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2010
|
||||
*/
|
||||
abstract public class AbstractJSFVascFacesControllerLocal extends AbstractJSFVascFacesControllerBase {
|
||||
|
||||
protected VascController vascController = null;
|
||||
protected Map<String,Object> vascGlobalELBeans = new HashMap<String,Object>(3);
|
||||
|
||||
abstract public String getResourceBundleWEB();
|
||||
abstract public boolean getDisableI18N();
|
||||
abstract public VascUserInfo getVascUserInfo();
|
||||
abstract public String[] getVascParseResources();
|
||||
|
||||
public class VascUserInfo {
|
||||
Long userId;
|
||||
String username;
|
||||
String[] roles;
|
||||
public VascUserInfo(Long userId,String username,String[] roles) {
|
||||
this.userId=userId;
|
||||
this.username=username;
|
||||
this.roles=roles;
|
||||
}
|
||||
}
|
||||
|
||||
class MergedResourceBundle extends ResourceBundle {
|
||||
Map<String,String> data = new HashMap<String,String>(500);
|
||||
|
||||
public void addDateMap(Map<String,String> dataMap) {
|
||||
data.putAll(dataMap);
|
||||
}
|
||||
public void addDataBundle(ResourceBundle bundle) {
|
||||
for (String key:bundle.keySet()) {
|
||||
String value = bundle.getString(key);
|
||||
data.put(key, value);
|
||||
}
|
||||
}
|
||||
public Object handleGetObject(String key) {
|
||||
return data.get(key);
|
||||
}
|
||||
|
||||
public Enumeration<String> getKeys() {
|
||||
return Collections.enumeration(data.keySet());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Config vasc frontend data object for jsf component to use.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public VascFrontendData getNewVascFrontendData() {
|
||||
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
|
||||
MergedResourceBundle bundle = new MergedResourceBundle();
|
||||
bundle.addDataBundle(ResourceBundle.getBundle(getResourceBundleWEB(), locale));
|
||||
|
||||
VascFrontendData vascFrontendData = DefaultVascFactory.getDefaultVascFrontendData(bundle);
|
||||
vascFrontendData.addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.EXCEPTION};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
if (data instanceof Exception) {
|
||||
((Exception)data).printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// config frontend data for ISF usage
|
||||
if (getDisableI18N()) {
|
||||
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver());
|
||||
} else {
|
||||
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(bundle));
|
||||
}
|
||||
return vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
if (vascController!=null) {
|
||||
return vascController;
|
||||
}
|
||||
try {
|
||||
// get local jvm plugging controller
|
||||
VascUserInfo vui = getVascUserInfo();
|
||||
VascController c = DefaultVascFactory.getDefaultVascController(vui.userId, vui.username, vui.roles);
|
||||
|
||||
// Load vasc resources
|
||||
for (String res:getVascParseResources()) {
|
||||
VascParser vp = new VascParser(c);
|
||||
for (String name:vascGlobalELBeans.keySet()) {
|
||||
Object value = vascGlobalELBeans.get(name);
|
||||
vp.addGlobalELBean(name, value);
|
||||
}
|
||||
vp.parseResource(res);
|
||||
}
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) c.getVascEntryController(), c);
|
||||
|
||||
vascController = c;
|
||||
return vascController;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not create remote based vasc controller; "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -85,6 +85,6 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
|
|||
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tableDataModel.wrappedData}", Object.class);
|
||||
ve2.setValue(FacesContext.getCurrentInstance().getELContext(), result);
|
||||
ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tablePagesDataModel.wrappedData}", Object.class);
|
||||
ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascFrontendHelper().getVascBackendPageNumbers(entry));
|
||||
ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascFrontendPager().getTablePagesFromBackend());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,18 +47,16 @@ import javax.faces.model.SelectItem;
|
|||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.forwardfire.vasc.core.VascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascLinkEntry;
|
||||
import net.forwardfire.vasc.core.VascLinkEntryType;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.EditRowAction;
|
||||
|
|
@ -106,7 +104,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
editSelectItemModels = new HashMap<String,Object>(6);
|
||||
|
||||
// cache some values
|
||||
VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend();;
|
||||
VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend();
|
||||
backendPageable = backend.isPageable();
|
||||
backendMoveable = backend.isRecordMoveable();
|
||||
backendSearchable = backend.isSearchable();
|
||||
|
|
@ -136,40 +134,11 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
}
|
||||
|
||||
public String getParentSelectedDisplayName() {
|
||||
if (entry.getVascFrontendData().getVascEntryState().getParent()==null) {
|
||||
return ""; // no parent
|
||||
}
|
||||
|
||||
VascEntry parent = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry();
|
||||
Object row = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataObject();
|
||||
if (row==null) {
|
||||
return "no-selection";
|
||||
}
|
||||
VascEntryField v = parent.getVascEntryFieldById(parent.getDisplayNameFieldId());
|
||||
VascEntryFieldValue ve = v.getVascEntryFieldValue();
|
||||
String result = "no-data";
|
||||
try {
|
||||
result = ve.getDisplayValue(v, row);
|
||||
} catch (VascException e) {
|
||||
throw new RuntimeException("Could not get parent name DisplayValue: "+e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendHelper().getParentSelectedDisplayName(entry);
|
||||
}
|
||||
|
||||
public String getSelectedDisplayName() {
|
||||
Object row = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
if (row==null) {
|
||||
return "no-selection";
|
||||
}
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
VascEntryFieldValue ve = v.getVascEntryFieldValue();
|
||||
String result = "no-data";
|
||||
try {
|
||||
result = ve.getDisplayValue(v, row);
|
||||
} catch (VascException e) {
|
||||
throw new RuntimeException("Could not get selected name DisplayValue: "+e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendHelper().getSelectedDisplayName(entry);
|
||||
}
|
||||
|
||||
public int getTotalColumnCount() {
|
||||
|
|
@ -227,26 +196,14 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
|
||||
|
||||
public long getPageTotalRecordCount() {
|
||||
long result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getPageTotalRecordCount();
|
||||
}
|
||||
|
||||
public long getPageStartCount() {
|
||||
int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
|
||||
long result = index*pageSize;
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getPageStartCount();
|
||||
}
|
||||
public long getPageStopCount() {
|
||||
int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
|
||||
long result = (index*pageSize)+pageSize;
|
||||
|
||||
// limit for small result sets.
|
||||
if (result>entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords()) {
|
||||
result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
|
||||
}
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getPageStopCount();
|
||||
}
|
||||
|
||||
public List<SelectItem> getGlobalExportItems() {
|
||||
|
|
@ -294,99 +251,27 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
}
|
||||
|
||||
public boolean getHasOnlySinglePage() {
|
||||
int pages = getTablePagesDataModel().getRowCount();
|
||||
if (pages==1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getHasOnlySinglePage();
|
||||
}
|
||||
|
||||
public boolean getHasExtendedPageMode() {
|
||||
int pages = getTablePagesDataModel().getRowCount();
|
||||
if (pages>13) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getHasExtendedPageMode();
|
||||
}
|
||||
|
||||
public boolean getHasExtendedPageModeCenter() {
|
||||
if (getHasExtendedPageMode()==false) {
|
||||
return false;
|
||||
}
|
||||
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (page<5) {
|
||||
return false;
|
||||
}
|
||||
int pages = getTablePagesDataModel().getRowCount();
|
||||
if (page>pages-6) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getHasExtendedPageModeCenter();
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedBegin() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
|
||||
getTablePagesDataModel().setRowIndex(0);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
getTablePagesDataModel().setRowIndex(1);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
getTablePagesDataModel().setRowIndex(2);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
|
||||
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (page==2 | page==3 | page==4) {
|
||||
getTablePagesDataModel().setRowIndex(3);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
}
|
||||
if (page==3 | page==4) {
|
||||
getTablePagesDataModel().setRowIndex(4);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
}
|
||||
if (page==4) {
|
||||
getTablePagesDataModel().setRowIndex(5);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
}
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getTablePagesExtendedBegin();
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedEnd() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
|
||||
int pages = getTablePagesDataModel().getRowCount();
|
||||
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
int off = pages-page;
|
||||
|
||||
if (off==5) {
|
||||
getTablePagesDataModel().setRowIndex(pages-6);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
}
|
||||
if (off==4 | off==5) {
|
||||
getTablePagesDataModel().setRowIndex(pages-5);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
}
|
||||
if (off==3 | off==4 | off==5) {
|
||||
getTablePagesDataModel().setRowIndex(pages-4);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
}
|
||||
|
||||
getTablePagesDataModel().setRowIndex(pages-3);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
getTablePagesDataModel().setRowIndex(pages-2);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
getTablePagesDataModel().setRowIndex(pages-1);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getTablePagesExtendedEnd();
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedCenter() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(3);
|
||||
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
getTablePagesDataModel().setRowIndex(page-1);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
getTablePagesDataModel().setRowIndex(page);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
getTablePagesDataModel().setRowIndex(page+1);
|
||||
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
|
||||
return result;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getTablePagesExtendedCenter();
|
||||
}
|
||||
|
||||
private String getComponentType(UIComponent comp) {
|
||||
|
|
@ -544,12 +429,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
logger.fine("searchAction");
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
entry.getVascFrontendData().getVascFrontendHelper().searchAction(entry, searchString);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendData().getVascFrontendActions().searchAction(searchString);
|
||||
}
|
||||
|
||||
public void sortAction(ActionEvent event) {
|
||||
|
|
@ -558,17 +438,9 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
VascEntryField field = entry.getVascEntryFieldById(fieldIdString);
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field);
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendActions().sortAction(field);
|
||||
sortOrder = entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending();
|
||||
sortField = field.getId();
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getRenderBackAction() {
|
||||
|
|
@ -613,12 +485,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
selectedDirectPage=pageIndex+"";
|
||||
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex);
|
||||
}
|
||||
|
||||
public void pageNextAction(ActionEvent event) {
|
||||
|
|
@ -629,7 +496,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
pageIndex++;
|
||||
selectedDirectPage=pageIndex+"";
|
||||
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex);
|
||||
entry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -645,7 +512,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
pageIndex--;
|
||||
selectedDirectPage=pageIndex+"";
|
||||
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex);
|
||||
entry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -654,25 +521,11 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
}
|
||||
|
||||
public boolean getHasPageNextAction() {
|
||||
VascEntry entry = getVascEntry();
|
||||
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
pageIndex++;
|
||||
// copyed from helper
|
||||
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
|
||||
logger.finer("Checking has next action for next pageIndex"+pageIndex+" of total: "+total+" and pageSize: "+entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize());
|
||||
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getHasPageNextAction();
|
||||
}
|
||||
|
||||
public boolean getHasPagePreviousAction() {
|
||||
VascEntry entry = getVascEntry();
|
||||
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (pageIndex==0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return entry.getVascFrontendData().getVascFrontendPager().getHasPagePreviousAction();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -751,15 +604,10 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
|
||||
Object selected = comp.getSupportBean().getSelectedTableRecord().getRecord();
|
||||
if ("up".equals(moveAction)) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,true);
|
||||
entry.getVascFrontendData().getVascFrontendActions().moveUpAction(selected);
|
||||
}
|
||||
if ("down".equals(moveAction)) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,false);
|
||||
}
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
entry.getVascFrontendData().getVascFrontendActions().moveDownAction(selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -834,7 +682,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
*/
|
||||
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(selected.getRecord());
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
|
|
@ -861,11 +709,11 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
if (sels.isEmpty()==false) {
|
||||
for (Object row:sels) {
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(row);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().deleteObject();
|
||||
}
|
||||
state.getMultiActionSelection().clear(); // after down deselect all options
|
||||
} else {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().deleteObject();
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -956,7 +804,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
//selectedDirectPage = "null";
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, new Integer(id));
|
||||
entry.getVascFrontendData().getVascFrontendActions().pageAction(new Integer(id));
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ import java.util.logging.Logger;
|
|||
import javax.faces.component.UIViewRoot;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFBoolean;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFLabel;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFList;
|
||||
|
|
@ -58,7 +58,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
// Frontend Stuff
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#getFrontendType()
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "jsf";
|
||||
|
|
@ -83,7 +83,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderDelete(java.lang.Object)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderDelete(java.lang.Object)
|
||||
*/
|
||||
public void renderDelete() throws Exception {
|
||||
logger.finer("renderDelete");
|
||||
|
|
@ -93,7 +93,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderEdit(java.lang.Object)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderEdit(java.lang.Object)
|
||||
*/
|
||||
public void renderEdit() throws Exception {
|
||||
logger.finer("renderEdit");
|
||||
|
|
@ -115,7 +115,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
||||
*/
|
||||
public void renderExport(VascEntryExporter exporter) throws Exception {
|
||||
logger.finer("renderExport");
|
||||
|
|
@ -126,7 +126,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderView()
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderView()
|
||||
*/
|
||||
public void renderView() throws Exception {
|
||||
logger.finer("renderView");
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@ import javax.faces.component.UIComponent;
|
|||
import javax.faces.component.UIComponentBase;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import net.forwardfire.vasc.core.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.core.VascLinkEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFListModel;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
try {
|
||||
VascEntry entry = supportBean.getVascEntry();
|
||||
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.SELECT, rowObject);
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry, VascFrontendEventType.SELECT, rowObject);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -339,10 +339,9 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
if (entry==null) {
|
||||
throw new NullPointerException("Could not locate '"+entryName+"' from : "+vascController);
|
||||
}
|
||||
|
||||
frontendData.setVascFrontend(null); // reset data obj. todo rm this.
|
||||
frontendData.setVascController(vascController);
|
||||
entry.setVascFrontendData(frontendData);
|
||||
DefaultVascFactory.fillVascEntryFrontend(entry, vascController, frontendData);
|
||||
|
||||
try {
|
||||
frontendData.initFrontendListeners(entry,"jsf");
|
||||
} catch (InstantiationException e1) {
|
||||
|
|
@ -352,9 +351,6 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
|
||||
frontendData.getVascEntryState().setVascBackend(backend);
|
||||
frontendData.getVascEntryState().setVascEntry(entry);
|
||||
|
||||
if (state!=null) {
|
||||
// copy prevois parent
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import javax.faces.component.UIColumn;
|
|||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIInput;
|
||||
import javax.faces.component.UIOutput;
|
||||
import javax.faces.component.UISelectMany;
|
||||
import javax.faces.component.UIViewRoot;
|
||||
import javax.faces.component.html.HtmlCommandLink;
|
||||
import javax.faces.component.html.HtmlInputText;
|
||||
|
|
@ -177,12 +176,10 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
}
|
||||
|
||||
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
|
||||
int column = 0;
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) {
|
||||
continue;
|
||||
}
|
||||
//System.out.println("Multi edit size: "+c.getVascEntryFieldType().getUIComponentCount(c)+" of: "+c.getVascEntryFieldType());
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
|
|
@ -217,8 +214,7 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
|
||||
grid.getChildren().add(message);
|
||||
|
||||
column++;
|
||||
|
||||
//column++;
|
||||
// i==0 is for multi field editor support... which is still very in progress
|
||||
if (i==0) {
|
||||
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,jsfEdit);
|
||||
|
|
|
|||
|
|
@ -59,14 +59,16 @@ import javax.faces.validator.ValidatorException;
|
|||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.core.VascBackend;
|
||||
import net.forwardfire.vasc.core.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyFilter;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyPaged;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxySearch;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxySort;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascFrontendData;
|
||||
import net.forwardfire.vasc.core.VascLinkEntry;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
|
|
@ -76,15 +78,13 @@ import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
|||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFBoolean;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFLabel;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFList;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFText;
|
||||
import net.forwardfire.vasc.frontends.web.jsf.ui.JSFTextArea;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxyFilter;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxyPaged;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxySearch;
|
||||
import net.forwardfire.vasc.impl.VascBackendProxySort;
|
||||
|
||||
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
index++;
|
||||
}
|
||||
tableDataModel.setWrappedData(result);
|
||||
pagesDataModel.setWrappedData(entry.getVascFrontendData().getVascFrontendHelper().getVascBackendPageNumbers(entry));
|
||||
pagesDataModel.setWrappedData(entry.getVascFrontendData().getVascFrontendPager().getTablePagesFromBackend());
|
||||
|
||||
// ui value
|
||||
ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalPageResults']}", Integer.class);
|
||||
|
|
@ -1041,7 +1041,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
public void processAction(ActionEvent event) {
|
||||
OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent());
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().deleteObject();
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1060,7 +1060,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(editObject.getRecord());
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1075,7 +1075,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent());
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex);
|
||||
entry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1091,7 +1091,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
VascEntry entry = comp.getVascEntry();
|
||||
VascEntryField field = entry.getVascEntryFieldById(fieldIdString);
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field);
|
||||
entry.getVascFrontendData().getVascFrontendActions().sortAction(field);
|
||||
|
||||
ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']}", Boolean.class);
|
||||
ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortField']}", String.class);
|
||||
|
|
@ -1114,7 +1114,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.searchString}", String.class);
|
||||
String ss = (String)ve3.getValue(FacesContext.getCurrentInstance().getELContext());
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().searchAction(entry, ss);
|
||||
entry.getVascFrontendData().getVascFrontendActions().searchAction(ss);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1130,10 +1130,10 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
VascEntry entry = comp.getVascEntry();
|
||||
Object selected = comp.getSelectedTableObject();
|
||||
if ("up".equals(to)) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,true);
|
||||
entry.getVascFrontendData().getVascFrontendActions().moveUpAction(selected);
|
||||
}
|
||||
if ("down".equals(to)) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,false);
|
||||
entry.getVascFrontendData().getVascFrontendActions().moveDownAction(selected);
|
||||
}
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
|
|
@ -1596,7 +1596,7 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#getFrontendType()
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "jsf";
|
||||
|
|
@ -1622,7 +1622,7 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderDelete(java.lang.Object)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderDelete(java.lang.Object)
|
||||
*/
|
||||
public void renderDelete() throws Exception {
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
|
|
@ -1633,7 +1633,7 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderEdit(java.lang.Object)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderEdit(java.lang.Object)
|
||||
*/
|
||||
public void renderEdit() throws Exception {
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
|
|
@ -1659,7 +1659,7 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
||||
*/
|
||||
public void renderExport(VascEntryExporter exporter) throws Exception {
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
|
|
@ -1672,7 +1672,7 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascFrontend#renderView()
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderView()
|
||||
*/
|
||||
public void renderView() throws Exception {
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
*/
|
||||
public class VascRequestFacesFilter implements Filter {
|
||||
|
||||
private static final long serialVersionUID = 10l;
|
||||
private Logger logger = null;
|
||||
private String templateFile = null;
|
||||
private ServletContext servletContext = null;
|
||||
|
|
@ -77,7 +76,7 @@ public class VascRequestFacesFilter implements Filter {
|
|||
if (templateFile==null) {
|
||||
throw new ServletException("No templateFile init-param found.");
|
||||
}
|
||||
String resourceBundle=config.getInitParameter("resourceBundle");
|
||||
resourceBundle=config.getInitParameter("resourceBundle");
|
||||
if (resourceBundle==null) {
|
||||
throw new ServletException("No resourceBundle init-param found.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue