deleted renamed files.
This commit is contained in:
parent
6ccd763d1f
commit
d4e537a2bf
|
@ -1,235 +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.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.validators.VascValidator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 2, 2007
|
||||
*/
|
||||
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String id = null;
|
||||
protected Class<?> autoDetectClass = null;
|
||||
protected List<VascValidator> vascValidators = null;
|
||||
protected Map<String,String> properties = null;
|
||||
protected ObjectConverter objectConverter = null;
|
||||
|
||||
protected Object dataObject = null;
|
||||
protected String uiComponentId = null;
|
||||
protected String inputMask = null;
|
||||
|
||||
public AbstractVascEntryFieldType() {
|
||||
vascValidators = new ArrayList<VascValidator>(4);
|
||||
properties = new HashMap<String,String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
abstract public VascEntryFieldType clone() throws CloneNotSupportedException;
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#setId(java.lang.String)
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getProperty(java.lang.String)
|
||||
*/
|
||||
public String getProperty(String name) {
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void setProperty(String name, String value) {
|
||||
properties.put(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getPropertyNames()
|
||||
*/
|
||||
public List<String> getPropertyNames() {
|
||||
return new ArrayList<String>(properties.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataObject
|
||||
*/
|
||||
public Object getDataObject() {
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataObject the dataObject to set
|
||||
*/
|
||||
public void setDataObject(Object dataObject) {
|
||||
this.dataObject = dataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getVascValidators()
|
||||
*/
|
||||
public List<VascValidator> getVascValidators() {
|
||||
return vascValidators;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#addVascValidator(net.forwardfire.vasc.validators.VascValidator)
|
||||
*/
|
||||
public void addVascValidator(VascValidator vascValidator) {
|
||||
vascValidators.add(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#removeVascValidator(net.forwardfire.vasc.validators.VascValidator)
|
||||
*/
|
||||
public void removeVascValidator(VascValidator vascValidator) {
|
||||
vascValidators.remove(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getAutoDetectClass()
|
||||
*/
|
||||
public Class<?> getAutoDetectClass() {
|
||||
return autoDetectClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#setAutoDetectClass(java.lang.Class)
|
||||
*/
|
||||
public void setAutoDetectClass(Class<?> classObject) {
|
||||
if (classObject==null) {
|
||||
throw new NullPointerException("Can't add null classObject to fieldtype.");
|
||||
}
|
||||
autoDetectClass=classObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getInputMask()
|
||||
*/
|
||||
public String getInputMask() {
|
||||
return inputMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#setInputMask(java.lang.String)
|
||||
*/
|
||||
public void setInputMask(String inputMask) {
|
||||
this.inputMask=inputMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getUIComponentId()
|
||||
*/
|
||||
public String getUIComponentId() {
|
||||
return uiComponentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#setUIComponentId(java.lang.String)
|
||||
*/
|
||||
public void setUIComponentId(String uiComponentId) {
|
||||
this.uiComponentId=uiComponentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#getUIComponentCount()
|
||||
*/
|
||||
public int getUIComponentCount(VascEntryField entryField) throws VascException {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#provideEditorUIComponent(int)
|
||||
*/
|
||||
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = entryField.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String compId = getUIComponentId();
|
||||
if (compId==null) {
|
||||
compId = VascUIComponent.VASC_TEXT;
|
||||
}
|
||||
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#provideLabelUIComponent(int)
|
||||
*/
|
||||
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException {
|
||||
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryFieldType#provideEditorVascValueModel()
|
||||
*/
|
||||
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException {
|
||||
if (index>0) {
|
||||
throw new IllegalArgumentException("You have to override provideEditorVascValueModel if multi editor support is needed");
|
||||
}
|
||||
VascValueModel model = new VascValueModel();
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the objectConverter
|
||||
*/
|
||||
public ObjectConverter getObjectConverter() {
|
||||
return objectConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objectConverter the objectConverter to set
|
||||
*/
|
||||
public void setObjectConverter(ObjectConverter objectConverter) {
|
||||
this.objectConverter = objectConverter;
|
||||
}
|
||||
}
|
|
@ -1,112 +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.core;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* VascLinkEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 7, 2008
|
||||
*/
|
||||
public interface VascLinkEntry extends Cloneable,Serializable {
|
||||
|
||||
|
||||
public String getEntryParameterFieldId(String parameterName);
|
||||
public void addEntryParameterFieldId(String parameterName,String valueFieldId);
|
||||
public List<String> getEntryParameterFieldIdKeys();
|
||||
|
||||
public String getEntryCreateFieldValue(String valueFieldId);
|
||||
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId);
|
||||
public List<String> getEntryCreateFieldValueKeys();
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id);
|
||||
|
||||
/**
|
||||
* @return the vascEntryId
|
||||
*/
|
||||
public String getVascEntryId();
|
||||
|
||||
/**
|
||||
* @param vascEntryId the vascEntryId to set
|
||||
*/
|
||||
public void setVascEntryId(String vascEntryId);
|
||||
|
||||
/**
|
||||
* @return the vascLinkEntryType
|
||||
*/
|
||||
public VascLinkEntryType getVascLinkEntryType();
|
||||
|
||||
/**
|
||||
* @param vascLinkEntryType the vascLinkEntryType to set
|
||||
*/
|
||||
public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType);
|
||||
|
||||
/**
|
||||
* @return the doActionId
|
||||
*/
|
||||
public String getDoActionId();
|
||||
|
||||
/**
|
||||
* @param doActionId the doActionId to set
|
||||
*/
|
||||
public void setDoActionId(String doActionId);
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name);
|
||||
|
||||
/**
|
||||
* @return the helpId
|
||||
*/
|
||||
public String getHelpId();
|
||||
|
||||
/**
|
||||
* @param helpId the helpId to set
|
||||
*/
|
||||
public void setHelpId(String helpId);
|
||||
|
||||
/**
|
||||
* Force impl to have public clone methode
|
||||
* @return
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
public VascLinkEntry clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -1,40 +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.core;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The type of a VascLinkEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mrt 16, 2010
|
||||
*/
|
||||
public enum VascLinkEntryType implements Serializable {
|
||||
|
||||
EDIT_INLINE,
|
||||
EDIT_TAB,
|
||||
LIST;
|
||||
|
||||
public static VascLinkEntryType DEFAULT_TYPE = VascLinkEntryType.EDIT_TAB;
|
||||
}
|
|
@ -1,42 +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.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 19, 2008
|
||||
*/
|
||||
public interface VascUserRoleController {
|
||||
|
||||
public Long getUserId();
|
||||
|
||||
public String getUserName();
|
||||
|
||||
public List<String> getUserRoles();
|
||||
|
||||
public boolean hasRole(String roles);
|
||||
}
|
|
@ -1,130 +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.core.actions;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 30, 2007
|
||||
*/
|
||||
abstract public class AbstractVascAction implements VascAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private String image = null;
|
||||
private String helpId = null;
|
||||
|
||||
public AbstractVascAction() {
|
||||
setId(getActionId());
|
||||
}
|
||||
|
||||
abstract protected String getActionId();
|
||||
|
||||
public VascAction clone() throws CloneNotSupportedException {
|
||||
VascAction action;
|
||||
try {
|
||||
action = this.getClass().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new CloneNotSupportedException("Could not create action from myClass: "+e.getMessage());
|
||||
}
|
||||
action.setId(id);
|
||||
action.setName(name);
|
||||
action.setDescription(description);
|
||||
action.setImage(image);
|
||||
action.setHelpId(helpId);
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.actions.VascAction#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.actions.VascAction#setId(java.lang.String)
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description description toolTip to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the helpId
|
||||
*/
|
||||
public String getHelpId() {
|
||||
return helpId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param helpId the helpId to set
|
||||
*/
|
||||
public void setHelpId(String helpId) {
|
||||
this.helpId = helpId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the image
|
||||
*/
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param image the image to set
|
||||
*/
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
}
|
|
@ -1,134 +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.frontend;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.entry.VascEntryFieldValidatorService;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryResourceImageResolver;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryResourceResolver;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascFrontendData {
|
||||
|
||||
/**
|
||||
* @return the vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend();
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend);
|
||||
|
||||
/**
|
||||
* Gets the VascFrontendActions to make frontend actions simple.
|
||||
*/
|
||||
public VascFrontendActions getVascFrontendActions();
|
||||
|
||||
/**
|
||||
* @param vascFrontendActions the vascFrontendActions to set
|
||||
*/
|
||||
public void setVascFrontendActions(VascFrontendActions vascFrontendActions);
|
||||
|
||||
/**
|
||||
* @return the vascFrontendPager
|
||||
*/
|
||||
public VascFrontendPager getVascFrontendPager();
|
||||
|
||||
/**
|
||||
* @param vascFrontendPager the vascFrontendPager to set
|
||||
*/
|
||||
public void setVascFrontendPager(VascFrontendPager vascFrontendPager);
|
||||
|
||||
/**
|
||||
* @return the VascFrontendHelper
|
||||
*/
|
||||
public VascFrontendHelper getVascFrontendHelper();
|
||||
|
||||
/**
|
||||
* @param vascFrontendHelper The VascFrontendHelper to set.
|
||||
*/
|
||||
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper);
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver();
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
|
||||
|
||||
|
||||
public void putVascUIComponent(String rendererId,String uiComponentClass);
|
||||
|
||||
public VascUIComponent getVascUIComponent(String rendererId) throws VascException;
|
||||
public String getVascUIComponentClass(String rendererId);
|
||||
|
||||
public void setVascController(VascController vascController);
|
||||
|
||||
public VascController getVascController();
|
||||
|
||||
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent,Object editor);
|
||||
public VascUIComponent getFieldVascUIComponent(VascEntryField field);
|
||||
public Object getFieldRealRenderer(VascEntryField field);
|
||||
public void clearFieldRenderObjects();
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceImageResolver
|
||||
*/
|
||||
public VascEntryResourceImageResolver getVascEntryResourceImageResolver();
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver);
|
||||
|
||||
public void addVascValidatorService(VascEntryFieldValidatorService validatorService);
|
||||
public List<VascEntryFieldValidatorService> getVascValidatorServices();
|
||||
|
||||
public VascEntryState getVascEntryState();
|
||||
public void setVascEntryState(VascEntryState state);
|
||||
|
||||
public void initFrontendListeners(VascEntry entry,String frontendType) throws InstantiationException, IllegalAccessException;
|
||||
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
|
||||
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
|
||||
public void fireVascFrontendEvent(VascEntry entry,VascFrontendEventType type,Object data);
|
||||
}
|
|
@ -1,318 +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.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.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.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendActions;
|
||||
|
||||
|
||||
/**
|
||||
* Default impl of default frontend actions
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 22, 2012
|
||||
*/
|
||||
public class DefaultVascFrontendActions implements VascFrontendActions {
|
||||
|
||||
private Logger logger = Logger.getLogger(DefaultVascFrontendActions.class.getName());
|
||||
private VascEntry entry = null;
|
||||
|
||||
public DefaultVascFrontendActions(VascEntry entry) {
|
||||
this.entry=entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#initEditObject(net.forwardfire.vasc.core.VascEntry)
|
||||
*/
|
||||
public Object createObject() {
|
||||
try {
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE, null);
|
||||
Object object = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(entry.clone()).newRecord(entry);
|
||||
if (object==null) {
|
||||
throw new IllegalStateException("Can't work with null object for backend storage.");
|
||||
}
|
||||
for (VascEntryField field:entry.getVascEntryFields()) {
|
||||
if (field.getDefaultValue()==null) {
|
||||
continue; // no default value to set.
|
||||
}
|
||||
Object value = field.getVascEntryFieldValue().getValue(field, object);
|
||||
if (value!=null) {
|
||||
continue; // value is already set by backend creator.
|
||||
}
|
||||
Object defaultValue = field.getDefaultValue();
|
||||
if (defaultValue instanceof String) {
|
||||
String def = (String)defaultValue;
|
||||
if (def.equals("now()")) { // TODO: add default string parsers
|
||||
defaultValue = new Date();
|
||||
}
|
||||
}
|
||||
logger.finer("Setting default value for: "+field.getName()+" def: "+defaultValue);
|
||||
field.getVascEntryFieldValue().setValue(field, object, defaultValue);
|
||||
}
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_CREATE, object);
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
return null; /// ?? ,,
|
||||
}
|
||||
}
|
||||
|
||||
protected int removeObjectFromDataList(Object object) {
|
||||
int indexOld = entry.getVascFrontendData().getVascEntryState().getEntryDataList().indexOf(object);
|
||||
if (entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(object)) {
|
||||
return indexOld; // java worked well for use
|
||||
}
|
||||
|
||||
// remove only work on (jpa)beans with an overrided equals method.
|
||||
// we lets do the search ourselfs here because we should know the primary key value
|
||||
try {
|
||||
VascEntryField field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object idObject = field.getVascEntryFieldValue().getValue(field, object);
|
||||
|
||||
// is only null when creating objects
|
||||
if (idObject!=null) {
|
||||
int index = 0;
|
||||
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
|
||||
field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object id = field.getVascEntryFieldValue().getValue(field, o);
|
||||
if (idObject.equals(id)) {
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (index<entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()) {
|
||||
entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(index);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
} catch (VascException e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
}
|
||||
return 0; // make better (0=top of list)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendActions#persistObject()
|
||||
*/
|
||||
public void persistObject() {
|
||||
saveObject(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendActions#mergeObject()
|
||||
*/
|
||||
public Object mergeObject() {
|
||||
return saveObject(false);
|
||||
}
|
||||
|
||||
protected Object saveObject(boolean persist) {
|
||||
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
Object result = null;
|
||||
try {
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
|
||||
int index = removeObjectFromDataList(object);
|
||||
|
||||
// save object on backend
|
||||
if (persist) {
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackend().persist(object);
|
||||
} else {
|
||||
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
|
||||
}
|
||||
|
||||
// put object thrue the filters
|
||||
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
|
||||
result = filter.filterObject(result);
|
||||
}
|
||||
|
||||
// put object back in list
|
||||
entry.getVascFrontendData().getVascEntryState().getEntryDataList().add(index, result);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE,result);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the selected row object from the back-end and list and fires events.
|
||||
* @param entry
|
||||
* @param object
|
||||
*/
|
||||
public void deleteObject() {
|
||||
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_DELETE, object);
|
||||
try {
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackend().delete(object);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
}
|
||||
removeObjectFromDataList(object);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_DELETE, object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#refreshData(net.forwardfire.vasc.core.VascEntry)
|
||||
*/
|
||||
public void refreshData() {
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_READ, null);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
|
||||
VascBackendState backendState = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
|
||||
try {
|
||||
// check and correct max page size
|
||||
if (backendState.getPageSize() > backendState.getPageSizeMax()) {
|
||||
backendState.setPageSize(backendState.getPageSizeMax());
|
||||
}
|
||||
// Sets parameters to backend state
|
||||
for (String key:entry.getEntryParameterKeys()) {
|
||||
Object value = entry.getEntryParameter(key);
|
||||
backendState.setDataParameter(key, value);
|
||||
}
|
||||
|
||||
// Execute to get data.
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataList(entry.getVascFrontendData().getVascEntryState().getVascBackend().execute(backendState));
|
||||
|
||||
// Update total every time first
|
||||
Long total = entry.getVascFrontendData().getVascEntryState().getVascBackend().fetchTotalExecuteSize(backendState);
|
||||
entry.getVascFrontendData().getVascEntryState().setTotalBackendRecords(total);
|
||||
|
||||
// check if we need to change the current page
|
||||
int pages = new Long(total/backendState.getPageSize()).intValue();
|
||||
if (backendState.getPageIndex() > pages) {
|
||||
backendState.setPageIndex(pages);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataList(entry.getVascFrontendData().getVascEntryState().getVascBackend().execute(backendState));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_READ, null);
|
||||
}
|
||||
|
||||
|
||||
public void sortAction(VascEntryField field) {
|
||||
String curSort = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSortField();
|
||||
if (field.getBackendName().equals(curSort)) {
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortAscending(!entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending());
|
||||
}
|
||||
String sortID = field.getBackendName();
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(sortID);
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.SORT, field);
|
||||
|
||||
refreshData();
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void searchAction(String searchString) {
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSearchString(searchString);
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(null);
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.SEARCH, searchString);
|
||||
|
||||
refreshData();
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void pageAction(Integer pageIndex) {
|
||||
if (pageIndex<1) {
|
||||
pageIndex = 0;
|
||||
}
|
||||
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); // note: total is only null when pageAction is done before first refresh, which should never happen anyway.
|
||||
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
|
||||
pageIndex = new Long(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()).intValue();
|
||||
}
|
||||
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(pageIndex);
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PAGE, pageIndex);
|
||||
|
||||
// lets load data;
|
||||
refreshData();
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void moveUpAction(Object record) {
|
||||
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
|
||||
try {
|
||||
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveUpById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
|
||||
// lets load data;
|
||||
refreshData();
|
||||
}
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void moveDownAction(Object record) {
|
||||
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
|
||||
try {
|
||||
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveDownById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
// lets load data;
|
||||
refreshData();
|
||||
}
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,365 +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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
|
||||
import net.forwardfire.vasc.core.VascEntryState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.actions.ColumnVascAction;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.actions.VascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryResourceImageResolver;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryResourceResolver;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.frontend.VascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendActions;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendHelper;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPager;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Stores state data for the frontend
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class DefaultVascFrontendData implements VascFrontendData {
|
||||
|
||||
private VascFrontend vascFrontend = null;
|
||||
private VascFrontendActions vascFrontendActions = null;
|
||||
private VascFrontendPager vascFrontendPager = null;
|
||||
private VascEntryConfigFinalizer vascEntryFinalizer = null;
|
||||
private VascFrontendHelper vascFrontendHelper = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
private VascEntryResourceImageResolver vascEntryResourceImageResolver = null;
|
||||
private Map<String,String> uiComponents = null;
|
||||
private VascController vascController = null;
|
||||
private Map<VascEntryFrontendEventListener.VascFrontendEventType,List<VascEntryFrontendEventListener>> vascEntryFrontendEventListeners = null;
|
||||
private VascEntryState state = null;
|
||||
|
||||
|
||||
private Map<VascEntryField,VascUIComponent> fieldComps = null;
|
||||
private Map<VascEntryField,Object> fieldEditors = null;
|
||||
private List<VascEntryFieldValidatorService> validatorServices = null;
|
||||
|
||||
public DefaultVascFrontendData() {
|
||||
uiComponents = new HashMap<String,String>(8);
|
||||
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
|
||||
fieldEditors = new HashMap<VascEntryField,Object>(8);
|
||||
validatorServices = new ArrayList<VascEntryFieldValidatorService>(4);
|
||||
vascEntryFrontendEventListeners = new HashMap<VascEntryFrontendEventListener.VascFrontendEventType,List<VascEntryFrontendEventListener>>(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend() {
|
||||
return vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend) {
|
||||
this.vascFrontend = vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendActions
|
||||
*/
|
||||
public VascFrontendActions getVascFrontendActions() {
|
||||
return vascFrontendActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendActions the vascFrontendActions to set
|
||||
*/
|
||||
public void setVascFrontendActions(VascFrontendActions vascFrontendActions) {
|
||||
this.vascFrontendActions = vascFrontendActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendPager
|
||||
*/
|
||||
public VascFrontendPager getVascFrontendPager() {
|
||||
return vascFrontendPager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendPager the vascFrontendPager to set
|
||||
*/
|
||||
public void setVascFrontendPager(VascFrontendPager vascFrontendPager) {
|
||||
this.vascFrontendPager = vascFrontendPager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascBackendData#getVascEntryFinalizer()
|
||||
*/
|
||||
public VascEntryConfigFinalizer getVascEntryFinalizer() {
|
||||
return vascEntryFinalizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascBackendData#setVascEntryFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer)
|
||||
*/
|
||||
public void setVascEntryFinalizer(VascEntryConfigFinalizer vascEntryFinalizer) {
|
||||
this.vascEntryFinalizer=vascEntryFinalizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendHelper
|
||||
*/
|
||||
public VascFrontendHelper getVascFrontendHelper() {
|
||||
return vascFrontendHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendHelper the vascFrontendHelper to set
|
||||
*/
|
||||
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper) {
|
||||
this.vascFrontendHelper = vascFrontendHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver() {
|
||||
return vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
|
||||
this.vascEntryResourceResolver = vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
|
||||
public VascUIComponent getVascUIComponent(String rendererId) throws VascException {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = rendererId.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String componentClass = getVascUIComponentClass(rendererId);
|
||||
if (componentClass==null) {
|
||||
|
||||
// TODO: auto wire text <-> object converts
|
||||
|
||||
componentClass = getVascUIComponentClass(VascUIComponent.VASC_TEXT);
|
||||
}
|
||||
if (componentClass==null) {
|
||||
throw new VascException("No component Class found for frontend UIComponent: "+rendererId);
|
||||
}
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#getVascUIComponent(java.lang.String)
|
||||
*/
|
||||
public String getVascUIComponentClass(String rendererId) {
|
||||
return uiComponents.get(rendererId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#putVascUIComponent(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void putVascUIComponent(String rendererId, String uiComponentClass) {
|
||||
uiComponents.put(rendererId, uiComponentClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascController the vascController to set
|
||||
*/
|
||||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#addFieldVascUIComponents(net.forwardfire.vasc.core.VascEntryField, net.forwardfire.vasc.core.ui.VascUIComponent, java.lang.Object)
|
||||
*/
|
||||
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent, Object editor) {
|
||||
fieldComps.put(field, uiComponent);
|
||||
fieldEditors.put(field, editor);
|
||||
}
|
||||
|
||||
public void clearFieldRenderObjects() {
|
||||
fieldComps.clear();
|
||||
fieldEditors.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#getFieldRealRenderer(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public Object getFieldRealRenderer(VascEntryField field) {
|
||||
return fieldEditors.get(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#getFieldVascUIComponent(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascUIComponent getFieldVascUIComponent(VascEntryField field) {
|
||||
return fieldComps.get(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceImageResolver
|
||||
*/
|
||||
public VascEntryResourceImageResolver getVascEntryResourceImageResolver() {
|
||||
return vascEntryResourceImageResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver) {
|
||||
this.vascEntryResourceImageResolver = vascEntryResourceImageResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#addVascValidatorService(net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService)
|
||||
*/
|
||||
public void addVascValidatorService(VascEntryFieldValidatorService validatorService) {
|
||||
validatorServices.add(validatorService);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendData#getVascValidatorServices()
|
||||
*/
|
||||
public List<VascEntryFieldValidatorService> getVascValidatorServices() {
|
||||
return validatorServices;
|
||||
}
|
||||
|
||||
public VascEntryState getVascEntryState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setVascEntryState(VascEntryState state) {
|
||||
this.state=state;
|
||||
}
|
||||
|
||||
|
||||
public void initFrontendListeners(VascEntry entry,String frontendType) throws InstantiationException, IllegalAccessException {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl==null) {
|
||||
cl = entry.getClass().getClassLoader();
|
||||
}
|
||||
for (String clazz:entry.getVascEntryFrontendEventListenersByType(frontendType)) {
|
||||
VascEntryFrontendEventListener listener;
|
||||
try {
|
||||
listener = (VascEntryFrontendEventListener)cl.loadClass(clazz).newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException("Could not load VascEntryFrontendEventListener of: "+clazz);
|
||||
}
|
||||
addVascEntryFrontendEventListener(listener);
|
||||
}
|
||||
|
||||
for (String clazz:entry.getVascEntryFrontendActionsByType(frontendType)) {
|
||||
Object obj = null;
|
||||
try {
|
||||
obj = cl.loadClass(clazz).newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException("Could not load frontend action of: "+clazz);
|
||||
}
|
||||
if (obj instanceof VascAction) {
|
||||
VascAction action = (VascAction)obj;
|
||||
String aid = action.getId();
|
||||
if (aid==null) {
|
||||
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+entry.getId());
|
||||
}
|
||||
if (action.getName()==null) {
|
||||
action.setName("vasc.action."+aid+".name");
|
||||
}
|
||||
if (action.getDescription()==null) {
|
||||
action.setDescription("vasc.action."+aid+".description");
|
||||
}
|
||||
if (action.getImage()==null) {
|
||||
action.setImage("vasc.action."+aid+".image");
|
||||
}
|
||||
if (action.getHelpId()==null) {
|
||||
action.setHelpId("vasc.action."+aid+".helpId");
|
||||
}
|
||||
}
|
||||
|
||||
if (obj instanceof RowVascAction) {
|
||||
entry.addRowAction((RowVascAction)obj);
|
||||
}
|
||||
if (obj instanceof ColumnVascAction) {
|
||||
entry.addColumnAction((ColumnVascAction)obj);
|
||||
}
|
||||
if (obj instanceof GlobalVascAction) {
|
||||
entry.addGlobalAction((GlobalVascAction)obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener) {
|
||||
for (VascEntryFrontendEventListener.VascFrontendEventType type:listener.getEventTypes()) {
|
||||
List<VascEntryFrontendEventListener> list = vascEntryFrontendEventListeners.get(type);
|
||||
if (list==null) {
|
||||
list = new ArrayList<VascEntryFrontendEventListener>(10);
|
||||
vascEntryFrontendEventListeners.put(type, list);
|
||||
}
|
||||
list.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type) {
|
||||
List<VascEntryFrontendEventListener> list = vascEntryFrontendEventListeners.get(type);
|
||||
if (list==null) {
|
||||
return new ArrayList<VascEntryFrontendEventListener>(0);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void fireVascFrontendEvent(VascEntry entry,VascFrontendEventType type, Object data) {
|
||||
List<VascEntryFrontendEventListener> list = getVascEntryFrontendEventListener(type);
|
||||
for (VascEntryFrontendEventListener l:list) {
|
||||
l.vascEvent(entry, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,337 +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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascLinkEntry;
|
||||
import net.forwardfire.vasc.core.VascLinkEntryType;
|
||||
import net.forwardfire.vasc.core.VascUserRoleController;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2007
|
||||
*/
|
||||
public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
||||
|
||||
private Logger logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderView(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public boolean renderView(VascEntryField field) {
|
||||
if (field.getView()==false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderCreate(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public boolean renderCreate(VascEntryField field) {
|
||||
if (renderView(field)==false) {
|
||||
return false;
|
||||
}
|
||||
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
|
||||
if (field.getRolesCreate()!=null && u.hasRole(field.getRolesCreate())) {
|
||||
return true;
|
||||
}
|
||||
if (field.getCreate()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderEdit(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public boolean renderEdit(VascEntryField field) {
|
||||
if (renderView(field)==false) {
|
||||
return false;
|
||||
}
|
||||
if (field.getVascEntry().getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
if (renderCreate(field)==false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
|
||||
if (field.getRolesEdit()!=null && u.hasRole(field.getRolesEdit())) {
|
||||
return true;
|
||||
}
|
||||
if (field.getEdit()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderEditReadOnly(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public boolean renderEditReadOnly(VascEntryField field) {
|
||||
if (renderView(field)==false) {
|
||||
return false;
|
||||
}
|
||||
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
|
||||
if (field.getRolesEditReadOnly()!=null && u.hasRole(field.getRolesEditReadOnly())) {
|
||||
return true;
|
||||
}
|
||||
if (field.getEditReadOnly()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderList(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public boolean renderList(VascEntryField field) {
|
||||
if (renderView(field)==false) {
|
||||
return false;
|
||||
}
|
||||
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
|
||||
if (field.getRolesList()!=null && u.hasRole(field.getRolesList())) {
|
||||
return true;
|
||||
}
|
||||
if (field.getList()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderGlobalVascAction(net.forwardfire.vasc.core.actions.GlobalVascAction)
|
||||
*/
|
||||
public boolean renderGlobalVascAction(GlobalVascAction action) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#renderRowVascAction(net.forwardfire.vasc.core.actions.RowVascAction)
|
||||
*/
|
||||
public boolean renderRowVascAction(RowVascAction action) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#getTotalColumnsWidth(net.forwardfire.vasc.core.VascEntry)
|
||||
*/
|
||||
public Integer getTotalColumnsWidth(VascEntry entry) {
|
||||
int result = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if(c.getSizeList()==null) {
|
||||
logger.finer("Column no size: "+c.getName());
|
||||
} else {
|
||||
result+=c.getSizeList();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascLinkEntry> getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type) {
|
||||
List<VascLinkEntry> result = new ArrayList<VascLinkEntry>(10);
|
||||
for (VascLinkEntry link:entry.getVascLinkEntries()) {
|
||||
if (type==null) {
|
||||
result.add(link);
|
||||
continue;
|
||||
}
|
||||
if (type.equals(link.getVascLinkEntryType())) {
|
||||
result.add(link);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#handleException(net.forwardfire.vasc.core.VascEntry,java.lang.Exception)
|
||||
*/
|
||||
public void handleException(VascEntry entry,Exception exception) {
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascFrontendEventType.EXCEPTION , exception);
|
||||
}
|
||||
|
||||
public void headerOptionsCreatedFillData(VascEntry entry) {
|
||||
|
||||
// fix conv defs of options to object. ?
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendActions().refreshData();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#validateObjectField(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
public List<String> validateObjectField(VascEntryField field) {
|
||||
if (field==null) {
|
||||
throw new NullPointerException("Can't validate null field.");
|
||||
}
|
||||
VascEntry entry = field.getVascEntry();
|
||||
if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
|
||||
throw new NullPointerException("Can't validate null entry object.");
|
||||
}
|
||||
List<String> error = new ArrayList<String>(3);
|
||||
|
||||
// skip non-create and non-edit fields
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(field) == false &
|
||||
entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
return error;
|
||||
}
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(field) &
|
||||
entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
|
||||
return error;
|
||||
}
|
||||
|
||||
try {
|
||||
Object objectSelected = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
Object objectValue = field.getVascEntryFieldValue().getValue(field, objectSelected);
|
||||
for (VascEntryFieldValidatorService s:entry.getVascFrontendData().getVascValidatorServices()) {
|
||||
error.addAll(s.validateObjectField(field, objectSelected, objectValue));
|
||||
}
|
||||
} catch (VascException e) {
|
||||
handleException(entry, e);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public boolean validateAndSetErrorText(VascEntry entry) {
|
||||
boolean hadError = false;
|
||||
for (VascEntryField field:entry.getVascEntryFields()) {
|
||||
VascUIComponent comp = entry.getVascFrontendData().getFieldVascUIComponent(field);
|
||||
List<String> error = validateObjectField(field);
|
||||
logger.info("Check field: "+field.getId()+" comp: "+comp+" Errors: "+error.size());
|
||||
if (error.isEmpty()) {
|
||||
if (comp!=null) {
|
||||
comp.setErrorText(null);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (comp==null) {
|
||||
logger.warning("Field: "+field.getId()+" gives errors but no UI component to display.");
|
||||
continue;
|
||||
}
|
||||
hadError=true;
|
||||
StringBuffer buf = new StringBuffer(100);
|
||||
for (String s:error) {
|
||||
buf.append(s);
|
||||
buf.append('\n');
|
||||
}
|
||||
comp.setErrorText(buf.toString());
|
||||
}
|
||||
return hadError;
|
||||
}
|
||||
|
||||
public void editReadOnlyUIComponents(VascEntry entry) {
|
||||
// reset edit read only
|
||||
for (VascEntryField f:entry.getVascEntryFields()) {
|
||||
if (entry.getVascFrontendData().getFieldVascUIComponent(f)==null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: move back to rendered when jsf fixes
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(f) == false &
|
||||
entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
//entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(false);
|
||||
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
|
||||
} else {
|
||||
//entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(true);
|
||||
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
|
||||
}
|
||||
|
||||
// only when editing set edit readonlys
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(f) &
|
||||
entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
|
||||
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
|
||||
} else {
|
||||
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) { // todo: remove when jsf fixes
|
||||
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<RowVascAction> getMultiRowActions(VascEntry entry) {
|
||||
List<RowVascAction> result = new ArrayList<RowVascAction>(5);
|
||||
for (RowVascAction a:entry.getRowActions()) {
|
||||
if (a.isMultiRowAction()) {
|
||||
result.add(a);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getSelectedDisplayName(VascEntry entry) {
|
||||
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;
|
||||
}
|
||||
|
||||
public String getParentSelectedDisplayName(VascEntry entry) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,223 +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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPager;
|
||||
|
||||
|
||||
/**
|
||||
* Default impl of default frontend actions
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 22, 2012
|
||||
*/
|
||||
public class DefaultVascFrontendPager implements VascFrontendPager {
|
||||
|
||||
//private Logger logger = Logger.getLogger(DefaultVascFrontendPager.class.getName());
|
||||
private VascEntry entry = null;
|
||||
private List<VascBackendPageNumber> pagesAll = null;
|
||||
|
||||
public DefaultVascFrontendPager(VascEntry entry) {
|
||||
this.entry=entry;
|
||||
pagesAll = new ArrayList<VascBackendPageNumber>(0);
|
||||
entry.getVascFrontendData().addVascEntryFrontendEventListener(new DefaultVascFrontendPagerEventListener());
|
||||
}
|
||||
|
||||
class DefaultVascFrontendPagerEventListener implements VascEntryFrontendEventListener {
|
||||
private static final long serialVersionUID = -6667099892801941650L;
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
pagesAll = getTablePagesFromBackend();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long getPageTotalRecordCount() {
|
||||
long result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
|
||||
return result;
|
||||
}
|
||||
public long getPageSize() {
|
||||
long result = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
|
||||
return result;
|
||||
}
|
||||
public long getPageStartCount() {
|
||||
int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
|
||||
long result = index*pageSize;
|
||||
return result;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean getHasPageNextAction() {
|
||||
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
pageIndex++;
|
||||
// copyed from helper
|
||||
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
|
||||
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getHasPagePreviousAction() {
|
||||
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (pageIndex==0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getHasOnlySinglePage() {
|
||||
int pages = pagesAll.size();
|
||||
if (pages==1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getHasExtendedPageMode() {
|
||||
int pages = pagesAll.size();
|
||||
if (pages>13) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getHasExtendedPageModeCenter() {
|
||||
if (getHasExtendedPageMode()==false) {
|
||||
return false;
|
||||
}
|
||||
int page = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (page<5) {
|
||||
return false;
|
||||
}
|
||||
int pages = pagesAll.size();
|
||||
if (page>pages-6) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesFromBackend() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(30);
|
||||
VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
|
||||
if (state.getPageSize()==0) {
|
||||
return result; // paging disabled
|
||||
}
|
||||
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
|
||||
if (total==null) {
|
||||
return result; // no pages
|
||||
}
|
||||
int pages = new Long(total/state.getPageSize()).intValue();
|
||||
for (int i=0;i<=pages;i++) {
|
||||
VascBackendPageNumber pn = new VascBackendPageNumber(i);
|
||||
if (state.getPageIndex()==i) {
|
||||
pn.setSelected(true);
|
||||
}
|
||||
result.add(pn);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesNormal() {
|
||||
if (getHasExtendedPageMode()) {
|
||||
return new ArrayList<VascBackendPageNumber>(0);
|
||||
} else {
|
||||
return pagesAll;
|
||||
}
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedBegin() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
|
||||
result.add(pagesAll.get(0));
|
||||
result.add(pagesAll.get(1));
|
||||
result.add(pagesAll.get(2));
|
||||
|
||||
int page = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (page==2 | page==3 | page==4) {
|
||||
result.add(pagesAll.get(3));
|
||||
}
|
||||
if (page==3 | page==4) {
|
||||
result.add(pagesAll.get(4));
|
||||
}
|
||||
if (page==4) {
|
||||
result.add(pagesAll.get(5));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedEnd() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
|
||||
int pages = pagesAll.size();
|
||||
int page = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
int off = pages-page;
|
||||
|
||||
if (off==5) {
|
||||
result.add(pagesAll.get(pages-6));
|
||||
}
|
||||
if (off==4 | off==5) {
|
||||
result.add(pagesAll.get(pages-5));
|
||||
}
|
||||
if (off==3 | off==4 | off==5) {
|
||||
result.add(pagesAll.get(pages-4));
|
||||
}
|
||||
|
||||
if (pages>4) {
|
||||
result.add(pagesAll.get(pages-3));
|
||||
result.add(pagesAll.get(pages-2));
|
||||
result.add(pagesAll.get(pages-1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedCenter() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(3);
|
||||
int page = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (page>0) {
|
||||
result.add(pagesAll.get(page-1));
|
||||
}
|
||||
result.add(pagesAll.get(page));
|
||||
result.add(pagesAll.get(page+1));
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,174 +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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.core.VascLinkEntry;
|
||||
import net.forwardfire.vasc.core.VascLinkEntryType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The DefaultVascLinkEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 27, 2007
|
||||
*/
|
||||
public class DefaultVascLinkEntry implements VascLinkEntry {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String id = null;
|
||||
private String vascEntryId = null;
|
||||
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
|
||||
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(3);
|
||||
private VascLinkEntryType vascLinkEntryType = null;
|
||||
private String doActionId = null;
|
||||
private String name = null;
|
||||
private String helpId = null;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getEntryParameterFieldId(String parameterName) {
|
||||
return entryParameterFieldIds.get(parameterName);
|
||||
}
|
||||
public void addEntryParameterFieldId(String parameterName,String valueFieldId) {
|
||||
entryParameterFieldIds.put(parameterName, valueFieldId);
|
||||
}
|
||||
public List<String> getEntryParameterFieldIdKeys() {
|
||||
return new ArrayList<String>(entryParameterFieldIds.keySet());
|
||||
}
|
||||
|
||||
public String getEntryCreateFieldValue(String valueFieldId) {
|
||||
return entryCreateFieldValues.get(valueFieldId);
|
||||
}
|
||||
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId) {
|
||||
entryCreateFieldValues.put(valueFieldId, selectedFieldId);
|
||||
}
|
||||
public List<String> getEntryCreateFieldValueKeys() {
|
||||
return new ArrayList<String>(entryCreateFieldValues.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryId
|
||||
*/
|
||||
public String getVascEntryId() {
|
||||
return vascEntryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryId the vascEntryId to set
|
||||
*/
|
||||
public void setVascEntryId(String vascEntryId) {
|
||||
this.vascEntryId = vascEntryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascLinkEntryType
|
||||
*/
|
||||
public VascLinkEntryType getVascLinkEntryType() {
|
||||
return vascLinkEntryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascLinkEntryType the vascLinkEntryType to set
|
||||
*/
|
||||
public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType) {
|
||||
this.vascLinkEntryType = vascLinkEntryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the doActionId
|
||||
*/
|
||||
public String getDoActionId() {
|
||||
return doActionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param doActionId the doActionId to set
|
||||
*/
|
||||
public void setDoActionId(String doActionId) {
|
||||
this.doActionId = doActionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the helpId
|
||||
*/
|
||||
public String getHelpId() {
|
||||
return helpId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param helpId the helpId to set
|
||||
*/
|
||||
public void setHelpId(String helpId) {
|
||||
this.helpId = helpId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
public VascLinkEntry clone() throws CloneNotSupportedException {
|
||||
DefaultVascLinkEntry result = new DefaultVascLinkEntry();
|
||||
result.doActionId=doActionId;
|
||||
result.vascLinkEntryType=vascLinkEntryType;
|
||||
result.vascEntryId=vascEntryId;
|
||||
result.entryParameterFieldIds=entryParameterFieldIds;
|
||||
result.entryCreateFieldValues=entryCreateFieldValues;
|
||||
result.id=id;
|
||||
result.name=name;
|
||||
result.helpId=helpId;
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,103 +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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.core.VascUserRoleController;
|
||||
|
||||
|
||||
/**
|
||||
* Simple default user controller for wrapping user info into vasc
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 13, 2009
|
||||
*/
|
||||
public class DefaultVascUserRoleController implements VascUserRoleController {
|
||||
|
||||
private Long userId = null;
|
||||
private String userName = null;
|
||||
private List<String> userRoles = null;
|
||||
|
||||
|
||||
public DefaultVascUserRoleController(Long userId,String userName) {
|
||||
if (userId==null) {
|
||||
throw new NullPointerException("userId may not be null.");
|
||||
}
|
||||
if (userName==null) {
|
||||
throw new NullPointerException("userName may not be null");
|
||||
}
|
||||
this.userId=userId;
|
||||
this.userName=userName;
|
||||
userRoles = new ArrayList<String>(10);
|
||||
}
|
||||
|
||||
public DefaultVascUserRoleController(Long userId,String userName,String...roles) {
|
||||
this(userId,userName);
|
||||
for (String role:roles) {
|
||||
userRoles.add(role);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascUserRoleController#getUserId()
|
||||
*/
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascUserRoleController#getUserName()
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascUserRoleController#getUserRoles()
|
||||
*/
|
||||
public List<String> getUserRoles() {
|
||||
return userRoles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascUserRoleController#hasRole(java.lang.String)
|
||||
*/
|
||||
public boolean hasRole(String roles) {
|
||||
if (roles==null) {
|
||||
return false;
|
||||
}
|
||||
// input: admin|superAdmin
|
||||
// input: (admin|superAdmin)&login
|
||||
String[] r = roles.split("|");
|
||||
for (String rr:r) {
|
||||
if (userRoles.contains(rr)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,66 +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.impl.x4o;
|
||||
|
||||
|
||||
import net.forwardfire.vasc.core.VascLinkEntry;
|
||||
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
|
||||
|
||||
import org.x4o.xml.element.AbstractElement;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
|
||||
/**
|
||||
* Adds the link is paramets
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jun 09, 2009
|
||||
*/
|
||||
public class VascLinkEntryParameterElement extends AbstractElement {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElement#doElementRun()
|
||||
*/
|
||||
@Override
|
||||
public void doElementRun() throws ElementException {
|
||||
String valueFieldId = getAttributes().get("valueFieldId");
|
||||
String parameterName = getAttributes().get("name");
|
||||
String selectedFieldId = getAttributes().get("selectedFieldId");
|
||||
|
||||
if (getParent().getElementObject() instanceof VascSelectItemModelEntry) {
|
||||
VascSelectItemModelEntry m = (VascSelectItemModelEntry)getParent().getElementObject();
|
||||
m.addEntryParameterFieldId(parameterName, valueFieldId);
|
||||
return;
|
||||
}
|
||||
if (getParent().getElementObject() instanceof VascLinkEntry) {
|
||||
VascLinkEntry link = (VascLinkEntry)getParent().getElementObject();
|
||||
if (parameterName!=null) {
|
||||
// normal parameter
|
||||
link.addEntryParameterFieldId(parameterName, valueFieldId);
|
||||
} else {
|
||||
link.addEntryCreateFieldValue(valueFieldId,selectedFieldId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new ElementException("Unsupported parent object: "+getParent().getElementObject());
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Vasc Demo Tech logging config.
|
||||
#
|
||||
|
||||
# Only log to a file
|
||||
handlers=java.util.logging.FileHandler
|
||||
|
||||
# default file output is in startup directory.
|
||||
java.util.logging.FileHandler.pattern=logs/vasc-demo-tech.log
|
||||
java.util.logging.FileHandler.limit=0
|
||||
java.util.logging.FileHandler.count=1
|
||||
java.util.logging.FileHandler.encoding=UTF8
|
||||
java.util.logging.FileHandler.formatter=net.forwardfire.vasc.demo.tech.ui.PatternLogFormatter
|
||||
|
||||
# The PatternLogFormatter lets you customise the log output;
|
||||
# %d = Formated date string %s =-Source method
|
||||
# %l = Logger level %c = Source Class
|
||||
# %n = Logger name %C = Source Class Simple
|
||||
# %m = Logger message %S = Stacktrace
|
||||
# %t = Thread ID %r = Return/newline
|
||||
#net.forwardfire.vasc.demo.tech.ui.PatternLogFormatter.log_pattern=%d %l [%C.%s] %m%r
|
||||
#net.forwardfire.vasc.demo.tech.ui.PatternLogFormatter.log_error_pattern=%d %l [%C.%s] %m%r%S
|
||||
#net.forwardfire.vasc.demo.tech.ui.PatternLogFormatter.date_pattern=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
# Default global logging level.
|
||||
.level=INFO
|
||||
|
||||
# Different log levels for packages.
|
||||
net.forwardfire.vasc.demo.level=INFO
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
gui=true
|
||||
editor=true
|
||||
contextPath=/demo
|
||||
host=localhost
|
||||
port=8899
|
|
@ -1,42 +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.demo.tech.core;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||
|
||||
/**
|
||||
* DemoVascControllerProvider gets the static local jvm vasc controller for this tech demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class DemoVascControllerProvider implements VascControllerProvider {
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascControllerProvider#getVascController()
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return DemoVascManager.getVascControllerStatic();
|
||||
}
|
||||
}
|
|
@ -1,134 +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.demo.tech.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntryConfigController;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterJR4O;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
|
||||
|
||||
/**
|
||||
* DemoVascManager manages the dynamic vasc controller for tech demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class DemoVascManager {
|
||||
|
||||
private Logger logger = null;
|
||||
static private VascController vascController = null;
|
||||
|
||||
public DemoVascManager() {
|
||||
logger = Logger.getLogger(DemoVascManager.class.getName());
|
||||
}
|
||||
|
||||
public void start() {
|
||||
logger.finer("Starting vascmanager");
|
||||
if (vascController!=null) {
|
||||
throw new RuntimeException("VascManager is already started.");
|
||||
}
|
||||
try {
|
||||
vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin");
|
||||
|
||||
VascEntryConfigController vecc = vascController.getVascEntryConfigController();
|
||||
|
||||
// Config all report export engines for demo.
|
||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfLandscape",JRExportType.PDF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfPortrait",JRExportType.PDF,"generic-portrait","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrRtf",JRExportType.RTF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXls",JRExportType.XLS,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXml",JRExportType.XML,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrCsv",JRExportType.CSV,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
||||
|
||||
// Config root bundle to load all resources.
|
||||
vecc.setResourceBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle");
|
||||
|
||||
// Config some defaults
|
||||
vecc.setDefaultPageSize(200);
|
||||
vecc.setDefaultPageSizeMax(1500);
|
||||
|
||||
} catch (VascException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (vascController==null) {
|
||||
return;
|
||||
}
|
||||
VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController();
|
||||
backends.clearAndStopBackends();
|
||||
|
||||
vascController = null;
|
||||
logger.info("Stop manager, cleared all.");
|
||||
}
|
||||
|
||||
public void startEditor() {
|
||||
try {
|
||||
VascParser parser = new VascParser(vascController);
|
||||
parser.addGlobalELBean("vascController", vascController);
|
||||
parser.parseResource("net/forwardfire/vasc/editor/vasc-edit.xml");
|
||||
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void openFile(File file) {
|
||||
logger.info("Vasc open file: "+file.getAbsoluteFile());
|
||||
try {
|
||||
VascParser parser = new VascParser(vascController);
|
||||
//File f = File.createTempFile("test-vasc", ".xml");
|
||||
//parser.setDebugOutputStream(new FileOutputStream(f));
|
||||
parser.parseFile(file);
|
||||
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed for the provider interface
|
||||
* @return
|
||||
*/
|
||||
static protected VascController getVascControllerStatic() {
|
||||
return vascController;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-tech-ui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
File diff suppressed because it is too large
Load diff
|
@ -1,176 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-demo-tech</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-tech-ui</artifactId>
|
||||
<name>vasc-demo-tech-ui</name>
|
||||
<description>vasc-demo-tech-ui</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${x4o-core.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.el</groupId>
|
||||
<artifactId>el-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-editor</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-frontend-swing</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-frontend-web-jsf</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-frontend-web-export</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-frontend-cxf-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-backend-ldap</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-backend-mongodb</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-backend-metamodel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-backend-jdbc</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.test</groupId>
|
||||
<artifactId>vasc-test-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jdesktop.bsaf</groupId>
|
||||
<artifactId>bsaf</artifactId>
|
||||
<version>${bsaf.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jnlp</artifactId>
|
||||
<groupId>javax.jnlp</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>9.1-901.jdbc4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.6.4</version>
|
||||
</dependency>
|
||||
<!-- Tomcat deps -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>7.0.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-jasper</artifactId>
|
||||
<version>7.0.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jasper</artifactId>
|
||||
<version>7.0.22</version>
|
||||
</dependency>
|
||||
<!-- Web tech deps -->
|
||||
<dependency>
|
||||
<groupId>com.sun.facelets</groupId>
|
||||
<artifactId>jsf-facelets</artifactId>
|
||||
<version>1.1.15.B1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.faces</groupId>
|
||||
<artifactId>jsf-api</artifactId>
|
||||
<version>1.2_12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.faces</groupId>
|
||||
<artifactId>jsf-impl</artifactId>
|
||||
<version>1.2_12</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RichFaces libraries -->
|
||||
<dependency>
|
||||
<groupId>org.richfaces.framework</groupId>
|
||||
<artifactId>richfaces-api</artifactId>
|
||||
<version>3.3.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.richfaces.framework</groupId>
|
||||
<artifactId>richfaces-impl</artifactId>
|
||||
<version>3.3.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.richfaces.ui</groupId>
|
||||
<artifactId>richfaces-ui</artifactId>
|
||||
<version>3.3.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,158 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
|
||||
public class DeployManager {
|
||||
|
||||
private Logger logger = null;
|
||||
private File deployDir = null;
|
||||
private int scanPeriod = 3;
|
||||
private AutoDeployManager autoDeployManager = null;
|
||||
private Map<File,String> fileCheckSums = null;
|
||||
|
||||
public DeployManager() {
|
||||
logger = Logger.getLogger(DeployManager.class.getName());
|
||||
fileCheckSums = new HashMap<File,String>(20);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (deployDir==null) {
|
||||
throw new NullPointerException("Can't deploy with null deployDir.");
|
||||
}
|
||||
if (deployDir.exists()==false) {
|
||||
throw new IllegalStateException("Can't deploy with non-existing deployDir.");
|
||||
}
|
||||
if (deployDir.isDirectory()==false) {
|
||||
throw new IllegalStateException("Can't deploy with non-directory deployDir.");
|
||||
}
|
||||
Thread scanThread = new Thread(new AutoDeployManager());
|
||||
scanThread.setName("hotdeploy-scanner");
|
||||
scanThread.start();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (autoDeployManager==null) {
|
||||
return;
|
||||
}
|
||||
autoDeployManager.stop();
|
||||
}
|
||||
|
||||
|
||||
public String createMd5Sum(File file) throws IOException, NoSuchAlgorithmException {
|
||||
FileInputStream in = new FileInputStream(file.getAbsolutePath());
|
||||
try {
|
||||
byte[] b = new byte[1024 * 64];
|
||||
int num = 0;
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
while ((num = in.read(b)) != -1) {
|
||||
md.update(b, 0, num);
|
||||
}
|
||||
byte[] hashBytes = md.digest();
|
||||
BigInteger hashResult = new BigInteger(hashBytes);
|
||||
String hashString = hashResult.toString(16);
|
||||
return hashString;
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void hotDeployVasc() throws NoSuchAlgorithmException, IOException {
|
||||
boolean deployed = false;
|
||||
for (File file:deployDir.listFiles()) {
|
||||
if (file.canRead()==false) {
|
||||
continue;
|
||||
}
|
||||
if (file.getName().endsWith("xml")==false) {
|
||||
continue;
|
||||
}
|
||||
String md5File = createMd5Sum(file);
|
||||
String md5Deploy = fileCheckSums.get(file);
|
||||
if (md5Deploy!=null && md5Deploy.equals(md5File)) {
|
||||
continue;
|
||||
}
|
||||
fileCheckSums.put(file, md5File);
|
||||
deployed = true;
|
||||
TechUI.getInstance().getVascManager().openFile(file);
|
||||
}
|
||||
if (deployed) {
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
}
|
||||
|
||||
protected class AutoDeployManager implements Runnable {
|
||||
private volatile boolean run = true;
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(5000); // let gui+tomcat start
|
||||
logger.info("AutoDeployManager started");
|
||||
while(run) {
|
||||
try {
|
||||
hotDeployVasc();
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error while depoying: "+e.getMessage(),e);
|
||||
}
|
||||
|
||||
if (scanPeriod == 0) {
|
||||
scanPeriod = 1;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000*scanPeriod);
|
||||
} catch (InterruptedException ie) {
|
||||
logger.info("Interrupted sleep");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE,"Error in run: "+e.getMessage(),e);
|
||||
} finally {
|
||||
logger.info("AutoDeployManager stoped");
|
||||
}
|
||||
}
|
||||
public void stop() {
|
||||
run = false;
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the deployDir
|
||||
*/
|
||||
public File getDeployDir() {
|
||||
return deployDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deployDir the deployDir to set
|
||||
*/
|
||||
public void setDeployDir(File deployDir) {
|
||||
this.deployDir = deployDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scanPeriod
|
||||
*/
|
||||
public int getScanPeriod() {
|
||||
return scanPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scanPeriod the scanPeriod to set
|
||||
*/
|
||||
public void setScanPeriod(int scanPeriod) {
|
||||
this.scanPeriod = scanPeriod;
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2011, Willem Cazander
|
||||
* 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.demo.tech.ui;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
/**
|
||||
* PatternLogFormatter Formats the messages of the logger.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
*/
|
||||
public class PatternLogFormatter extends Formatter {
|
||||
|
||||
private final String lineSeperator;
|
||||
private final MessageFormat logFormat;
|
||||
private final MessageFormat logErrorFormat;
|
||||
private final DateFormat dateFormat;
|
||||
static private final String DEFAULT_LOG_FORMAT = "%d %l [%C.%s] %m%r";
|
||||
static private final String DEFAULT_LOG_ERROR_FORMAT = "%d %l [%C.%s] %m%r%S";
|
||||
static private final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
static private final String[] LOG_OPTIONS = {
|
||||
"%d", /* Formated date string */
|
||||
"%l", /* Logger level */
|
||||
"%n", /* Logger name */
|
||||
"%m", /* Logger message */
|
||||
"%t", /* Thread ID */
|
||||
"%s", /* Source method */
|
||||
"%c", /* Source Class */
|
||||
"%C", /* Source Class Simple */
|
||||
"%S", /* Stacktrace */
|
||||
"%r", /* Return/newline */
|
||||
};
|
||||
|
||||
public PatternLogFormatter() {
|
||||
String logFormatStr = LogManager.getLogManager().getProperty(getClass().getName()+".log_pattern");
|
||||
String logFormatErrorStr = LogManager.getLogManager().getProperty(getClass().getName()+".log_error_pattern");
|
||||
String logDateStr = LogManager.getLogManager().getProperty(getClass().getName()+".date_pattern");
|
||||
|
||||
if (logDateStr!=null && logDateStr.isEmpty()==false) {
|
||||
dateFormat = new SimpleDateFormat(logDateStr);
|
||||
} else {
|
||||
dateFormat = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
|
||||
if (logFormatStr==null || logFormatStr.isEmpty()) {
|
||||
logFormatStr = DEFAULT_LOG_FORMAT;
|
||||
}
|
||||
if (logFormatStr.contains("{") || logFormatStr.contains("}")) {
|
||||
throw new IllegalArgumentException("Curly braces not allowed in log pattern.");
|
||||
}
|
||||
for (int i=0;i<LOG_OPTIONS.length;i++) {
|
||||
logFormatStr = logFormatStr.replace(LOG_OPTIONS[i], "{"+i+"}");
|
||||
}
|
||||
logFormat = new MessageFormat(logFormatStr);
|
||||
|
||||
if (logFormatErrorStr==null || logFormatErrorStr.isEmpty()) {
|
||||
logFormatErrorStr = DEFAULT_LOG_ERROR_FORMAT;
|
||||
}
|
||||
if (logFormatErrorStr.contains("{") || logFormatErrorStr.contains("}")) {
|
||||
throw new IllegalArgumentException("Curly braces not allowed in log pattern.");
|
||||
}
|
||||
for (int i=0;i<LOG_OPTIONS.length;i++) {
|
||||
logFormatErrorStr = logFormatErrorStr.replace(LOG_OPTIONS[i], "{"+i+"}");
|
||||
}
|
||||
logErrorFormat = new MessageFormat(logFormatErrorStr);
|
||||
|
||||
lineSeperator = String.format("%n"); // Used platform dependent seperator
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record) {
|
||||
String[] logFields = new String[10];
|
||||
logFields[1] = record.getLevel().toString();
|
||||
logFields[2] = record.getLoggerName();
|
||||
logFields[3] = record.getMessage();
|
||||
if ((logFields[3] == null || logFields[3].isEmpty()) && record.getThrown()!=null) {
|
||||
logFields[3] = record.getThrown().getMessage();
|
||||
}
|
||||
logFields[4] = Integer.toString(record.getThreadID());
|
||||
logFields[5] = record.getSourceMethodName() != null ? record.getSourceMethodName() : "?";
|
||||
logFields[6] = record.getSourceClassName() != null ? record.getSourceClassName() : "?";
|
||||
int dotIdx = logFields[6].lastIndexOf(".") + 1;
|
||||
if (dotIdx > 0 && dotIdx < logFields[6].length()) {
|
||||
logFields[7] = logFields[6].substring(dotIdx);
|
||||
} else {
|
||||
logFields[7] = logFields[6];
|
||||
}
|
||||
logFields[8] = record.getThrown()!=null ? createStackTrace(record.getThrown()) : "";
|
||||
logFields[9] = lineSeperator;
|
||||
synchronized (logFormat) {
|
||||
logFields[0] = dateFormat.format(new Date(record.getMillis())); // dateFormat is guarded by the logFormat lock.
|
||||
if (record.getThrown()==null) {
|
||||
return logFormat.format(logFields);
|
||||
} else {
|
||||
return logErrorFormat.format(logFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String createStackTrace(Throwable t) {
|
||||
StringWriter buf = new StringWriter();
|
||||
t.printStackTrace(new PrintWriter(buf));
|
||||
return buf.getBuffer().toString();
|
||||
}
|
||||
}
|
|
@ -1,273 +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.demo.tech.ui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.EventObject;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.apache.juli.logging.LogFactory;
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.demo.tech.core.DemoVascManager;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar;
|
||||
|
||||
public class TechUI extends SingleFrameApplication {
|
||||
|
||||
private Logger logger = null;
|
||||
private boolean showGui = false;
|
||||
private DemoVascManager vascManager = null;
|
||||
private TomcatManager tomcatManager = null;
|
||||
private DeployManager deployManager = null;
|
||||
|
||||
static public void main(String[] args) {
|
||||
Application.launch(TechUI.class, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Config logging and setup logger object.
|
||||
*/
|
||||
private void setupLogging() {
|
||||
|
||||
LogFactory.getLog(TechUI.class); // init JULI so reconfig is done once.
|
||||
|
||||
File logConfig = new File("config/logging.properties");
|
||||
if (logConfig.exists()) {
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = new FileInputStream(logConfig);
|
||||
LogManager.getLogManager().readConfiguration(in);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger rootLogger = Logger.getAnonymousLogger();
|
||||
while (rootLogger.getParent()!=null) {
|
||||
rootLogger = rootLogger.getParent();
|
||||
}
|
||||
for (Handler h:rootLogger.getHandlers()) {
|
||||
h.setFormatter(new PatternLogFormatter());
|
||||
}
|
||||
}
|
||||
logger = Logger.getLogger(TechUI.class.getName());
|
||||
}
|
||||
|
||||
class ShutdownManager implements ExitListener {
|
||||
public boolean canExit(EventObject e) {
|
||||
return true;
|
||||
}
|
||||
public void willExit(EventObject event) {
|
||||
logger.info("Shutdown requested.");
|
||||
long startTime = System.currentTimeMillis();
|
||||
deployManager.stop();
|
||||
try {
|
||||
tomcatManager.stop();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
vascManager.stop();
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("TechUI stopped in "+(stopTime-startTime)+" ms.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void initialize(String[] argu) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// First parse user program arguments.
|
||||
String serverHost = null;
|
||||
String serverPort = null;
|
||||
String contextPath = null;
|
||||
boolean editor = false;
|
||||
showGui = false;
|
||||
|
||||
File propFile = new File("config/server.properties");
|
||||
if (propFile.exists()) {
|
||||
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = new FileInputStream(propFile);
|
||||
Properties p = new Properties();
|
||||
p.load(in);
|
||||
serverHost = p.getProperty("host");
|
||||
serverPort = p.getProperty("port");
|
||||
contextPath = p.getProperty("contextPath");
|
||||
if ("true".equalsIgnoreCase(p.getProperty("gui"))) {
|
||||
showGui = true;
|
||||
} else {
|
||||
showGui = false;
|
||||
}
|
||||
if ("true".equalsIgnoreCase(p.getProperty("editor"))) {
|
||||
editor = true;
|
||||
} else {
|
||||
editor = false;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
serverHost = "localhost";
|
||||
serverPort = "8899";
|
||||
}
|
||||
|
||||
|
||||
setupLogging();
|
||||
logger.info("Starting Vasc-Demo-Tech-UI.");
|
||||
|
||||
File deployDir = new File("deploy");
|
||||
File workDir = new File("workdir");
|
||||
if (isMavenRun()) {
|
||||
if (deployDir.exists()==false) {
|
||||
deployDir.mkdir();
|
||||
}
|
||||
if (workDir.exists()==false) {
|
||||
workDir.mkdir();
|
||||
}
|
||||
}
|
||||
|
||||
vascManager = new DemoVascManager();
|
||||
vascManager.start();
|
||||
if (editor) {
|
||||
vascManager.startEditor();
|
||||
}
|
||||
|
||||
deployManager = new DeployManager();
|
||||
deployManager.setDeployDir(deployDir);
|
||||
deployManager.start();
|
||||
|
||||
tomcatManager = new TomcatManager();
|
||||
tomcatManager.setWorkDir(workDir);
|
||||
tomcatManager.setVascController(vascManager.getVascController());
|
||||
if (serverHost!=null) {
|
||||
tomcatManager.setHostname(serverHost);
|
||||
}
|
||||
if (serverPort!=null) {
|
||||
tomcatManager.setPort(new Integer(serverPort));
|
||||
}
|
||||
if (contextPath!=null) {
|
||||
tomcatManager.setContextPath(contextPath);
|
||||
}
|
||||
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(2000); // let gui come up.
|
||||
tomcatManager.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("TechUI initialized in "+(stopTime-startTime)+" ms.");
|
||||
}
|
||||
|
||||
protected void startup() {
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
addExitListener(new ShutdownManager());
|
||||
|
||||
if (showGui) {
|
||||
FrameView mainView = getMainView();
|
||||
mainView.setComponent(new JMainPanel());
|
||||
mainView.setMenuBar(new JMainPanelMenuBar());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128));
|
||||
show(mainView);
|
||||
} else {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
while(true)
|
||||
try {
|
||||
Thread.sleep(3333);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("TechUI startup in "+(stopTime-startTime)+" ms total startup in "+(stopTime-startTime)+" ms.");
|
||||
} catch (Exception e) {
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
JOptionPane.showMessageDialog(null, "Fatal Startup Error:\n"+sw.getBuffer().toString(), "Vasc Demo Tech Startup Error", JOptionPane.ERROR_MESSAGE);
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public TechUI getInstance() {
|
||||
return getInstance(TechUI.class);
|
||||
}
|
||||
|
||||
public DemoVascManager getVascManager() {
|
||||
return vascManager;
|
||||
}
|
||||
|
||||
public VascController getVascController() {
|
||||
return vascManager.getVascController();
|
||||
}
|
||||
|
||||
public boolean isMavenRun() {
|
||||
return System.getProperty("java.class.path").contains("classes");
|
||||
}
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
|
||||
import org.apache.catalina.startup.Bootstrap;
|
||||
import org.apache.catalina.startup.Tomcat;
|
||||
import org.apache.catalina.valves.AccessLogValve;
|
||||
|
||||
public class TomcatManager {
|
||||
|
||||
private Logger logger = null;
|
||||
private Tomcat tomcat = null;
|
||||
private VascController vascController = null;
|
||||
private String hostname = null;
|
||||
private Integer port = null;
|
||||
private File workDir = null;
|
||||
private String contextPath = null;
|
||||
|
||||
public TomcatManager() {
|
||||
logger = Logger.getLogger(TomcatManager.class.getName());
|
||||
hostname = "localhost";
|
||||
port = 8899;
|
||||
contextPath = "/demo";
|
||||
}
|
||||
|
||||
public void start() throws Exception {
|
||||
if (workDir==null) {
|
||||
throw new NullPointerException("Can't start tomcat with null workDir.");
|
||||
}
|
||||
Tomcat tomcat = new Tomcat();
|
||||
tomcat.setBaseDir(workDir.getAbsolutePath());
|
||||
tomcat.setPort(getPort());
|
||||
tomcat.setHostname(getHostname());
|
||||
|
||||
tomcat.init();
|
||||
|
||||
if (TechUI.getInstance().isMavenRun()==false) {
|
||||
AccessLogValve accessLog = new AccessLogValve();
|
||||
accessLog.setDirectory("../logs");
|
||||
accessLog.setSuffix(".log");
|
||||
accessLog.setPattern("%h %l %u %t "%r" %s %b");
|
||||
tomcat.getHost().getPipeline().addValve(accessLog);
|
||||
}
|
||||
|
||||
if (TechUI.getInstance().isMavenRun()) {
|
||||
String webappPathLocation = "../vasc-demo-tech-web/src/main/webapp/";
|
||||
String deployPath = new File(webappPathLocation).getAbsolutePath();
|
||||
logger.info("Deploy demo app from workspace path: "+deployPath);
|
||||
tomcat.addWebapp(getContextPath(),deployPath);
|
||||
} else {
|
||||
|
||||
File techWarFile = null;
|
||||
for (File file:new File("lib").listFiles()) {
|
||||
if (file.getName().contains("vasc-demo-tech-web")) {
|
||||
techWarFile = file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (techWarFile==null) {
|
||||
throw new NullPointerException("Could not locate war file in lib directory.");
|
||||
}
|
||||
File destDir = new File(workDir,"tomcat.wars"+File.separator+techWarFile.getName());
|
||||
if (destDir.exists()==false) {
|
||||
destDir.mkdirs();
|
||||
JarFile jar = new JarFile(techWarFile);
|
||||
Enumeration<JarEntry> jars = jar.entries();
|
||||
while (jars.hasMoreElements()) {
|
||||
java.util.jar.JarEntry file = jars.nextElement();
|
||||
java.io.File f = new java.io.File(destDir+File.separator+file.getName());
|
||||
if (file.isDirectory()) {
|
||||
f.mkdir();
|
||||
continue;
|
||||
}
|
||||
InputStream is = jar.getInputStream(file);
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
while (is.available() > 0) {
|
||||
fos.write(is.read()); // slow copy
|
||||
}
|
||||
fos.close();
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
String deployPath = destDir.getAbsolutePath();
|
||||
logger.info("Deploy war path: "+deployPath);
|
||||
tomcat.addWebapp(getContextPath(),deployPath);
|
||||
}
|
||||
tomcat.start();
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
if (tomcat==null) {
|
||||
return;
|
||||
}
|
||||
tomcat.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascController the vascController to set
|
||||
*/
|
||||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hostname
|
||||
*/
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hostname the hostname to set
|
||||
*/
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port
|
||||
*/
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param port the port to set
|
||||
*/
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the workDir
|
||||
*/
|
||||
public File getWorkDir() {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workDir the workDir to set
|
||||
*/
|
||||
public void setWorkDir(File workDir) {
|
||||
this.workDir = workDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the contextPath
|
||||
*/
|
||||
public String getContextPath() {
|
||||
return contextPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param contextPath the contextPath to set
|
||||
*/
|
||||
public void setContextPath(String contextPath) {
|
||||
this.contextPath = contextPath;
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
|
||||
public class JDialogMetaCsv extends JDialog implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
|
||||
public JDialogMetaCsv(Frame aFrame) {
|
||||
setTitle("Add csv file");
|
||||
setMinimumSize(new Dimension(640,480));
|
||||
setPreferredSize(new Dimension(999,666));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
|
||||
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
|
||||
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
//result.setLayout(new SpringLayout());
|
||||
|
||||
result.add(new JLabel("File"));
|
||||
JButton fileButton = new JButton("Open");
|
||||
fileButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
int returnVal = fc.showOpenDialog((JButton)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
|
||||
ds.setFile(file.getAbsolutePath());
|
||||
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(file.getName());
|
||||
schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
|
||||
|
||||
public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JComboBox driverClassBox = null;
|
||||
private JTextField connectUrlField = null;
|
||||
private JTextField usernameField = null;
|
||||
private JTextField passwordField = null;
|
||||
|
||||
|
||||
public JDialogMetaJdbc(Frame aFrame) {
|
||||
setTitle("Add jdbc");
|
||||
setMinimumSize(new Dimension(300,200));
|
||||
setPreferredSize(new Dimension(500,400));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
|
||||
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
|
||||
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
result.setLayout(new SpringLayout());
|
||||
|
||||
result.add(new JLabel("Driver"));
|
||||
driverClassBox = new JComboBox(new String[] {"org.postgresql.Driver","com.mysql.jdbc.Driver","org.apache.derby.jdbc.EmbeddedDriver","org.hsqldb.jdbcDriver","org.sqlite.JDBC"});
|
||||
driverClassBox.setSelectedIndex(0);
|
||||
result.add(driverClassBox);
|
||||
|
||||
result.add(new JLabel("Url"));
|
||||
connectUrlField = new JTextField("jdbc:postgresql://localhost/dellstore2");
|
||||
result.add(connectUrlField);
|
||||
|
||||
result.add(new JLabel("Username"));
|
||||
usernameField = new JTextField("postgres");
|
||||
result.add(usernameField);
|
||||
|
||||
result.add(new JLabel("Password"));
|
||||
passwordField = new JTextField("postgresql");
|
||||
result.add(passwordField);
|
||||
|
||||
JButton fileButton = new JButton("Connect");
|
||||
fileButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String url = connectUrlField.getText();
|
||||
MetaModelDataContextJdbc ds = new MetaModelDataContextJdbc();
|
||||
ds.setDriverClass((String)driverClassBox.getSelectedItem());
|
||||
ds.setConnectUrl(url);
|
||||
ds.setUsername(usernameField.getText());
|
||||
ds.setPassword(passwordField.getText());
|
||||
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(dbName);
|
||||
schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
result.add(new JLabel(""));
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 5, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTextField hostNameField = null;
|
||||
private JTextField hostPortField = null;
|
||||
private JTextField databaseField = null;
|
||||
|
||||
public JDialogMetaMongodb(Frame aFrame) {
|
||||
setTitle("Add mongodb");
|
||||
setMinimumSize(new Dimension(300,200));
|
||||
setPreferredSize(new Dimension(400,300));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
|
||||
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
|
||||
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
result.setLayout(new SpringLayout());
|
||||
|
||||
result.add(new JLabel("Hostname"));
|
||||
hostNameField = new JTextField("localhost");
|
||||
result.add(hostNameField);
|
||||
|
||||
result.add(new JLabel("Port"));
|
||||
hostPortField = new JTextField("27017");
|
||||
result.add(hostPortField);
|
||||
|
||||
result.add(new JLabel("Database"));
|
||||
databaseField = new JTextField("lefiona");
|
||||
result.add(databaseField);
|
||||
|
||||
JButton fileButton = new JButton("Connect");
|
||||
fileButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MetaModelDataContextMongodb ds = new MetaModelDataContextMongodb();
|
||||
ds.setHostname(hostNameField.getText());
|
||||
ds.setPort(new Integer(hostPortField.getText()));
|
||||
ds.setDatabase(databaseField.getText());
|
||||
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(ds.getDatabase());
|
||||
schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
result.add(new JLabel(""));
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Enumeration;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ui.PatternLogFormatter;
|
||||
|
||||
public class JConsolePanel extends JPanel implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = 485766723433479054L;
|
||||
private UILogHandler logHandler = null;
|
||||
private JButton clearButton = null;
|
||||
private JComboBox levelBox = null;
|
||||
private JTextArea logTextArea = null;
|
||||
private JCheckBox autoScrollBox = null;
|
||||
private int logLinesMax = 255;
|
||||
|
||||
public JConsolePanel() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
JPanel wrap = new JPanel();
|
||||
wrap.setLayout(new SpringLayout());
|
||||
wrap.add(createHeader());
|
||||
wrap.add(createEditor());
|
||||
SpringLayoutGrid.makeCompactGrid(wrap,2,1);
|
||||
add(wrap);
|
||||
|
||||
Logger rootLogger = Logger.getAnonymousLogger();
|
||||
while (rootLogger.getParent()!=null) {
|
||||
rootLogger = rootLogger.getParent();
|
||||
}
|
||||
|
||||
logHandler = new UILogHandler();
|
||||
logHandler.setFormatter(new PatternLogFormatter());
|
||||
rootLogger.addHandler(logHandler);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This needs release if playing the the this tab add/removal very multiple times.
|
||||
*/
|
||||
public void release() {
|
||||
Logger rootLogger = Logger.getAnonymousLogger();
|
||||
while (rootLogger.getParent()!=null) {
|
||||
rootLogger = rootLogger.getParent();
|
||||
}
|
||||
rootLogger.removeHandler(logHandler);
|
||||
}
|
||||
|
||||
private JPanel createHeader() {
|
||||
JPanel result = new JPanel();
|
||||
result.setBorder(BorderFactory.createLineBorder(Color.BLUE));
|
||||
result.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
result.add(new JLabel("Log Level"));
|
||||
levelBox = new JComboBox(new Level[] {Level.OFF,Level.SEVERE,Level.WARNING,Level.INFO,Level.FINE,Level.FINER,Level.FINEST,Level.ALL});
|
||||
levelBox.setSelectedItem(Level.INFO);
|
||||
levelBox.addActionListener(this);
|
||||
result.add(levelBox);
|
||||
clearButton = new JButton("Clear");
|
||||
clearButton.addActionListener(this);
|
||||
result.add(clearButton);
|
||||
autoScrollBox = new JCheckBox("Autoscroll");
|
||||
autoScrollBox.setSelected(true);
|
||||
result.add(autoScrollBox);
|
||||
return result;
|
||||
}
|
||||
|
||||
private JPanel createEditor() {
|
||||
JPanel result = new JPanel();
|
||||
result.setBorder(BorderFactory.createLineBorder(Color.BLUE));
|
||||
logTextArea = new JTextArea(5, 80);
|
||||
logTextArea.setAutoscrolls(true);
|
||||
logTextArea.setEditable(false);
|
||||
JScrollPane logScrollPane = new JScrollPane(logTextArea);
|
||||
logScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
logScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
logScrollPane.getViewport().setOpaque(false);
|
||||
result.add(logScrollPane);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (clearButton.equals(e.getSource())) {
|
||||
logTextArea.setText("");
|
||||
} else if (levelBox.equals(e.getSource()) && levelBox.getSelectedIndex()!=-1) {
|
||||
Level level = (Level)levelBox.getSelectedItem();
|
||||
logHandler.setLevel(level);
|
||||
Enumeration<String> loggers = LogManager.getLogManager().getLoggerNames();
|
||||
while (loggers.hasMoreElements()) {
|
||||
String name = loggers.nextElement();
|
||||
Logger logger = LogManager.getLogManager().getLogger(name);
|
||||
if (logger!=null && name.contains("pulsefire")) {
|
||||
logger.setLevel(level); // only set pulsefire code loggers
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UILogHandler extends Handler {
|
||||
@Override
|
||||
public void close() throws SecurityException {
|
||||
}
|
||||
@Override
|
||||
public void flush() {
|
||||
}
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
final String recordStr = getFormatter().format(record);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
logTextArea.append(recordStr);
|
||||
if (logTextArea.getLineCount() > logLinesMax) {
|
||||
String t = logTextArea.getText();
|
||||
int l = 0;
|
||||
int rm = logLinesMax/2;
|
||||
for (int i=0;i<rm;i++) {
|
||||
int ll = t.indexOf('\n',l+1);
|
||||
if (ll==-1) {
|
||||
break;
|
||||
}
|
||||
l = ll;
|
||||
}
|
||||
String tt = t.substring(l,t.length());
|
||||
logTextArea.setText(tt);
|
||||
}
|
||||
if (autoScrollBox.isSelected()) {
|
||||
logTextArea.setCaretPosition(logTextArea.getText().length());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,355 +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.demo.tech.ui.components;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.demo.tech.core.DemoVascManager;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
public class JMainPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
private DemoVascManager vascManager = null;
|
||||
private SwingPanelIntegration spi = null;
|
||||
private JTabbedPane tabPane = null;
|
||||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
|
||||
|
||||
public JMainPanel() {
|
||||
this.vascManager=TechUI.getInstance().getVascManager();
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private JSplitPane createBottomSplit() {
|
||||
JSplitPane sp0 = createTreeSplit();
|
||||
JPanel sp1 = new JConsolePanel();
|
||||
bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sp0,sp1);
|
||||
bottomSplitPane.setOneTouchExpandable(true);
|
||||
bottomSplitPane.setResizeWeight(0.2);
|
||||
bottomSplitPane.setDividerLocation(750);
|
||||
sp0.setMinimumSize(new Dimension(400, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 150));
|
||||
return bottomSplitPane;
|
||||
}
|
||||
|
||||
private JSplitPane createTreeSplit() {
|
||||
JScrollPane sp0 = createTreePane();
|
||||
JScrollPane sp1 = createContentPane();
|
||||
treeSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp0,sp1);
|
||||
treeSplitPane.setOneTouchExpandable(true);
|
||||
treeSplitPane.setResizeWeight(0.7);
|
||||
treeSplitPane.setDividerLocation(200);
|
||||
sp0.setMinimumSize(new Dimension(200, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 400));
|
||||
return treeSplitPane;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class VascTreeModel extends DefaultTreeModel {
|
||||
public VascTreeModel(TreeNode root) {
|
||||
super(root);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -7436681803506994277L;
|
||||
|
||||
@Override
|
||||
public void addTreeModelListener(TreeModelListener l) {
|
||||
super.addTreeModelListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
private JScrollPane createTreePane() {
|
||||
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.NONE,null));
|
||||
|
||||
vascTree = new JTree(new VascTreeModel(root));
|
||||
vascTree.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
super.mouseClicked(e);
|
||||
if (e.getClickCount() == 2 && vascTree.getSelectionModel().isSelectionEmpty()==false) {
|
||||
try {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)vascTree.getSelectionModel().getSelectionPath().getLastPathComponent();
|
||||
if (node.getUserObject() instanceof String) {
|
||||
return;
|
||||
}
|
||||
VascTreeNode vascNode = (VascTreeNode)node.getUserObject();
|
||||
if (vascNode != null) {
|
||||
if (vascNode.type == VascTreeNodeType.ENTRY) {
|
||||
VascEntry ee = vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.id).clone();
|
||||
DefaultVascFactory.fillVascEntryFrontend(ee, vascManager.getVascController(), DefaultVascFactory.getDefaultVascFrontendData("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle",new Locale("en")));
|
||||
spi.createNewVascView(ee);
|
||||
}
|
||||
}
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JPanel treePanel = new JPanel();
|
||||
treePanel.setLayout(new GridLayout(1,0));
|
||||
JScrollPane p = createJScrollPane(treePanel);
|
||||
p.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
p.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
treePanel.add(vascTree);
|
||||
|
||||
rebuildTree();
|
||||
return p;
|
||||
}
|
||||
|
||||
private JScrollPane createContentPane() {
|
||||
JPanel contentPane = new JPanel();
|
||||
contentPane.setLayout(new GridLayout(1,0));
|
||||
JScrollPane p = createJScrollPane(contentPane);
|
||||
|
||||
tabPane = new JTabbedPane();
|
||||
spi = new SwingPanelTabbed(tabPane);
|
||||
contentPane.add(tabPane);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private JScrollPane createJScrollPane(JPanel innerPanel) {
|
||||
JScrollPane scrollPane = new JScrollPane(innerPanel);
|
||||
scrollPane.setBorder(BorderFactory.createEmptyBorder());
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.getVerticalScrollBar().setUnitIncrement(10);
|
||||
scrollPane.getHorizontalScrollBar().setUnitIncrement(10);
|
||||
//innerPanel.setParentScrollPane(scrollPane);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
class VascTreeNode {
|
||||
public VascTreeNode() {}
|
||||
public VascTreeNode(VascTreeNodeType type,String id) { this.type=type;this.id=id; }
|
||||
public VascTreeNode(VascTreeNodeType type,String id,String entryId) { this.type=type;this.id=id;this.entryId=entryId; }
|
||||
VascTreeNodeType type;
|
||||
String id;
|
||||
String entryId;
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
enum VascTreeNodeType {
|
||||
NONE,
|
||||
FIELD_TYPE,
|
||||
BACKEND,
|
||||
ENTRY
|
||||
}
|
||||
|
||||
public void rebuildTree() {
|
||||
|
||||
DefaultMutableTreeNode root = (DefaultMutableTreeNode)vascTree.getModel().getRoot();
|
||||
root.removeAllChildren();
|
||||
|
||||
DefaultMutableTreeNode fieldTypes = new DefaultMutableTreeNode("VascFieldTypes");
|
||||
for (String id:vascManager.getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
|
||||
DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.FIELD_TYPE,id));
|
||||
fieldTypes.add(typeNode);
|
||||
}
|
||||
root.add(fieldTypes);
|
||||
|
||||
DefaultMutableTreeNode backends = new DefaultMutableTreeNode("VascBackends");
|
||||
for (String id:vascManager.getVascController().getVascBackendController().getVascBackendIds()) {
|
||||
DefaultMutableTreeNode backendNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.BACKEND,id));
|
||||
backends.add(backendNode);
|
||||
}
|
||||
root.add(backends);
|
||||
|
||||
DefaultMutableTreeNode entries = new DefaultMutableTreeNode("VascEntries");
|
||||
for (String id:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
//VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(id);
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,id));
|
||||
entries.add(entryNode);
|
||||
/*
|
||||
DefaultMutableTreeNode fields = new DefaultMutableTreeNode("Fields");
|
||||
for (VascEntryField vef:ve.getVascEntryFields()) {
|
||||
DefaultMutableTreeNode vefNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD,vef.getId(),id));
|
||||
fields.add(vefNode);
|
||||
}
|
||||
entryNode.add(fields);
|
||||
|
||||
DefaultMutableTreeNode fieldSets = new DefaultMutableTreeNode("FieldSets");
|
||||
for (VascEntryFieldSet vefs:ve.getVascEntryFieldSets()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vefs.getId(),id));
|
||||
fieldSets.add(vefsNode);
|
||||
}
|
||||
entryNode.add(fieldSets);
|
||||
|
||||
DefaultMutableTreeNode links = new DefaultMutableTreeNode("Links");
|
||||
for (VascLinkEntry vle:ve.getVascLinkEntries()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vle.getId()));
|
||||
links.add(vefsNode);
|
||||
}
|
||||
entryNode.add(links);
|
||||
|
||||
DefaultMutableTreeNode filters = new DefaultMutableTreeNode("Backend Filters");
|
||||
for (VascBackendFilter vbf:ve.getVascBackendFilters()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vbf.getClass().getSimpleName()));
|
||||
filters.add(vefsNode);
|
||||
}
|
||||
entryNode.add(links);
|
||||
|
||||
DefaultMutableTreeNode param = new DefaultMutableTreeNode("Backend Parameters");
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,key));
|
||||
param.add(vefsNode);
|
||||
}
|
||||
entryNode.add(param);
|
||||
|
||||
|
||||
DefaultMutableTreeNode options = new DefaultMutableTreeNode("List Options");
|
||||
for (VascEntryField vef:ve.getListOptions()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vef.getId()));
|
||||
options.add(vefsNode);
|
||||
}
|
||||
entryNode.add(options);
|
||||
*/
|
||||
}
|
||||
root.add(entries);
|
||||
|
||||
SwingUtilities.updateComponentTreeUI(vascTree);
|
||||
|
||||
|
||||
// todo move
|
||||
Map<String,String> keys = new HashMap<String,String>(300);
|
||||
VascBundleCheckEntryKeys checker = new VascBundleCheckEntryKeys(ResourceBundle.getBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle"));
|
||||
for (String veId:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(veId);
|
||||
keys.putAll(checker.generateMissingKeys(ve));
|
||||
}
|
||||
if (keys.isEmpty()==false) {
|
||||
Properties p = new Properties();
|
||||
File dataDir = new File("data");
|
||||
|
||||
if (dataDir.exists()==false) {
|
||||
dataDir.mkdirs();
|
||||
}
|
||||
File resourceFile = new File("data/vasc-bundle.properties");
|
||||
if (resourceFile.exists()) {
|
||||
readPropertiesFile(p,resourceFile);
|
||||
}
|
||||
for (String key:keys.keySet()) {
|
||||
p.put(key, keys.get(key));
|
||||
}
|
||||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
ResourceBundle.clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return tabPane;
|
||||
}
|
||||
|
||||
protected void writePropertiesFile(Properties p,File file) {
|
||||
try {
|
||||
writePropertiesStream(p,new FileOutputStream(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void readPropertiesFile(Properties p,File file) {
|
||||
try {
|
||||
readPropertiesStream(p,new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void writePropertiesStream(Properties p,OutputStream out) {
|
||||
try {
|
||||
p.store(out, "Saved by vasc auto i18n.");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
|
||||
} finally {
|
||||
if (out!=null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void readPropertiesStream(Properties p,InputStream in) {
|
||||
try {
|
||||
p.load(in);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui.components;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaCsv;
|
||||
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaJdbc;
|
||||
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaMongodb;
|
||||
|
||||
public class JMainPanelMenuBar extends JMenuBar {
|
||||
|
||||
private static final long serialVersionUID = -2828428804621352725L;
|
||||
JMenu fileMenu = new JMenu("File");
|
||||
JMenu vascMenu = new JMenu("Vasc");
|
||||
JMenu tabMenu = new JMenu("Tabs");
|
||||
|
||||
public JMainPanelMenuBar() {
|
||||
createMenuItems();
|
||||
add(fileMenu);
|
||||
add(vascMenu);
|
||||
add(tabMenu);
|
||||
}
|
||||
|
||||
|
||||
private void createMenuItems() {
|
||||
JMenuItem openXmlItem = new JMenuItem("Import Xml");
|
||||
openXmlItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
TechUI.getInstance().getVascManager().openFile(file);
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
fileMenu.add(openXmlItem);
|
||||
//JMenuItem closeXmlItem = new JMenuItem("Close");
|
||||
//fileMenu.add(closeXmlItem);
|
||||
fileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
TechUI.getInstance().exit();
|
||||
}
|
||||
});
|
||||
fileMenu.add(exitItem);
|
||||
|
||||
JMenuItem connectVascItem = new JMenuItem("Add Vasc");
|
||||
connectVascItem.setEnabled(false);
|
||||
connectVascItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectVascItem);
|
||||
|
||||
JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
|
||||
connectLdapItem.setEnabled(false);
|
||||
vascMenu.add(connectLdapItem);
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
|
||||
connectMetaCsvItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialogMetaCsv d = new JDialogMetaCsv(TechUI.getInstance().getMainFrame());
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectMetaCsvItem);
|
||||
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
|
||||
connectMetaXmlItem.setEnabled(false);
|
||||
vascMenu.add(connectMetaXmlItem);
|
||||
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
|
||||
connectMetaMongoItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialogMetaMongodb d = new JDialogMetaMongodb(TechUI.getInstance().getMainFrame());
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectMetaMongoItem);
|
||||
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
|
||||
connectMetaJdbcItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialogMetaJdbc d = new JDialogMetaJdbc(TechUI.getInstance().getMainFrame());
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectMetaJdbcItem);
|
||||
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem removeEntryItem = new JMenuItem("Remove entry");
|
||||
removeEntryItem.setEnabled(false);
|
||||
removeEntryItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeEntryItem);
|
||||
|
||||
JMenuItem removeAllItem = new JMenuItem("Remove all");
|
||||
removeAllItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascBackendControllerLocal backends = (VascBackendControllerLocal)TechUI.getInstance().getVascManager().getVascController().getVascBackendController();
|
||||
VascEntryControllerLocal entries = (VascEntryControllerLocal)TechUI.getInstance().getVascManager().getVascController().getVascEntryController();
|
||||
for (String entryId:entries.getVascEntryIds()) {
|
||||
if (entryId.startsWith("Vasc")) {
|
||||
continue;
|
||||
}
|
||||
entries.removeVascEntry(entryId);
|
||||
}
|
||||
for (String backendId:backends.getVascBackendIds()) {
|
||||
if (backendId.startsWith("Vasc")) {
|
||||
continue;
|
||||
}
|
||||
backends.removeVascBackendById(backendId);
|
||||
}
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeAllItem);
|
||||
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).getTabPane();
|
||||
if (tabPane.getSelectedIndex()>=0) {
|
||||
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
tabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).getTabPane();
|
||||
for (int i=tabPane.getTabCount();i>0;i--) {
|
||||
tabPane.removeTabAt(i-1); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
tabMenu.add(itemAll);
|
||||
}
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2011, Willem Cazander
|
||||
* 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.demo.tech.ui.components;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
|
||||
import javax.swing.Spring;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
|
||||
/**
|
||||
* SpringLayoutGrid, someone should create an JCP to get these functions into
|
||||
* SpringLayout object because this code is to much duplicated on many projects.
|
||||
*
|
||||
* A 1.4 file that provides utility methods for creating form- or grid-style
|
||||
* layouts with SpringLayout. These utilities are used by several programs, such
|
||||
* as SpringBox and SpringCompactGrid.
|
||||
*/
|
||||
public class SpringLayoutGrid {
|
||||
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code>*<code>cols</code> components of
|
||||
* <code>parent</code> in a grid. Each component is as big as the maximum
|
||||
* preferred width and height of the components. The parent is made just big
|
||||
* enough to fit them all.
|
||||
*
|
||||
* @param rows
|
||||
* number of rows
|
||||
* @param cols
|
||||
* number of columns
|
||||
* @param initialX
|
||||
* x location to start the grid at
|
||||
* @param initialY
|
||||
* y location to start the grid at
|
||||
* @param xPad
|
||||
* x padding between cells
|
||||
* @param yPad
|
||||
* y padding between cells
|
||||
*/
|
||||
public static void makeGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
|
||||
SpringLayout layout;
|
||||
try {
|
||||
layout = (SpringLayout) parent.getLayout();
|
||||
} catch (ClassCastException exc) {
|
||||
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
|
||||
}
|
||||
|
||||
Spring xPadSpring = Spring.constant(xPad);
|
||||
Spring yPadSpring = Spring.constant(yPad);
|
||||
Spring initialXSpring = Spring.constant(initialX);
|
||||
Spring initialYSpring = Spring.constant(initialY);
|
||||
int max = rows * cols;
|
||||
|
||||
//Calculate Springs that are the max of the width/height so that all
|
||||
//cells have the same size.
|
||||
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0))
|
||||
.getWidth();
|
||||
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0))
|
||||
.getWidth();
|
||||
for (int i = 1; i < max; i++) {
|
||||
SpringLayout.Constraints cons = layout.getConstraints(parent
|
||||
.getComponent(i));
|
||||
|
||||
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
|
||||
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
|
||||
}
|
||||
|
||||
//Apply the new width/height Spring. This forces all the
|
||||
//components to have the same size.
|
||||
for (int i = 0; i < max; i++) {
|
||||
SpringLayout.Constraints cons = layout.getConstraints(parent
|
||||
.getComponent(i));
|
||||
|
||||
cons.setWidth(maxWidthSpring);
|
||||
cons.setHeight(maxHeightSpring);
|
||||
}
|
||||
|
||||
//Then adjust the x/y constraints of all the cells so that they
|
||||
//are aligned in a grid.
|
||||
SpringLayout.Constraints lastCons = null;
|
||||
SpringLayout.Constraints lastRowCons = null;
|
||||
for (int i = 0; i < max; i++) {
|
||||
SpringLayout.Constraints cons = layout.getConstraints(parent
|
||||
.getComponent(i));
|
||||
if (i % cols == 0) { //start of new row
|
||||
lastRowCons = lastCons;
|
||||
cons.setX(initialXSpring);
|
||||
} else { //x position depends on previous component
|
||||
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
|
||||
xPadSpring));
|
||||
}
|
||||
|
||||
if (i / cols == 0) { //first row
|
||||
cons.setY(initialYSpring);
|
||||
} else { //y position depends on previous row
|
||||
cons.setY(Spring.sum(lastRowCons
|
||||
.getConstraint(SpringLayout.SOUTH), yPadSpring));
|
||||
}
|
||||
lastCons = cons;
|
||||
}
|
||||
|
||||
//Set the parent's size.
|
||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
||||
pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring
|
||||
.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH)));
|
||||
pCons.setConstraint(SpringLayout.EAST, Spring.sum(
|
||||
Spring.constant(xPad), lastCons
|
||||
.getConstraint(SpringLayout.EAST)));
|
||||
}
|
||||
|
||||
/* Used by makeCompactGrid. */
|
||||
private static SpringLayout.Constraints getConstraintsForCell(int row,
|
||||
int col, Container parent, int cols) {
|
||||
SpringLayout layout = (SpringLayout) parent.getLayout();
|
||||
Component c = parent.getComponent(row * cols + col);
|
||||
return layout.getConstraints(c);
|
||||
}
|
||||
|
||||
|
||||
public static void makeCompactGrid(Container parent, int rows, int cols) {
|
||||
makeCompactGrid(parent,rows,cols,6,6,6,6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code>*<code>cols</code> components of
|
||||
* <code>parent</code> in a grid. Each component in a column is as wide as
|
||||
* the maximum preferred width of the components in that column; height is
|
||||
* similarly determined for each row. The parent is made just big enough to
|
||||
* fit them all.
|
||||
*
|
||||
* @param rows
|
||||
* number of rows
|
||||
* @param cols
|
||||
* number of columns
|
||||
* @param initialX
|
||||
* x location to start the grid at
|
||||
* @param initialY
|
||||
* y location to start the grid at
|
||||
* @param xPad
|
||||
* x padding between cells
|
||||
* @param yPad
|
||||
* y padding between cells
|
||||
*/
|
||||
public static void makeCompactGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
|
||||
SpringLayout layout;
|
||||
try {
|
||||
layout = (SpringLayout) parent.getLayout();
|
||||
} catch (ClassCastException exc) {
|
||||
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
|
||||
}
|
||||
|
||||
//Align all cells in each column and make them the same width.
|
||||
Spring x = Spring.constant(initialX);
|
||||
for (int c = 0; c < cols; c++) {
|
||||
Spring width = Spring.constant(0);
|
||||
for (int r = 0; r < rows; r++) {
|
||||
width = Spring.max(width, getConstraintsForCell(r, c, parent,
|
||||
cols).getWidth());
|
||||
}
|
||||
for (int r = 0; r < rows; r++) {
|
||||
SpringLayout.Constraints constraints = getConstraintsForCell(r,
|
||||
c, parent, cols);
|
||||
constraints.setX(x);
|
||||
constraints.setWidth(width);
|
||||
}
|
||||
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
|
||||
}
|
||||
|
||||
//Align all cells in each row and make them the same height.
|
||||
Spring y = Spring.constant(initialY);
|
||||
for (int r = 0; r < rows; r++) {
|
||||
Spring height = Spring.constant(0);
|
||||
for (int c = 0; c < cols; c++) {
|
||||
height = Spring.max(height, getConstraintsForCell(r, c, parent,
|
||||
cols).getHeight());
|
||||
}
|
||||
for (int c = 0; c < cols; c++) {
|
||||
SpringLayout.Constraints constraints = getConstraintsForCell(r,
|
||||
c, parent, cols);
|
||||
constraints.setY(y);
|
||||
constraints.setHeight(height);
|
||||
}
|
||||
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
|
||||
}
|
||||
|
||||
//Set the parent's size.
|
||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
||||
pCons.setConstraint(SpringLayout.SOUTH, y);
|
||||
pCons.setConstraint(SpringLayout.EAST, x);
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# bundle list to merge and load
|
||||
bundle1.uri=net.forwardfire.vasc.demo.tech.ui.resources.TechUI
|
||||
|
||||
bundle2.uri=data/vasc-bundle.properties
|
||||
bundle2.type=FILE
|
||||
bundle2.optional=true
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2011, Willem Cazander
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Application's properties
|
||||
Application.name = Vasc Demo Tech
|
||||
Application.title = VascDemoTech
|
||||
Application.vendor = Willem Cazander
|
||||
Application.homepage = http://vasc.forwardfire.org/
|
||||
Application.vendorId = vasc
|
||||
Application.id = vascdemotech
|
||||
Application.lookAndFeel = com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
|
||||
#Application.icon = images/icon.png
|
||||
|
||||
|
||||
generic.active.labelText = active
|
||||
generic.active.toolTipText = active
|
||||
generic.createdDate.labelText = createdDate
|
||||
generic.createdDate.toolTipText = createdDate
|
||||
generic.description.labelText = description
|
||||
generic.description.toolTipText = description
|
||||
generic.id.labelText = id
|
||||
generic.id.toolTipText = id
|
||||
generic.modifiedDate.labelText = modifiedDate
|
||||
generic.modifiedDate.toolTipText = modifiedDate
|
||||
generic.name.labelText = name
|
||||
generic.name.toolTipText = name
|
||||
generic.orderNumber.labelText = orderNumber
|
||||
generic.orderNumber.toolTipText = orderNumber
|
||||
|
||||
# hibernate validators
|
||||
validator.assertFalse=assertion failed
|
||||
validator.assertTrue=assertion failed
|
||||
validator.future=Date must lie in the future
|
||||
validator.length=Field must contain between {min} and {max} characters.
|
||||
validator.max=Value must be equal to or lower than {value}
|
||||
validator.min=Value must be equal to or higher than {value}
|
||||
validator.notNull=A value must be entered
|
||||
validator.past=Date must lie in the future
|
||||
validator.pattern=Value must conform to "{regex}"
|
||||
validator.range=Value must lie between {min} and {max}
|
||||
validator.size=There must be between {min} and {max} characters
|
||||
validator.email=The value must be a valid e-mail address
|
||||
|
||||
# vasc validators
|
||||
vasc.validator.VascDateFutureValidator=The date must lie in the future.
|
||||
vasc.validator.VascDatePastValidator=The date must lie in the past.
|
||||
vasc.validator.VascIntSizeValidator=Value must lie between {0} and {1}
|
||||
vasc.validator.VascLongSizeValidator=Value must lie between {0} and {1}
|
||||
vasc.validator.VascObjectNotNullValidator=A value must be entered
|
||||
vasc.validator.VascObjectNullValidator=No value may be entered
|
||||
vasc.validator.VascStringEmailValidator=The value must be a valid e-mail address
|
||||
vasc.validator.VascStringLengthValidator=There must be at least {0} and at most {1} items
|
||||
vasc.validator.VascStringRegexValidator=Value must conform to "{0}"
|
||||
vasc.validator.VascStringZipCodeValidator=Value must be a valid post code.
|
||||
|
||||
# Vasc actions labels
|
||||
vasc.action.addRowAction.description = add a new record
|
||||
vasc.action.addRowAction.name = Add
|
||||
vasc.action.deleteRowAction.description = delete
|
||||
vasc.action.deleteRowAction.name = delete
|
||||
vasc.action.downloadAction.description = Select this record.
|
||||
vasc.action.downloadAction.name = Select
|
||||
vasc.action.editRowAction.description = edit
|
||||
vasc.action.editRowAction.name = Edit
|
||||
|
||||
vasc.action.csvExportAction.description = CSV
|
||||
vasc.action.csvExportAction.name = CSV
|
||||
vasc.action.xmlExportAction.description = XML
|
||||
vasc.action.xmlExportAction.name = XML
|
||||
vasc.action.xmltreeExportAction.description = XMLTree
|
||||
vasc.action.xmltreeExportAction.name = XMLTree
|
||||
vasc.action.jrPdfLandscapeExportAction.description = jrPdfLandscape
|
||||
vasc.action.jrPdfLandscapeExportAction.name = PDF-Landscape
|
||||
vasc.action.jrPdfPortraitExportAction.description = jrPdfPortrait
|
||||
vasc.action.jrPdfPortraitExportAction.name = PDF-Portrait
|
||||
vasc.action.jrRtfExportAction.description = RTF
|
||||
vasc.action.jrRtfExportAction.name = RTF
|
||||
vasc.action.jrXlsExportAction.description = XLS
|
||||
vasc.action.jrXlsExportAction.name = XLS
|
||||
vasc.action.jrXmlExportAction.description = JR-XML
|
||||
vasc.action.jrXmlExportAction.name = JR-XML
|
||||
vasc.action.jrCsvExportAction.description = JR-CSV
|
||||
vasc.action.jrCsvExportAction.name = JR-CSV
|
||||
|
||||
|
||||
# Temp jsf
|
||||
generic.vasc.jsf.listOption.header = Searchoptions
|
||||
generic.vasc.jsf.listOption.search = Searh\:
|
||||
generic.vasc.jsf.listOption.sumbit = Search
|
||||
generic.vasc.jsf.pager.previous = Previous
|
||||
generic.vasc.jsf.pager.next = Next
|
||||
generic.vasc.jsf.table.rows = Row Numbers\:
|
||||
generic.vasc.jsf.table.pagerDirect = Go to\:
|
||||
generic.vasc.jsf.table.downloadDirect = Download\:
|
||||
generic.vasc.jsf.table.resultText = Results {0}-{1} from {2} rows
|
||||
generic.vasc.jsf.table.download.img = Save table data.
|
||||
generic.vasc.jsf.table.printer.img = Shows the table in printer friendly format.
|
||||
generic.vasc.jsf.table.export.select = ...
|
||||
generic.vasc.jsf.table.export.select.alt = Select Export
|
||||
generic.vasc.jsf.table.page.select = ...
|
||||
generic.vasc.jsf.table.page.select.alt = Select Page
|
||||
generic.vasc.jsf.table.page.name = Page:
|
||||
generic.vasc.jsf.table.page.description = Goto page:
|
||||
generic.vasc.jsf.tableHeader.fields = Fields
|
||||
generic.vasc.jsf.tableHeader.links = Links
|
||||
generic.vasc.jsf.tableHeader.actions = Actions
|
||||
generic.vasc.jsf.multiAction.selectAll = Select all:
|
||||
generic.vasc.jsf.multiAction.name = ...
|
||||
generic.vasc.jsf.multiAction.description = Select Action
|
||||
generic.vasc.jsf.action.save = Save
|
||||
generic.vasc.jsf.action.cancel = Cancel
|
||||
generic.vasc.jsf.action.back = Back
|
||||
generic.vasc.jsf.parentSelected = Selected:
|
||||
|
||||
vasc.dialog.edit.message = Edit
|
||||
vasc.dialog.save.name = Save
|
||||
vasc.dialog.cancel.name = Cancel
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009-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.demo.tech.web.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider;
|
||||
|
||||
import net.forwardfire.vasc.frontend.VascFrontendData;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.AbstractJSFVascFacesControllerBase;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 1, 2009
|
||||
*/
|
||||
public class VascFacesController extends AbstractJSFVascFacesControllerBase {
|
||||
|
||||
|
||||
public List<String> getVascAdminEntries() {
|
||||
List<String> result = new ArrayList<String>(50);
|
||||
VascController v = getVascController();
|
||||
for (String e:v.getVascEntryController().getVascEntryIds()) {
|
||||
if (e.endsWith("Link")==false) {
|
||||
result.add(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VascFrontendData getNewVascFrontendData() {
|
||||
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
|
||||
VascFrontendData vascFrontendData = DefaultVascFactory.getDefaultVascFrontendData("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle",locale);
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
return vascFrontendData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VascController getVascController() {
|
||||
DemoVascControllerProvider provider = new DemoVascControllerProvider();
|
||||
return provider.getVascController();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
#Colors
|
||||
headerBackgroundColor=\#EAEAEA
|
||||
headerGradientColor=\#E0E0E0
|
||||
headerTextColor=#282828
|
||||
headerWeightFont=bold
|
||||
|
||||
generalBackgroundColor=#FFFFFF
|
||||
generalTextColor=#282828
|
||||
generalSizeFont=11px
|
||||
generalFamilyFont=Arial, Helvetica, sans-serif
|
||||
|
||||
controlTextColor=#282828
|
||||
controlBackgroundColor=#ffffff
|
||||
additionalBackgroundColor=#ffffff
|
||||
|
||||
shadowBackgroundColor=#000000
|
||||
shadowOpacity=1
|
||||
|
||||
panelBorderColor=#BED6F8
|
||||
subBorderColor=#ffffff
|
||||
|
||||
tabBackgroundColor=#C6DEFF
|
||||
tabDisabledTextColor=#ffffff
|
||||
|
||||
trimColor=#D6E6FB
|
||||
|
||||
tipBackgroundColor=\#FAE6B0
|
||||
tipBorderColor=\#E5973E
|
||||
|
||||
selectControlColor=#E79A00
|
||||
|
||||
|
||||
generalLinkColor=#004DEB
|
||||
hoverLinkColor=#004DEB
|
||||
visitedLinkColor=#004DEB
|
||||
|
||||
# Fonts
|
||||
headerSizeFont=11px
|
||||
headerFamilyFont=Arial, Helvetica, sans-serif
|
||||
|
||||
tabSizeFont=11
|
||||
tabFamilyFont=Arial, Helvetica, sans-serif
|
||||
|
||||
buttonSizeFont=11
|
||||
buttonFamilyFont=Arial, Verdana, sans-serif
|
||||
|
||||
|
||||
tableBackgroundColor=#FFFFFF
|
||||
tableFooterBackgroundColor=#FFFFFF
|
||||
tableSubfooterBackgroundColor=#FFFFFF
|
||||
|
||||
|
||||
#Calendar colors
|
||||
calendarWeekBackgroundColor=#F5F5F5
|
||||
|
||||
calendarHolidaysBackgroundColor=#FFEBDA
|
||||
calendarHolidaysTextColor=#FF7800
|
||||
|
||||
calendarCurrentBackgroundColor=#FF7800
|
||||
calendarCurrentTextColor=#FFEBDA
|
||||
|
||||
calendarSpecBackgroundColor=#E4F5E2
|
||||
calendarSpecTextColor=#000000
|
||||
|
||||
|
||||
warningColor=#282828
|
||||
warningBackgroundColor=##EE0000
|
||||
|
||||
editorBackgroundColor=#F1F1F1
|
||||
editBackgroundColor=#FEFFDA
|
||||
|
||||
#Gradients
|
||||
gradientType=plain
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
|
||||
<faces-config>
|
||||
|
||||
<application>
|
||||
<locale-config>
|
||||
<default-locale>en</default-locale>
|
||||
</locale-config>
|
||||
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
|
||||
</application>
|
||||
|
||||
<managed-bean>
|
||||
<description>Controls the Users</description>
|
||||
<managed-bean-name>userController</managed-bean-name>
|
||||
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.UserController</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>Controls Vasc Faces</description>
|
||||
<managed-bean-name>vascFacesController</managed-bean-name>
|
||||
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.VascFacesController</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>Controls Vasc Export Url Generator</description>
|
||||
<managed-bean-name>exportController</managed-bean-name>
|
||||
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.ExportController</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
</faces-config>
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
/* CSS fixes for IE6 */
|
||||
|
||||
/*
|
||||
#page_menu_left {
|
||||
overflow: visible;
|
||||
}
|
||||
*/
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
/* CSS fixes for IE7 */
|
||||
|
||||
/*
|
||||
#page_menu_left {
|
||||
overflow: visible;
|
||||
}
|
||||
*/
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
/* CSS fixes for IE8 */
|
||||
|
||||
/* Yet to come */
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
|
@ -1,63 +0,0 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<ui:composition template="/jsp/includes/layout.xhtml">
|
||||
<ui:define name="title">Vasc Admin</ui:define>
|
||||
<ui:define name="content">
|
||||
<h:panelGrid columns="4" id="grid" width="100%">
|
||||
<rich:panel style="width:80%;">
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Vasc Admin" />
|
||||
</f:facet>
|
||||
<rich:dataList var="info" value="#{vascFacesController.vascAdminEntries}">
|
||||
<h:column>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/vasc/#{info}/list.jsf"><h:outputText value="#{info}"/></h:outputLink>
|
||||
</h:column>
|
||||
</rich:dataList>
|
||||
</rich:panel>
|
||||
<rich:panel style="width:80%;">
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Export Servlet" />
|
||||
</f:facet>
|
||||
<h:form>
|
||||
<h:panelGrid columns="2" width="100%">
|
||||
<h:outputText value="Entry:"/>
|
||||
<h:selectOneMenu value="#{exportController.entryId}" onchange="javascript:this.form.submit(); return false;">
|
||||
<f:selectItems value="#{exportController.entryIdSelectItems}"/>
|
||||
</h:selectOneMenu>
|
||||
|
||||
<h:outputText value="Type:"/>
|
||||
<h:selectOneMenu value="#{exportController.exportType}" onchange="javascript:this.form.submit(); return false;">
|
||||
<f:selectItems value="#{exportController.exportTypeSelectItems}"/>
|
||||
</h:selectOneMenu>
|
||||
|
||||
<h:outputText value="tree-url:"/>
|
||||
<h:selectBooleanCheckbox value="#{exportController.exportTree}" onchange="javascript:this.form.submit(); return false;"/>
|
||||
</h:panelGrid>
|
||||
<h:panelGrid columns="2" width="100%">
|
||||
<h:outputText value="Url:"/>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/#{exportController.buildExportUrl}">
|
||||
<h:outputText value="#{facesContext.externalContext.requestContextPath}/#{exportController.buildExportUrl}"/>
|
||||
</h:outputLink>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
</rich:panel>
|
||||
<rich:panel>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="WebService Servlet" />
|
||||
</f:facet>
|
||||
<h:outputText value="todo" />
|
||||
</rich:panel>
|
||||
<rich:panel>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="WebStart" />
|
||||
</f:facet>
|
||||
<h:outputText value="todo" />
|
||||
</rich:panel>
|
||||
</h:panelGrid>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<ui:define name="title">Help</ui:define>
|
||||
<ui:define name="content"><h:outputText value="Help"/></ui:define>
|
||||
</ui:composition>
|
|
@ -1,15 +0,0 @@
|
|||
<ui:composition
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<rich:panel header="User Greeter" style="width: 315px">
|
||||
<h2><h:outputText value="Hello User" /></h2>
|
||||
<h:outputLink value="user/index.jsf">
|
||||
<h:outputText value="Login" />
|
||||
</h:outputLink>
|
||||
<h:outputText value="Already Loggedin."/>
|
||||
</rich:panel>
|
||||
</ui:composition>
|
|
@ -1,16 +0,0 @@
|
|||
<ui:composition
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<rich:panel header="User Greeter" style="width: 315px">
|
||||
<h2><h:outputText value="Hello User" /></h2>
|
||||
<h:outputText value="Name: " />
|
||||
<h:outputText value="#{userController.flowUser.username}" />
|
||||
<rich:dataList value="#{userController.rightRoles}" var="role">
|
||||
<h:outputText value="#{role.roleKey}" />
|
||||
</rich:dataList>
|
||||
</rich:panel>
|
||||
</ui:composition>
|
|
@ -1,71 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
|
||||
<meta name="robots" content="noodp"/>
|
||||
<meta http-equiv="Pragma" content="no-cache"/>
|
||||
<meta name="description" content="vasc"/>
|
||||
<meta name="keywords" content="demo,forwardfire,x4o,vasc,java"/>
|
||||
<title><ui:insert name="title">Default title</ui:insert></title>
|
||||
<link href="#{facesContext.externalContext.requestContextPath}/css/site.css" rel="stylesheet" type="text/css"/>
|
||||
<!--[if IE 6]><link href="#{facesContext.externalContext.requestContextPath}/css/ie6_fixes.css" rel="stylesheet" type="text/css" /><![endif]-->
|
||||
<!--[if IE 7]><link href="#{facesContext.externalContext.requestContextPath}/css/ie7_fixes.css" rel="stylesheet" type="text/css" /><![endif]-->
|
||||
<!--[if IE 8]><link href="#{facesContext.externalContext.requestContextPath}/css/ie8_fixes.css" rel="stylesheet" type="text/css" /><![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<f:view>
|
||||
<div id="page_wrap">
|
||||
<div id="page_header">
|
||||
<a href="#{facesContext.externalContext.requestContextPath}/jsp/index.jsf"><img src="#{facesContext.externalContext.requestContextPath}/img/logstats-logo.png" alt="Demo Logo" /></a>
|
||||
<div id="page_menu_left">
|
||||
</div>
|
||||
<div id="page_menu_right">
|
||||
<a href="#{facesContext.externalContext.requestContextPath}/jsp/index.jsf" class="active">Home</a>
|
||||
<a href="#{facesContext.externalContext.requestContextPath}/jsp/reports.jsf">Reports</a>
|
||||
<a href="#{facesContext.externalContext.requestContextPath}/jsp/realtime.jsf">Log</a>
|
||||
<a href="#{facesContext.externalContext.requestContextPath}/jsp/help.jsf">Help</a>
|
||||
<h:outputLink rendered="#{userController.userLoggedin}" value="#{facesContext.externalContext.requestContextPath}/jsp/admin/index.jsf">
|
||||
<h:outputText value="Admin"/>
|
||||
</h:outputLink>
|
||||
</div>
|
||||
<div id="page_user_info">
|
||||
<h:outputLink rendered="#{userController.userLoggedin == false}" value="#{facesContext.externalContext.requestContextPath}/jsp/admin/index.jsf">
|
||||
<h:outputText value="Login"/>
|
||||
</h:outputLink>
|
||||
<h:panelGroup rendered="#{userController.userLoggedin == true}">
|
||||
<h:outputText value="#{userController.user.username}"/>
|
||||
<h:outputText value=" - "/>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/jsp/login/logout.jsf">
|
||||
<h:outputText value="Logout"/>
|
||||
</h:outputLink>
|
||||
</h:panelGroup>
|
||||
</div>
|
||||
</div>
|
||||
<div id="page_content">
|
||||
<h1><ui:insert name="title" /></h1>
|
||||
<ui:insert name="content"/>
|
||||
</div>
|
||||
<div class="spacer"> </div>
|
||||
<div id="page_footer">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="4" class="text_center">Vasc Tech Demo Web.</td>
|
||||
</tr>
|
||||
<tr class="copyright">
|
||||
<td colspan="2" class="text_left">Copyright © none</td>
|
||||
<td colspan="2" class="text_right">
|
||||
Versie 0.8Beta -rXxx
|
||||
<i>(2010-06-26 01:07)</i>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</f:view>
|
||||
</body>
|
||||
</html>
|
|
@ -1,318 +0,0 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:v="http://vasc.forwardfire.net/vasc.tld"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<ui:composition template="/jsp/includes/layout.xhtml">
|
||||
<ui:define name="title">
|
||||
<h:outputText value="#{requestScopeVascEntityNameI18n}" />
|
||||
</ui:define>
|
||||
<ui:define name="content">
|
||||
<script language="javascript" type="text/javascript">
|
||||
<![CDATA[
|
||||
function selectAllCheckboxes(x) {
|
||||
for (var i=0,l=x.form.length; i<l; i++) {
|
||||
if (x.form[i].type == 'checkbox' && (!x.form[i].disabled) && x!=x.form[i] ) {
|
||||
x.form[i].checked=!x.form[i].checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
<v:vascEntry vascController="#{vascFacesController.vascController}"
|
||||
vascFrontendData="#{vascFacesController.newVascFrontendData}"
|
||||
entryName="#{requestScopeVascEntityName}"
|
||||
entrySupportVar="entrySupport"
|
||||
tableRecordVar="tableRecord"
|
||||
injectEditFieldsId="injectEditFieldsId"
|
||||
injectTableOptionsId="injectTableOptionsId"
|
||||
injectTableColumnsId="injectTableColumnsId"
|
||||
disableLinkColumns="true"
|
||||
>
|
||||
<f:facet name="deleteView" >
|
||||
<h:panelGroup>
|
||||
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
|
||||
<p>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.deleteDescription]}" escape="false">
|
||||
<f:param value="#{entrySupport.selectedDisplayName}" />
|
||||
</h:outputFormat>
|
||||
</p>
|
||||
<h:form>
|
||||
<h:commandButton actionListener="#{entrySupport.deleteAction}" value="#{entrySupport.i18nMap['vasc.action.deleteRowAction.name']}"/>
|
||||
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
|
||||
</h:form>
|
||||
</h:panelGroup>
|
||||
</f:facet>
|
||||
|
||||
<f:facet name="exportView" >
|
||||
<h:panelGroup>
|
||||
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
|
||||
<p>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.exportDescription]}" escape="false">
|
||||
<f:param value="#{entrySupport.vascEntry.name}" />
|
||||
</h:outputFormat>
|
||||
</p>
|
||||
<h:form>
|
||||
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
|
||||
</h:form>
|
||||
</h:panelGroup>
|
||||
</f:facet>
|
||||
|
||||
<f:facet name="editView" >
|
||||
<h:panelGroup>
|
||||
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
|
||||
<p>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.editDescription]}" escape="false" rendered="#{!entrySupport.vascEntry.vascFrontendData.vascEntryState.editCreate}">
|
||||
<f:param value="#{entrySupport.vascEntry.name}" />
|
||||
</h:outputFormat>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.createDescription]}" escape="false" rendered="#{entrySupport.vascEntry.vascFrontendData.vascEntryState.editCreate}">
|
||||
<f:param value="#{entrySupport.vascEntry.name}" />
|
||||
</h:outputFormat>
|
||||
</p>
|
||||
<h:form>
|
||||
<ul class="actionboxtab">
|
||||
<li><a class="active"><h:outputText value="#{entrySupport.i18nMap['vasc.action.editRowAction.name']}"/></a></li>
|
||||
<ui:repeat var="link" value="#{entrySupport.vascLinkEntriesEditTab}" rendered="#{!entrySupport.vascEntry.vascFrontendData.vascEntryState.editCreate}">
|
||||
<li><h:commandLink actionListener="#{entrySupport.linkEditAction}" value="#{entrySupport.i18nMap[link.name]}" type="#{link.id}"/></li>
|
||||
</ui:repeat>
|
||||
</ul>
|
||||
<h:panelGrid columns="1" styleClass="actionbox" width="100%">
|
||||
<h:outputText value="&nbsp;&nbsp;" escape="false"/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
<br/>
|
||||
<h:form>
|
||||
<h:panelGrid columns="3" id="injectEditFieldsId" styleClass="actionbox"/>
|
||||
<p>
|
||||
<h:commandButton actionListener="#{entrySupport.saveAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.save']}"/>
|
||||
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
|
||||
</p>
|
||||
</h:form>
|
||||
</h:panelGroup>
|
||||
</f:facet>
|
||||
|
||||
<f:facet name="listView" >
|
||||
<h:panelGroup>
|
||||
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
|
||||
<p>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.listDescription]}" escape="false">
|
||||
<f:param value="#{entrySupport.vascEntry.name}" />
|
||||
</h:outputFormat>
|
||||
</p>
|
||||
<h:form>
|
||||
<p>
|
||||
<h:commandButton actionListener="#{entrySupport.addAction}"
|
||||
rendered="#{entrySupport.vascEntry.vascAdminCreate}"
|
||||
value="#{entrySupport.i18nMap['vasc.action.addRowAction.name']}"
|
||||
title="#{entrySupport.i18nMap['vasc.action.addRowAction.description']}"
|
||||
/>
|
||||
<h:commandButton actionListener="#{entrySupport.backAction}"
|
||||
rendered="#{entrySupport.renderBackAction}"
|
||||
value="#{entrySupport.i18nMap['generic.vasc.jsf.action.back']}"
|
||||
/>
|
||||
|
||||
</p>
|
||||
</h:form>
|
||||
<h:form>
|
||||
<rich:dataTable id="injectTableColumnsId" var="tableRecord" value="#{entrySupport.tableDataModel}" rowClasses="odd,even">
|
||||
<f:facet name="header">
|
||||
<rich:columnGroup>
|
||||
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left">
|
||||
<ul class="actionboxtab">
|
||||
<li>
|
||||
<h:panelGroup rendered="#{!entrySupport.renderBackAction}">
|
||||
<a class="active"><h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.header']}"/></a>
|
||||
</h:panelGroup>
|
||||
<h:commandLink actionListener="#{entrySupport.backEditAction}" value="#{entrySupport.i18nMap['vasc.action.editRowAction.name']}" rendered="#{entrySupport.renderBackEditAction}"/>
|
||||
</li>
|
||||
<ui:repeat var="link" value="#{entrySupport.vascLinkEntriesEditTabParentState}">
|
||||
<li><h:commandLink actionListener="#{entrySupport.linkListAction}" value="#{entrySupport.i18nMap[link.name]}" type="#{link.id}" styleClass="#{link.vascEntryId==entrySupport.vascEntry.id?'active':''}"/></li>
|
||||
</ui:repeat>
|
||||
</ul>
|
||||
<h:panelGrid columns="1" styleClass="actionbox" width="100%">
|
||||
<h:panelGrid columns="2" id="injectTableOptionsId"/>
|
||||
<h:panelGroup>
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.search']}"/>
|
||||
<h:inputText value="#{entrySupport.searchString}"/>
|
||||
<h:commandButton actionListener="#{entrySupport.searchAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.sumbit']}"/>
|
||||
</h:panelGroup>
|
||||
</h:panelGrid>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true">
|
||||
<ul class="paging">
|
||||
<li class="paging_atstart">
|
||||
<h:commandLink rendered="#{entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}"
|
||||
actionListener="#{entrySupport.pagePreviousAction}"/>
|
||||
<h:outputText rendered="#{!entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}" />
|
||||
</li>
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesDataModel}" rendered="#{!entrySupport.hasExtendedPageMode}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
<h:panelGroup rendered="#{entrySupport.hasExtendedPageMode}">
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedBegin}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
<h:panelGroup rendered="#{entrySupport.hasExtendedPageModeCenter}">
|
||||
<li><span class="text">...</span></li>
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedCenter}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
</h:panelGroup>
|
||||
<li><span class="text">...</span></li>
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedEnd}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
</h:panelGroup>
|
||||
<li class="paging_atend">
|
||||
<h:commandLink rendered="#{entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}"
|
||||
actionListener="#{entrySupport.pageNextAction}"/>
|
||||
<h:outputText rendered="#{!entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}" />
|
||||
</li>
|
||||
</ul>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true">
|
||||
<h:panelGroup styleClass="table_options_top">
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.rows']}" />
|
||||
<h:inputText required="false" value="#{entrySupport.vascEntry.vascFrontendData.vascEntryState.vascBackendState.pageSize}" size="4"/>
|
||||
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.pagerDirect']}" />
|
||||
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedDirectPage}" valueChangeListener="#{entrySupport.processDirectPageChange}">
|
||||
<f:selectItems value="#{entrySupport.directPageItems}" />
|
||||
</h:selectOneMenu>
|
||||
|
||||
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_download.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.download.img']}" width="15" height="15" /><h:outputText value="&nbsp;&nbsp;" escape="false"/>
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.downloadDirect']}" />
|
||||
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedExporterAction}" valueChangeListener="#{entrySupport.processDirectDownloadChange}">
|
||||
<f:selectItems value="#{entrySupport.globalExportItems}" />
|
||||
</h:selectOneMenu>
|
||||
|
||||
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_print.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.printer.img']}" width="15" height="15" /><h:outputText value="&nbsp;&nbsp;" escape="false"/>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap['generic.vasc.jsf.table.resultText']}">
|
||||
<f:param value="#{entrySupport.pageStartCount}" />
|
||||
<f:param value="#{entrySupport.pageStopCount}" />
|
||||
<f:param value="#{entrySupport.pageTotalRecordCount}" />
|
||||
</h:outputFormat>
|
||||
</h:panelGroup>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true" rendered="#{entrySupport.hasMultiRowActions}">
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.multiAction.selectAll']}"/>
|
||||
<h:selectBooleanCheckbox id="selectAllBox" required="false" onchange="javascript:selectAllCheckboxes(this);return false;" value="#{entrySupport.selectAllValue}"/>
|
||||
<h:outputText value="&nbsp;&nbsp;" escape="false"/>
|
||||
<h:selectOneMenu id="multiAction" required="false" value="#{entrySupport.selectedMultiRowAction}" onchange="javascript:this.form.submit(); return false;" valueChangeListener="#{entrySupport.processMultiRowActionChange}">
|
||||
<f:selectItems value="#{entrySupport.multiRowActionItems}" />
|
||||
</h:selectOneMenu>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalFieldColumnCount}" breakBefore="true">
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.fields']}" styleClass="table_sub_header"/>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalLinkColumnCount}" rendered="#{entrySupport.totalLinkColumnCount != 0}">
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.links']}" styleClass="table_sub_header"/>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalActionColumnCount}" rendered="#{entrySupport.totalActionColumnCount != 0}">
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.actions']}" styleClass="table_sub_header"/>
|
||||
</rich:column>
|
||||
</rich:columnGroup>
|
||||
</f:facet>
|
||||
<f:facet name="footer">
|
||||
<rich:columnGroup>
|
||||
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left">
|
||||
<h:panelGroup styleClass="table_options_bottom">
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.rows']}" />
|
||||
<h:inputText required="false" value="#{entrySupport.vascEntry.vascFrontendData.vascEntryState.vascBackendState.pageSize}" size="4"/>
|
||||
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.pagerDirect']}" />
|
||||
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedDirectPage}" valueChangeListener="#{entrySupport.processDirectPageChange}">
|
||||
<f:selectItems value="#{entrySupport.directPageItems}" />
|
||||
</h:selectOneMenu>
|
||||
|
||||
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_download.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.download.img']}" width="15" height="15" /><h:outputText value="&nbsp;&nbsp;" escape="false"/>
|
||||
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.downloadDirect']}" />
|
||||
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedExporterAction}" valueChangeListener="#{entrySupport.processDirectDownloadChange}">
|
||||
<f:selectItems value="#{entrySupport.globalExportItems}" />
|
||||
</h:selectOneMenu>
|
||||
|
||||
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_print.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.printer.img']}" width="15" height="15" /><h:outputText value="&nbsp;&nbsp;" escape="false"/>
|
||||
<h:outputFormat value="#{entrySupport.i18nMap['generic.vasc.jsf.table.resultText']}">
|
||||
<f:param value="#{entrySupport.pageStartCount}" />
|
||||
<f:param value="#{entrySupport.pageStopCount}" />
|
||||
<f:param value="#{entrySupport.pageTotalRecordCount}" />
|
||||
</h:outputFormat>
|
||||
</h:panelGroup>
|
||||
</rich:column>
|
||||
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true">
|
||||
<ul class="paging">
|
||||
<li class="paging_atstart">
|
||||
<h:commandLink rendered="#{entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}"
|
||||
actionListener="#{entrySupport.pagePreviousAction}"/>
|
||||
<h:outputText rendered="#{!entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}" />
|
||||
</li>
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesDataModel}" rendered="#{!entrySupport.hasExtendedPageMode}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
<h:panelGroup rendered="#{entrySupport.hasExtendedPageMode}">
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedBegin}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
<h:panelGroup rendered="#{entrySupport.hasExtendedPageModeCenter}">
|
||||
<li><span class="text">...</span></li>
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedCenter}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
</h:panelGroup>
|
||||
<li><span class="text">...</span></li>
|
||||
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedEnd}">
|
||||
<li>
|
||||
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
|
||||
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
|
||||
</li>
|
||||
</ui:repeat>
|
||||
</h:panelGroup>
|
||||
<li class="paging_atend">
|
||||
<h:commandLink rendered="#{entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}"
|
||||
actionListener="#{entrySupport.pageNextAction}"/>
|
||||
<h:outputText rendered="#{!entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}" />
|
||||
</li>
|
||||
</ul>
|
||||
</rich:column>
|
||||
</rich:columnGroup>
|
||||
</f:facet>
|
||||
</rich:dataTable>
|
||||
</h:form>
|
||||
<h:form>
|
||||
<p>
|
||||
<h:commandButton actionListener="#{entrySupport.addAction}"
|
||||
rendered="#{entrySupport.vascEntry.vascAdminCreate}"
|
||||
value="#{entrySupport.i18nMap['vasc.action.addRowAction.name']}"
|
||||
title="#{entrySupport.i18nMap['vasc.action.addRowAction.description']}"/>
|
||||
</p>
|
||||
</h:form>
|
||||
</h:panelGroup>
|
||||
</f:facet>
|
||||
</v:vascEntry>
|
||||
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html">
|
||||
<ui:define name="title">
|
||||
<h:outputText value="#{wikiPageController.wikiTitle}" />
|
||||
</ui:define>
|
||||
<ui:define name="content">
|
||||
<h:outputText value="#{wikiPageController.wikiContent}" escape="false"/>
|
||||
</ui:define>
|
||||
</ui:composition>
|
|
@ -1,20 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<ui:define name="title">Index</ui:define>
|
||||
<ui:define name="content">
|
||||
<h:outputText value="Test etsdfjs "/>
|
||||
<!--
|
||||
<h:panelGroup rendered="#{userController.userLoggedin == false}">
|
||||
<ui:include src="/jsp/includes/index-public.xhtml"/>
|
||||
</h:panelGroup>
|
||||
<h:panelGroup rendered="#{userController.userLoggedin == true}">
|
||||
<ui:include src="/jsp/includes/index-user.xhtml"/>
|
||||
</h:panelGroup
|
||||
-->
|
||||
</ui:define>
|
||||
</ui:composition>
|
|
@ -1,2 +0,0 @@
|
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<c:redirect url="jsp/index.jsf"/>
|
|
@ -1,11 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
>
|
||||
<ui:define name="title">Error</ui:define>
|
||||
<ui:define name="content">
|
||||
<h:outputText value="Could not login" />
|
||||
</ui:define>
|
||||
</ui:composition>
|
|
@ -1,11 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
>
|
||||
<ui:define name="title">Forgot</ui:define>
|
||||
<ui:define name="content">
|
||||
<h:outputText value="Could forgot my login, send it to me" />
|
||||
</ui:define>
|
||||
</ui:composition>
|
|
@ -1,23 +0,0 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core">
|
||||
<ui:composition template="/jsp/includes/layout.xhtml">
|
||||
<ui:define name="title">Login</ui:define>
|
||||
<ui:define name="content">
|
||||
<form method="post" action="j_security_check">
|
||||
<h:panelGrid columns="2">
|
||||
<h:column><h:outputText value="Username:" /></h:column>
|
||||
<h:column><input type="text" name="j_username"/></h:column>
|
||||
|
||||
<h:column><h:outputText value="Password:" /></h:column>
|
||||
<h:column><input type="password" name="j_password"/></h:column>
|
||||
</h:panelGrid>
|
||||
<input type="submit" value="Login"/>
|
||||
</form>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/jsp/login/login-forgot.jsf">
|
||||
<h:outputText value="Forgot my login." />
|
||||
</h:outputLink>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
>
|
||||
<ui:define name="title">Logout</ui:define>
|
||||
<ui:define name="content">
|
||||
<h:outputText value="Succesfully logged out." />
|
||||
</ui:define>
|
||||
</ui:composition>
|
|
@ -1,56 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:a4j="http://richfaces.org/a4j"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<ui:define name="title">Realtime Logs</ui:define>
|
||||
<ui:define name="content">
|
||||
<a4j:region>
|
||||
<h:form>
|
||||
<a4j:poll id="poll" interval="4000" enabled="#{realTimeController.pollEnabled}" reRender="poll,messageLog"/>
|
||||
</h:form>
|
||||
</a4j:region>
|
||||
<h:form>
|
||||
<h:panelGrid columns="1" id="grid" width="100%">
|
||||
<h:outputText value="Realtime processed data event log"/>
|
||||
<rich:separator lineType="none" height="10px"/>
|
||||
<rich:separator lineType="solid" height="1px"/>
|
||||
|
||||
<h:panelGroup>
|
||||
<h:outputText value="Polling active:"/>
|
||||
<h:selectBooleanCheckbox value="#{realTimeController.pollEnabled}" required="false" onchange="javascript:this.form.submit(); return false;"/>
|
||||
|
||||
<h:outputText value="Reversed tail:"/>
|
||||
<h:selectBooleanCheckbox value="#{realTimeController.reversedTail}" required="false" onchange="javascript:this.form.submit(); return false;"/>
|
||||
|
||||
<h:outputText value="LogHosts:"/>
|
||||
|
||||
<h:outputText value="LogLevel:"/>
|
||||
|
||||
<h:outputText value="Message regex:"/>
|
||||
<h:inputText value="#{realTimeController.filterRegex}" required="false"/>
|
||||
|
||||
<h:outputText value="Area rows:"/>
|
||||
<h:selectOneMenu value="#{realTimeController.messageRows}" onchange="javascript:this.form.submit(); return false;">
|
||||
<f:selectItems value="#{realTimeController.messageRowsSelectItems}"/>
|
||||
</h:selectOneMenu>
|
||||
<h:outputText value="cols:"/>
|
||||
<h:selectOneMenu value="#{realTimeController.messageCols}" onchange="javascript:this.form.submit(); return false;">
|
||||
<f:selectItems value="#{realTimeController.messageColsSelectItems}"/>
|
||||
</h:selectOneMenu>
|
||||
|
||||
</h:panelGroup>
|
||||
<h:inputTextarea
|
||||
id="messageLog"
|
||||
style="font-size:10px;"
|
||||
rows="#{realTimeController.messageRows}" cols="#{realTimeController.messageCols}"
|
||||
enabled="false"
|
||||
value="#{realTimeController.messageLogData}"
|
||||
/>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
|
@ -1,10 +0,0 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:rich="http://richfaces.org/rich"
|
||||
>
|
||||
<ui:define name="title">Reports</ui:define>
|
||||
<ui:define name="content"><h:outputText value="The report page"/></ui:define>
|
||||
</ui:composition>
|
|
@ -1,189 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<x4o:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:x4o="http://eld.x4o.org/eld/x4o-lang.eld"
|
||||
>
|
||||
<v:virtualVascBackend id="VascEntryBackend" vascController="${vascController}" vascType="entry"/>
|
||||
<v:entry id="VascEntry" backendId="VascEntryBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="backendId"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
|
||||
<v:field id="listDescription" list="false"/>
|
||||
<v:field id="listImage" list="false"/>
|
||||
<v:field id="editDescription" list="false"/>
|
||||
<v:field id="editImage" list="false"/>
|
||||
<v:field id="deleteDescription" list="false"/>
|
||||
<v:field id="deleteImage" list="false"/>
|
||||
<v:field id="createDescription" list="false"/>
|
||||
<v:field id="createImage" list="false"/>
|
||||
|
||||
<v:field id="primaryKeyFieldId" list="false"/>
|
||||
<v:field id="displayNameFieldId" list="false"/>
|
||||
|
||||
<v:field id="vascDisplayOnly" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminList" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminEdit" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminCreate" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminDelete" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<v:link id="VascEntryField" vascEntryId="VascEntryFieldLink">
|
||||
<v:linkEntryCreateFieldValue valueFieldId="vascEntry"/>
|
||||
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
<v:link id="VascEntryFieldSet" vascEntryId="VascEntryFieldSetLink">
|
||||
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
<v:link id="VascLinkEntry" vascEntryId="VascLinkEntryLink">
|
||||
<v:linkEntryCreateFieldValue valueFieldId="vascEntry"/>
|
||||
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
<v:link id="VascListOption" vascEntryId="VascListOptionLink">
|
||||
<v:linkEntryCreateFieldValue valueFieldId="vascEntry"/>
|
||||
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
</v:entry>
|
||||
|
||||
<v:virtualVascBackend id="VascEntryFieldLinkBackend" vascController="${vascController}" vascType="field" />
|
||||
<v:entry id="VascEntryFieldLink" backendId="VascEntryFieldLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="backendName" list="false"/>
|
||||
<v:field id="displayName" list="false"/>
|
||||
|
||||
<v:field id="vascEntryFieldType" list="false" editReadOnly="true"/>
|
||||
<v:field id="vascEntryFieldValue" list="false" editReadOnly="true"/>
|
||||
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" list="false"/>
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
<v:field id="orderIndex" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="defaultValue"/>
|
||||
|
||||
<v:field id="sizeList" list="false" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="sizeEdit" list="false" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="styleList" list="false"/>
|
||||
<v:field id="styleEdit" list="false"/>
|
||||
|
||||
<v:field id="choices" list="false"/>
|
||||
<v:field id="choicesAsRadio" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<v:field id="view" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="create" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="edit" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="editReadOnly" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="editBlank" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="list" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<v:field id="rolesCreate" list="false"/>
|
||||
<v:field id="rolesEdit" list="false"/>
|
||||
<v:field id="rolesEditReadOnly" list="false"/>
|
||||
<v:field id="rolesList" list="false"/>
|
||||
|
||||
<v:field id="sortable" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="sumable" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="graphable" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<!-- private List<VascValidator> vascValidators = null; -->
|
||||
</v:entry>
|
||||
|
||||
|
||||
<v:virtualVascBackend id="VascEntryFieldSetLinkBackend" vascController="${vascController}" vascType="fieldset" />
|
||||
<v:entry id="VascEntryFieldSetLink" backendId="VascEntryFieldSetLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" list="false"/>
|
||||
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
|
||||
<v:field id="styleList" list="false"/>
|
||||
<v:field id="styleEdit" list="false"/>
|
||||
<v:field id="collapsed" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<!-- private List<String> vascEntryFieldIds = null; -->
|
||||
</v:entry>
|
||||
|
||||
<v:virtualVascBackend id="VascLinkEntryLinkBackend" vascController="${vascController}" vascType="linkentries" />
|
||||
<v:entry id="VascLinkEntryLink" backendId="VascLinkEntryLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="vascEntryId"/>
|
||||
<v:field id="vascLinkEntryType" list="false" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.core.VascLinkEntryType"/>
|
||||
</v:field>
|
||||
|
||||
<v:field id="doActionId" list="false"/>
|
||||
<v:field id="name" list="false"/>
|
||||
|
||||
<!--
|
||||
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
|
||||
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(3);
|
||||
-->
|
||||
</v:entry>
|
||||
|
||||
|
||||
<v:virtualVascBackend id="VascListOptionLinkBackend" vascController="${vascController}" vascType="listoptions" />
|
||||
<v:entry id="VascListOptionLink" backendId="VascListOptionLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" list="false"/>
|
||||
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
|
||||
<v:field id="styleList" list="false"/>
|
||||
<v:field id="styleEdit" list="false"/>
|
||||
<v:field id="collapsed" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<!-- private List<String> vascEntryFieldIds = null; -->
|
||||
</v:entry>
|
||||
|
||||
<!--
|
||||
<m:mongodbConnectionProvider
|
||||
el.id="lefiona_connection"
|
||||
hostname="localhost"
|
||||
database="lefiona"
|
||||
/>
|
||||
<m:mongodbBackend
|
||||
id="dg2_smiles_backend"
|
||||
connectionProvider="${lefiona_connection}"
|
||||
collection="dg2_smiles"
|
||||
/>
|
||||
<v:entry id="dg2_smiles" backendId="dg2_smiles_backend">
|
||||
<v:field id="_id" readOnly="true" list="false"/>
|
||||
<v:field id="text" vascEntryFieldType="TextAreaField"/>
|
||||
<v:field id="profile_type" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
|
||||
</v:field>
|
||||
<v:field id="cron_type" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelString data="BASE,DAILY,WEEKLY,MONTLY"/>
|
||||
</v:field>
|
||||
<v:field id="group"/>
|
||||
<v:field id="active" vascEntryFieldType="BooleanField"/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<m:mongodbBackend
|
||||
id="dg2_profiles_backend"
|
||||
connectionProvider="${lefiona_connection}"
|
||||
collection="dg2_profiles"
|
||||
/>
|
||||
<v:entry id="dg2_profiles" backendId="dg2_profiles_backend">
|
||||
<v:field id="_id" readOnly="true" list="false"/>
|
||||
<v:field id="url"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="active" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="body_text" list="false" vascEntryFieldType="TextAreaField"/>
|
||||
<v:field id="profile_type" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
|
||||
</v:field>
|
||||
<v:field id="send_jokers" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="run_date" vascEntryFieldType="DateField"/>
|
||||
</v:entry>
|
||||
-->
|
||||
|
||||
</x4o:root>
|
Loading…
Reference in a new issue