5.0 Source Code

Committing 5.0 Source Code
This commit is contained in:
2023-04-06 18:58:04 +01:00
parent 0f3ede77fa
commit 0282345603
1680 changed files with 241310 additions and 0 deletions
@@ -0,0 +1,131 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.data.loader.*;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.BeanFactoryDataSingle;
/**
*
* @author adrianromero
*/
public class DataLogicAdmin extends BeanFactoryDataSingle {
private Session s;
private TableDefinition m_tpeople;
private TableDefinition m_troles;
private TableDefinition m_tresources;
/** Creates a new instance of DataLogicAdmin */
public DataLogicAdmin() {
}
/**
*
* @param s
*/
@Override
public void init(Session s){
this.s = s;
m_tpeople = new TableDefinition(s,
"people"
, new String[] {"ID", "NAME", "APPPASSWORD", "ROLE", "VISIBLE", "CARD", "IMAGE"}
, new String[] {"ID", AppLocal.getIntString("label.peoplename"), AppLocal.getIntString("label.Password"), AppLocal.getIntString("label.role"), AppLocal.getIntString("label.peoplevisible"), AppLocal.getIntString("label.card"), AppLocal.getIntString("label.peopleimage")}
, new Datas[] {Datas.STRING, Datas.STRING, Datas.STRING, Datas.STRING, Datas.BOOLEAN, Datas.STRING, Datas.IMAGE}
, new Formats[] {Formats.STRING, Formats.STRING, Formats.STRING, Formats.STRING, Formats.BOOLEAN, Formats.STRING, Formats.NULL}
, new int[] {0}
);
m_troles = new TableDefinition(s,
"roles"
, new String[] {"ID", "NAME", "PERMISSIONS"}
, new String[] {"ID", AppLocal.getIntString("label.name"), "PERMISSIONS"}
, new Datas[] {Datas.STRING, Datas.STRING, Datas.BYTES}
, new Formats[] {Formats.STRING, Formats.STRING, Formats.NULL}
, new int[] {0}
);
m_tresources = new TableDefinition(s,
"resources"
, new String[] {
"ID", "NAME", "RESTYPE", "CONTENT"}
, new String[] {
"ID",
AppLocal.getIntString("label.name"),
AppLocal.getIntString("label.type"),
"CONTENT"}
, new Datas[] {
Datas.STRING, Datas.STRING, Datas.INT, Datas.BYTES}
, new Formats[] {
Formats.STRING, Formats.STRING, Formats.INT, Formats.NULL}
, new int[] {0}
);
}
/**
*
* @return
*/
public final SentenceList getRolesList() {
return new StaticSentence(s
, "SELECT ID, NAME FROM roles ORDER BY NAME"
, null
, new SerializerReadClass(RoleInfo.class));
}
/**
*
* @return
*/
public final TableDefinition getTablePeople() {
return m_tpeople;
}
/**
*
* @return
*/
public final TableDefinition getTableRoles() {
return m_troles;
}
/**
*
* @return
*/
public final TableDefinition getTableResources() {
return m_tresources;
}
/**
*
* @return
*/
public final SentenceList getPeopleList() {
return new StaticSentence(s
, "SELECT ID, NAME FROM people ORDER BY NAME"
, null
, new SerializerReadClass(PeopleInfo.class));
}
}
@@ -0,0 +1,339 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="form.usertitle" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Default Cursor"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[650, 300]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-15,0,0,2,-10"/>
<SyntheticProperty name="formSizePolicy" type="int" value="0"/>
<SyntheticProperty name="generateSize" type="boolean" value="true"/>
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[450, 231]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel5">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel7">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLblName" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jtxtName" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="m_jtxtName" min="-2" max="-2" attributes="0"/>
<Component id="jLblName" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLblName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.prodname" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[60, 15]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[60, 15]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.unicenta.editor.JEditorString" name="m_jtxtName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 30]"/>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value=""/>
</AccessibilityProperties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jListPeople">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jListPeopleMouseClicked"/>
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jListPeopleValueChanged"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/reload.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.reset" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Clear Filter"/>
<Property name="actionCommand" type="java.lang.String" value="Reset "/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
</AccessibilityProperties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/ok.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.executefilter" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Execute Filter"/>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
</AccessibilityProperties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Default Cursor"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="After"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="JCustomerFinder_m_jKeys"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JPanel" name="jPanel8">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="South"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="After"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jcmdCancel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/cancel.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.Cancel" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jcmdCancelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jcmdOK">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/ok.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.OK" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[103, 44]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[103, 44]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jcmdOKActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,417 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.QBFCompareEnum;
import com.unicenta.data.user.EditorCreator;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.pos.forms.AppLocal;
import java.awt.*;
import java.util.ArrayList;
import javax.swing.JFrame;
/**
*
* @author adrianromero
*/
public class JPeopleFinder extends javax.swing.JDialog implements EditorCreator {
private PeopleInfo selectedPeople;
private ListProvider lpr;
/** Creates new form JPeopleFinder */
private JPeopleFinder(java.awt.Frame parent, boolean modal) {
super(parent, modal);
}
/**
* Creates new form JPeopleFinder
*/
private JPeopleFinder(java.awt.Dialog parent, boolean modal) {
super(parent, modal);
}
/**
*
* @param parent
* @param dlPeople
* @return
*/
public static JPeopleFinder getPeopleFinder(Component parent, DataLogicAdmin dlPeople) {
Window window = getWindow(parent);
JPeopleFinder myMsg;
if (window instanceof Frame) {
myMsg = new JPeopleFinder((Frame) window, true);
} else {
myMsg = new JPeopleFinder((Dialog) window, true);
}
myMsg.init(dlPeople);
myMsg.applyComponentOrientation(parent.getComponentOrientation());
return myMsg;
}
/**
*
* @return
*/
public PeopleInfo getSelectedPeople() {
return selectedPeople;
}
private void init(DataLogicAdmin dlPeople) {
initComponents();
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
m_jtxtName.addEditorKeys(m_jKeys);
m_jtxtName.reset();
lpr = new ListProviderCreator(dlPeople.getPeopleList(), this);
jListPeople.setCellRenderer(new PeopleRenderer());
getRootPane().setDefaultButton(jcmdOK);
selectedPeople = null;
}
/**
*
* @param people
*/
public void search(PeopleInfo people) {
if (people == null
|| people.getName() == null
|| people.getName().equals("")) {
m_jtxtName.reset();
cleanSearch();
} else {
m_jtxtName.setText(people.getName());
executeSearch();
}
}
private void cleanSearch() {
jListPeople.setModel(new MyListData(new ArrayList()));
}
/**
* This method actions the User data search
*/
public void executeSearch() {
try {
jListPeople.setModel(new MyListData(lpr.loadData()));
if (jListPeople.getModel().getSize() > 0) {
jListPeople.setSelectedIndex(0);
}
} catch (BasicException e) {
}
}
/**
*
* @return creates object for search method
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] afilter = new Object[12];
if (m_jtxtName.getText() == null
|| m_jtxtName.getText().equals("")) {
afilter[0] = QBFCompareEnum.COMP_NONE;
afilter[1] = null;
} else {
afilter[0] = QBFCompareEnum.COMP_RE;
afilter[1] = "%" + m_jtxtName.getText() + "%";
}
return afilter;
}
private static Window getWindow(Component parent) {
if (parent == null) {
return new JFrame();
} else if (parent instanceof Frame || parent instanceof Dialog) {
return (Window) parent;
} else {
return getWindow(parent.getParent());
}
}
private static class MyListData extends javax.swing.AbstractListModel {
private final java.util.List m_data;
public MyListData(java.util.List data) {
m_data = data;
}
@Override
public Object getElementAt(int index) {
return m_data.get(index);
}
@Override
public int getSize() {
return m_data.size();
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jPanel7 = new javax.swing.JPanel();
jLblName = new javax.swing.JLabel();
m_jtxtName = new com.unicenta.editor.JEditorString();
jPanel4 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jListPeople = new javax.swing.JList();
jPanel6 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel8 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jcmdCancel = new javax.swing.JButton();
jcmdOK = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(AppLocal.getIntString("form.usertitle")); // NOI18N
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setPreferredSize(new java.awt.Dimension(650, 300));
jPanel3.setPreferredSize(new java.awt.Dimension(450, 231));
jPanel3.setLayout(new java.awt.BorderLayout());
jPanel5.setLayout(new java.awt.BorderLayout());
jPanel7.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jLblName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLblName.setText(AppLocal.getIntString("label.prodname")); // NOI18N
jLblName.setMaximumSize(new java.awt.Dimension(60, 15));
jLblName.setMinimumSize(new java.awt.Dimension(60, 15));
jLblName.setPreferredSize(new java.awt.Dimension(110, 30));
m_jtxtName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jtxtName.setPreferredSize(new java.awt.Dimension(250, 30));
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLblName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jtxtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(m_jtxtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLblName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
m_jtxtName.getAccessibleContext().setAccessibleName("");
jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel5, java.awt.BorderLayout.PAGE_START);
jPanel4.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel4.setLayout(new java.awt.BorderLayout());
jListPeople.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jListPeople.setFocusable(false);
jListPeople.setRequestFocusEnabled(false);
jListPeople.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jListPeopleMouseClicked(evt);
}
});
jListPeople.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
jListPeopleValueChanged(evt);
}
});
jScrollPane1.setViewportView(jListPeople);
jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);
jButton1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/reload.png"))); // NOI18N
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
jButton1.setText(bundle.getString("button.reset")); // NOI18N
jButton1.setToolTipText("Clear Filter");
jButton1.setActionCommand("Reset ");
jButton1.setFocusable(false);
jButton1.setPreferredSize(new java.awt.Dimension(110, 45));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel6.add(jButton1);
jButton1.getAccessibleContext().setAccessibleDescription("");
jButton3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
jButton3.setText(AppLocal.getIntString("button.executefilter")); // NOI18N
jButton3.setToolTipText("Execute Filter");
jButton3.setFocusPainted(false);
jButton3.setPreferredSize(new java.awt.Dimension(110, 45));
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jPanel6.add(jButton3);
jButton3.getAccessibleContext().setAccessibleDescription("");
jPanel4.add(jPanel6, java.awt.BorderLayout.PAGE_START);
jPanel3.add(jPanel4, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel2.add(m_jKeys, java.awt.BorderLayout.NORTH);
jPanel8.setLayout(new java.awt.BorderLayout());
jcmdCancel.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jcmdCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/cancel.png"))); // NOI18N
jcmdCancel.setText(AppLocal.getIntString("button.Cancel")); // NOI18N
jcmdCancel.setFocusPainted(false);
jcmdCancel.setFocusable(false);
jcmdCancel.setMargin(new java.awt.Insets(8, 16, 8, 16));
jcmdCancel.setPreferredSize(new java.awt.Dimension(110, 45));
jcmdCancel.setRequestFocusEnabled(false);
jcmdCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcmdCancelActionPerformed(evt);
}
});
jPanel1.add(jcmdCancel);
jcmdOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
jcmdOK.setText(AppLocal.getIntString("button.OK")); // NOI18N
jcmdOK.setEnabled(false);
jcmdOK.setFocusPainted(false);
jcmdOK.setFocusable(false);
jcmdOK.setMargin(new java.awt.Insets(8, 16, 8, 16));
jcmdOK.setMaximumSize(new java.awt.Dimension(103, 44));
jcmdOK.setMinimumSize(new java.awt.Dimension(103, 44));
jcmdOK.setPreferredSize(new java.awt.Dimension(110, 45));
jcmdOK.setRequestFocusEnabled(false);
jcmdOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcmdOKActionPerformed(evt);
}
});
jPanel1.add(jcmdOK);
jPanel8.add(jPanel1, java.awt.BorderLayout.LINE_END);
jPanel2.add(jPanel8, java.awt.BorderLayout.SOUTH);
getContentPane().add(jPanel2, java.awt.BorderLayout.LINE_END);
setSize(new java.awt.Dimension(758, 497));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void jcmdOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmdOKActionPerformed
selectedPeople = (PeopleInfo) jListPeople.getSelectedValue();
dispose();
}//GEN-LAST:event_jcmdOKActionPerformed
private void jcmdCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmdCancelActionPerformed
dispose();
}//GEN-LAST:event_jcmdCancelActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
executeSearch();
}//GEN-LAST:event_jButton3ActionPerformed
private void jListPeopleValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListPeopleValueChanged
jcmdOK.setEnabled(jListPeople.getSelectedValue() != null);
}//GEN-LAST:event_jListPeopleValueChanged
private void jListPeopleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListPeopleMouseClicked
if (evt.getClickCount() == 2) {
selectedPeople = (PeopleInfo) jListPeople.getSelectedValue();
dispose();
}
}//GEN-LAST:event_jListPeopleMouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
m_jtxtName.reset();
cleanSearch();
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLblName;
private javax.swing.JList jListPeople;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton jcmdCancel;
private javax.swing.JButton jcmdOK;
private com.unicenta.editor.JEditorKeys m_jKeys;
private com.unicenta.editor.JEditorString m_jtxtName;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------
* Copyright (c) 1999,2000 Dallas Semiconductor Corporation, All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Dallas Semiconductor
* shall not be used except as stated in the Dallas Semiconductor
* Branding Policy.
*---------------------------------------------------------------------------
*/
import com.dalsemi.onewire.OneWireAccessProvider;
import com.dalsemi.onewire.adapter.DSPortAdapter;
import com.dalsemi.onewire.adapter.OneWireIOException;
import com.dalsemi.onewire.container.OneWireContainer;
import com.dalsemi.onewire.utils.*;
import com.dalsemi.onewire.application.monitor.*;
/**
* Minimal demo to monitor a simple network.
*
* @version 0.00, 25 September 2000
* @author DS,BA,SH
*/
public class OWWatch
implements DeviceMonitorEventListener
{
/**
* Method main
*
*
* @param args
*
*/
public static void main (String args [])
{
OneWireContainer owd;
int delay;
try
{
// get the default adapter
DSPortAdapter adapter = OneWireAccessProvider.getDefaultAdapter();
System.out.println();
System.out.println("Adapter: " + adapter.getAdapterName()
+ " Port: " + adapter.getPortName());
System.out.println();
// clear any previous search restrictions
adapter.setSearchAllDevices();
adapter.targetAllFamilies();
adapter.setSpeed(adapter.SPEED_REGULAR);
// create the watcher with this adapter
OWWatch nw = new OWWatch(adapter);
// sleep for the specified time
if (args.length >= 1)
delay = Integer.decode(args [0]).intValue();
else
delay = 20000;
System.out.println("Monitor run for: " + delay + "ms");
Thread.sleep(delay);
// Kill any threads we have running.
nw.killWatch();
// free port used by adapter
adapter.freePort();
}
catch (Exception e)
{
System.out.println(e);
}
return;
}
//--------
//-------- Variables
//--------
/** Network Monitor instance */
private DeviceMonitor dm;
//--------
//-------- Constructor
//--------
/**
* Create a 1-Wire Network Watcher
*
* @param adapter for 1-Wire Network to monitor
*/
public OWWatch (DSPortAdapter adapter)
{
// create a network monitor
dm = new DeviceMonitor(adapter);
// add this to the event listers
try
{
dm.addDeviceMonitorEventListener(this);
}
catch (Exception e){}
// start the monitor
Thread t = new Thread(dm);
t.start();
}
/**
*
*/
public void killWatch()
{
// Kill the OneWireMonitor thread.
dm.killMonitor();
}
/**
* Arrival event as a NetworkMonitorEventListener
*
* @param owme DeviceMonitorEvent add
*/
public void deviceArrival (DeviceMonitorEvent devt)
{
for(int i=0; i<devt.getDeviceCount(); i++)
System.out.println("ADD: " + devt.getAddressAsStringAt(i));
}
/**
* Depart event as a NetworkMonitorEventListener
*
* @param owme DeviceMonitorEvent depart
*/
public void deviceDeparture (DeviceMonitorEvent devt)
{
for(int i=0; i<devt.getDeviceCount(); i++)
System.out.println("REMOVE: " + devt.getAddressAsStringAt(i));
}
/**
* Depart event as a NetworkMonitorEventListener
*
* @param owme DeviceMonitorException depart
*/
public void networkException (DeviceMonitorException dexc)
{
System.out.println("ERROR: " + dexc.toString());
}
}
@@ -0,0 +1,102 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.DataRead;
import com.unicenta.data.loader.IKeyed;
import com.unicenta.data.loader.SerializableRead;
/**
*
* @author adrianromero
* Created on 27 de febrero de 2007, 23:27
*
*/
public class PeopleInfo implements SerializableRead, IKeyed {
private static final long serialVersionUID = 9110127845966L;
private String m_sID;
/**
*
*/
protected String m_sName;
/** Creates a new instance of PeopleInfo */
public PeopleInfo() {
m_sID = null;
m_sName = null;
}
/**
*
* @return
*/
@Override
public Object getKey() {
return m_sID;
}
/**
*
* @param dr
* @throws BasicException
*/
@Override
public void readValues(DataRead dr) throws BasicException {
m_sID = dr.getString(1);
m_sName = dr.getString(2);
}
/**
*
* @return
*/
public String getID() {
return m_sID;
}
public void setID(String sID) {
m_sID = sID;
}
/**
*
* @return
*/
public String getName() {
return m_sName;
}
/**
*
* @param sValue
*/
public void setName(String sValue) {
m_sName = sValue;
}
@Override
public String toString() {
return m_sName;
}
}
@@ -0,0 +1,131 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ListCellRendererBasic;
import com.unicenta.data.loader.ComparatorCreator;
import com.unicenta.data.loader.TableDefinition;
import com.unicenta.data.loader.Vectorer;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.data.user.SaveProvider;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.panels.JPanelTable;
import javax.swing.ListCellRenderer;
/**
*
* @author adrianromero
*/
public class PeoplePanel extends JPanelTable {
private TableDefinition tpeople;
private PeopleView jeditor;
/** Creates a new instance of JPanelPeople */
public PeoplePanel() {
}
/**
*
*/
@Override
protected void init() {
DataLogicAdmin dlAdmin = (DataLogicAdmin) app.getBean("com.unicenta.pos.admin.DataLogicAdmin");
tpeople = dlAdmin.getTablePeople();
jeditor = new PeopleView(dlAdmin, dirty);
}
/**
*
* @return
*/
@Override
public ListProvider getListProvider() {
return new ListProviderCreator(tpeople);
}
/**
*
* @return
*/
@Override
public SaveProvider getSaveProvider() {
return new SaveProvider(tpeople);
}
/**
*
* @return
*/
@Override
public Vectorer getVectorer() {
return tpeople.getVectorerBasic(new int[]{1});
}
/**
*
* @return
*/
@Override
public ComparatorCreator getComparatorCreator() {
return tpeople.getComparatorCreator(new int[] {1, 3});
}
/**
*
* @return
*/
@Override
public ListCellRenderer getListCellRenderer() {
return new ListCellRendererBasic(tpeople.getRenderStringBasic(new int[]{1}));
}
/**
*
* @return
*/
@Override
public EditorRecord getEditor() {
return jeditor;
}
/**
*
* @throws BasicException
*/
@Override
public void activate() throws BasicException {
jeditor.activate(); // primero el editor
super.activate(); // y luego cargamos los datos
}
/**
*
* @return
*/
@Override
public String getTitle() {
return AppLocal.getIntString("Menu.Users");
}
}
@@ -0,0 +1,49 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JList;
/**
*
* @author JG uniCenta
*/
public class PeopleRenderer extends DefaultListCellRenderer {
private final Icon icopeople;
/** Creates a new instance of PeopleRenderer */
public PeopleRenderer() {
icopeople = new ImageIcon(getClass().getClassLoader().getResource("com/unicenta/images/user_sml.png"));
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
setText(value.toString());
setIcon(icopeople);
return this;
}
}
@@ -0,0 +1,289 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 500]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="m_jVisible" min="-2" pref="207" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jRole" min="-2" pref="180" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jImage" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLblCardID" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jcard" min="-2" pref="180" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="webCBSecurity" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<Component id="m_jName" min="-2" pref="180" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel6" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLblCardID" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="m_jcard" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="webCBSecurity" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jRole" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" min="-2" pref="25" max="-2" attributes="0"/>
<Component id="m_jVisible" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jImage" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/info.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.peoplenamem" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabel1MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="m_jName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="m_jVisible">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.peoplevisible" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.peopleimage" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.unicenta.data.gui.JImageEditor" name="m_jImage">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[300, 250]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/password.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.peoplepassword" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="m_jRole">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.rolem" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="m_jcard">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLblCardID">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.card" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.combobox.WebComboBox" name="webCBSecurity">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Generate new key"/>
<StringItem index="1" value="Delete exisitng key"/>
<StringItem index="2" value="Use iButton ID"/>
</StringArray>
</Property>
<Property name="selectedIndex" type="int" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="0" type="code"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="tooltip.peoplesecurity" replaceFormat="AppLocal.getIntString(&quot;tooltip.peoplesecurity&quot;)"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[140, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="webCBSecurityActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.Password" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,467 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ComboBoxValModel;
import com.unicenta.data.loader.SentenceList;
import com.unicenta.data.user.*;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.Hashcypher;
import com.unicenta.pos.util.StringUtils;
import com.unicenta.pos.util.uOWWatch;
import java.awt.Component;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.image.BufferedImage;
import java.util.UUID;
import javax.swing.*;
/**
*
* @author adrianromero
*/
public class PeopleView extends JPanel implements EditorRecord {
private Object m_oId;
private String m_sPassword;
private final DirtyManager m_Dirty;
private final SentenceList m_sentrole;
private ComboBoxValModel m_RoleModel;
private final ComboBoxValModel m_ReasonModel;
/** Creates new form PeopleEditor
* @param dlAdmin
* @param dirty */
public PeopleView(DataLogicAdmin dlAdmin, DirtyManager dirty) {
initComponents();
// El modelo de roles
m_sentrole = dlAdmin.getRolesList();
m_RoleModel = new ComboBoxValModel();
m_Dirty = dirty;
m_jName.getDocument().addDocumentListener(dirty);
m_jRole.addActionListener(dirty);
m_jVisible.addActionListener(dirty);
m_jImage.addPropertyChangeListener("image", dirty);
m_jcard.getDocument().addDocumentListener(dirty);
m_ReasonModel = new ComboBoxValModel();
m_ReasonModel.add(AppLocal.getIntString("cboption.generate"));
m_ReasonModel.add(AppLocal.getIntString("cboption.clear"));
m_ReasonModel.add(AppLocal.getIntString("cboption.iButton"));
webCBSecurity.setModel(m_ReasonModel);
writeValueEOF();
}
/**
*
*/
@Override
public void writeValueEOF() {
m_oId = null;
m_jName.setText(null);
m_sPassword = null;
m_RoleModel.setSelectedKey(null);
m_jVisible.setSelected(false);
m_jcard.setText(null);
m_jImage.setImage(null);
m_jName.setEnabled(false);
m_jRole.setEnabled(false);
m_jVisible.setEnabled(false);
m_jcard.setEnabled(false);
m_jImage.setEnabled(false);
jButton1.setEnabled(false);
webCBSecurity.setEnabled(false);
}
/**
*
*/
@Override
public void writeValueInsert() {
m_oId = null;
m_jName.setText(null);
m_sPassword = null;
m_RoleModel.setSelectedKey(null);
m_jVisible.setSelected(true);
m_jcard.setText(null);
m_jImage.setImage(null);
m_jName.setEnabled(true);
m_jRole.setEnabled(true);
m_jVisible.setEnabled(true);
m_jcard.setEnabled(true);
m_jImage.setEnabled(true);
jButton1.setEnabled(true);
webCBSecurity.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueDelete(Object value) {
Object[] people = (Object[]) value;
m_oId = people[0];
m_jName.setText(Formats.STRING.formatValue(people[1]));
m_sPassword = Formats.STRING.formatValue(people[2]);
m_RoleModel.setSelectedKey(people[3]);
m_jVisible.setSelected(((Boolean) people[4]).booleanValue());
m_jcard.setText(Formats.STRING.formatValue(people[5]));
m_jImage.setImage((BufferedImage) people[6]);
m_jName.setEnabled(false);
m_jRole.setEnabled(false);
m_jVisible.setEnabled(false);
m_jcard.setEnabled(false);
m_jImage.setEnabled(false);
jButton1.setEnabled(false);
webCBSecurity.setEnabled(false);
}
/**
*
* @param value
*/
@Override
public void writeValueEdit(Object value) {
Object[] people = (Object[]) value;
m_oId = people[0];
m_jName.setText(Formats.STRING.formatValue(people[1]));
m_sPassword = Formats.STRING.formatValue(people[2]);
m_RoleModel.setSelectedKey(people[3]);
m_jVisible.setSelected(((Boolean) people[4]).booleanValue());
m_jcard.setText(Formats.STRING.formatValue(people[5]));
m_jImage.setImage((BufferedImage) people[6]);
if (m_jcard.getText().length() == 16) {
jLblCardID.setText(AppLocal.getIntString("label.ibutton"));
} else {
jLblCardID.setText(AppLocal.getIntString("label.card"));
}
System.out.println(m_jcard.getText().length());
m_jName.setEnabled(true);
m_jRole.setEnabled(true);
m_jVisible.setEnabled(true);
m_jcard.setEnabled(true);
m_jImage.setEnabled(true);
jButton1.setEnabled(true);
webCBSecurity.setEnabled(true);
}
/**
*
* @return
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] people = new Object[7];
people[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
people[1] = Formats.STRING.parseValue(m_jName.getText());
people[2] = Formats.STRING.parseValue(m_sPassword);
people[3] = m_RoleModel.getSelectedKey();
people[4] = m_jVisible.isSelected();
people[5] = Formats.STRING.parseValue(m_jcard.getText());
people[6] = m_jImage.getImage();
return people;
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
* @throws BasicException
*/
public void activate() throws BasicException {
m_RoleModel = new ComboBoxValModel(m_sentrole.list());
m_jRole.setModel(m_RoleModel);
}
/**
*
*/
@Override
public void refresh() {
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
m_jName = new javax.swing.JTextField();
m_jVisible = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
m_jImage = new com.unicenta.data.gui.JImageEditor();
jButton1 = new javax.swing.JButton();
m_jRole = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
m_jcard = new javax.swing.JTextField();
jLblCardID = new javax.swing.JLabel();
webCBSecurity = new com.alee.laf.combobox.WebComboBox();
jLabel6 = new javax.swing.JLabel();
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
setPreferredSize(new java.awt.Dimension(500, 500));
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/info.png"))); // NOI18N
jLabel1.setText(AppLocal.getIntString("label.peoplenamem")); // NOI18N
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel1MouseClicked(evt);
}
});
m_jName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jName.setPreferredSize(new java.awt.Dimension(0, 30));
m_jVisible.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jVisible.setPreferredSize(new java.awt.Dimension(0, 30));
jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel3.setText(AppLocal.getIntString("label.peoplevisible")); // NOI18N
jLabel3.setPreferredSize(new java.awt.Dimension(110, 30));
jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel4.setText(AppLocal.getIntString("label.peopleimage")); // NOI18N
jLabel4.setPreferredSize(new java.awt.Dimension(110, 30));
m_jImage.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jImage.setPreferredSize(new java.awt.Dimension(300, 250));
jButton1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/password.png"))); // NOI18N
jButton1.setText(AppLocal.getIntString("button.peoplepassword")); // NOI18N
jButton1.setToolTipText("");
jButton1.setPreferredSize(new java.awt.Dimension(80, 45));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
m_jRole.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jRole.setPreferredSize(new java.awt.Dimension(0, 30));
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel2.setText(AppLocal.getIntString("label.rolem")); // NOI18N
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
m_jcard.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jcard.setPreferredSize(new java.awt.Dimension(0, 30));
jLblCardID.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLblCardID.setText(AppLocal.getIntString("label.card")); // NOI18N
jLblCardID.setPreferredSize(new java.awt.Dimension(110, 30));
webCBSecurity.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Generate new key", "Delete exisitng key", "Use iButton ID" }));
webCBSecurity.setSelectedIndex(0);
webCBSecurity.setToolTipText(AppLocal.getIntString("tooltip.peoplesecurity")); // NOI18N
webCBSecurity.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
webCBSecurity.setPreferredSize(new java.awt.Dimension(140, 45));
webCBSecurity.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
webCBSecurityActionPerformed(evt);
}
});
jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel6.setText(AppLocal.getIntString("label.Password")); // NOI18N
jLabel6.setPreferredSize(new java.awt.Dimension(110, 30));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(m_jVisible, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jRole, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLblCardID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jcard, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(webCBSecurity, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLblCardID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jcard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(webCBSecurity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jRole, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jVisible, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_jImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String sNewPassword = Hashcypher.changePassword(this);
if (sNewPassword != null) {
m_sPassword = sNewPassword;
m_Dirty.setDirty(true);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void webCBSecurityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_webCBSecurityActionPerformed
if(webCBSecurity.getSelectedIndex() == 0){
if (JOptionPane.showConfirmDialog(this,
AppLocal.getIntString("message.cardnew"),
AppLocal.getIntString("title.editor"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
{
m_jcard.setText("C" + StringUtils.getCardNumber());
m_Dirty.setDirty(true);
}
}
if(webCBSecurity.getSelectedIndex() == 1){
if (JOptionPane.showConfirmDialog(this,
AppLocal.getIntString("message.cardremove"),
AppLocal.getIntString("title.editor"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
{
m_jcard.setText(null);
m_Dirty.setDirty(true);
}
}
if(webCBSecurity.getSelectedIndex() == 2){
if (JOptionPane.showConfirmDialog(this,
AppLocal.getIntString("message.ibuttonassign"),
AppLocal.getIntString("title.editor"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE) == JOptionPane.OK_OPTION)
{
m_jcard.setText( uOWWatch.getibuttonid() );
jLblCardID.setText(AppLocal.getIntString("label.ibutton"));
m_Dirty.setDirty(true);
}
}
}//GEN-LAST:event_webCBSecurityActionPerformed
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
if (evt.getClickCount() == 2) {
String uuidString = m_oId.toString();
StringSelection stringSelection = new StringSelection(uuidString);
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents(stringSelection, null);
JOptionPane.showMessageDialog(null,
AppLocal.getIntString("message.uuidcopy"));
}
}//GEN-LAST:event_jLabel1MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLblCardID;
private com.unicenta.data.gui.JImageEditor m_jImage;
private javax.swing.JTextField m_jName;
private javax.swing.JComboBox m_jRole;
private javax.swing.JCheckBox m_jVisible;
private javax.swing.JTextField m_jcard;
private com.alee.laf.combobox.WebComboBox webCBSecurity;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,39 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.pos.panels.ComboItemLocal;
/**
*
* @author adrianromero
* Created on February 12, 2007, 11:50 PM
*
*/
public class ResourceType extends ComboItemLocal {
public static final ResourceType TEXT = new ResourceType(0, "resource.text");
public static final ResourceType IMAGE = new ResourceType(1, "resource.image");
public static final ResourceType BINARY = new ResourceType(2, "resource.binary");
private ResourceType(Integer iKey, String sKeyValue) {
super(iKey, sKeyValue);
}
}
@@ -0,0 +1,130 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.data.gui.ListCellRendererBasic;
import com.unicenta.data.loader.ComparatorCreator;
import com.unicenta.data.loader.TableDefinition;
import com.unicenta.data.loader.Vectorer;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.data.user.SaveProvider;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.DataLogicSystem;
import com.unicenta.pos.panels.JPanelTable;
import javax.swing.ListCellRenderer;
/**
*
* @author adrianromero
*/
public class ResourcesPanel extends JPanelTable {
private TableDefinition tresources;
private ResourcesView jeditor;
/** Creates a new instance of JPanelResources */
public ResourcesPanel() {
}
/**
*
*/
protected void init() {
DataLogicAdmin dlAdmin = (DataLogicAdmin) app.getBean("com.unicenta.pos.admin.DataLogicAdmin");
tresources = dlAdmin.getTableResources();
jeditor = new ResourcesView(dirty);
}
/**
*
* @return
*/
@Override
public boolean deactivate() {
if (super.deactivate()) {
DataLogicSystem dlSystem = (DataLogicSystem) app.getBean("com.unicenta.pos.forms.DataLogicSystem");
dlSystem.resetResourcesCache();
return true;
} else {
return false;
}
}
/**
*
* @return
*/
public ListProvider getListProvider() {
return new ListProviderCreator(tresources);
}
/**
*
* @return
*/
public SaveProvider getSaveProvider() {
return new SaveProvider(tresources);
}
/**
*
* @return
*/
@Override
public Vectorer getVectorer() {
return tresources.getVectorerBasic(new int[] {1});
}
/**
*
* @return
*/
@Override
public ComparatorCreator getComparatorCreator() {
return tresources.getComparatorCreator(new int[] {1, 2});
}
/**
*
* @return
*/
@Override
public ListCellRenderer getListCellRenderer() {
return new ListCellRendererBasic(tresources.getRenderStringBasic(new int[] {1}));
}
/**
*
* @return
*/
public EditorRecord getEditor() {
return jeditor;
}
/**
*
* @return
*/
public String getTitle() {
return AppLocal.getIntString("Menu.Resources");
}
}
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="m_jGroupType">
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" alignment="0" pref="549" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jName" min="-2" pref="180" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jType" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="m_jBtnReadScript" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="m_jName" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="m_jType" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="m_jBtnReadScript" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel3" pref="328" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel3">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="m_jContainer">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
<CardConstraints cardName="text"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="m_jText">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
<CardConstraints cardName="null"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
</Container>
<Component class="com.unicenta.data.gui.JImageEditor" name="m_jImage">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
<CardConstraints cardName="image"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.resname" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="m_jName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="m_jType">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jTypeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="m_jBtnReadScript">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.readscript" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 30]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jBtnReadScriptActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,377 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ComboBoxValModel;
import com.unicenta.data.loader.ImageUtils;
import com.unicenta.data.user.DirtyManager;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.Base64Encoder;
import java.awt.CardLayout;
import java.awt.Component;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.UUID;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
/**
*
* @author adrianromero
*/
public final class ResourcesView extends JPanel implements EditorRecord {
private Object m_oId;
private ComboBoxValModel m_ResourceModel;
/** Creates new form ResourcesEditor
* @param dirty */
public ResourcesView(DirtyManager dirty) {
initComponents();
m_ResourceModel = new ComboBoxValModel();
m_ResourceModel.add(ResourceType.TEXT);
m_ResourceModel.add(ResourceType.IMAGE);
m_ResourceModel.add(ResourceType.BINARY);
m_jType.setModel(m_ResourceModel);
m_jName.getDocument().addDocumentListener(dirty);
m_jType.addActionListener(dirty);
m_jText.getDocument().addDocumentListener(dirty);
m_jImage.addPropertyChangeListener("image", dirty);
writeValueEOF();
}
/**
*
*/
@Override
public void writeValueEOF() {
m_oId = null;
m_jName.setText(null);
m_ResourceModel.setSelectedItem(null);
m_jText.setText(null);
m_jImage.setImage(null);
m_jName.setEnabled(false);
m_jType.setEnabled(false);
m_jText.setEnabled(false);
m_jImage.setEnabled(false);
m_jBtnReadScript.setEnabled(false);
}
/**
*
*/
@Override
public void writeValueInsert() {
m_oId = null;
m_jName.setText(null);
m_ResourceModel.setSelectedItem(ResourceType.TEXT);
m_jText.setText(null);
m_jImage.setImage(null);
m_jName.setEnabled(true);
m_jType.setEnabled(true);
m_jText.setEnabled(true);
m_jImage.setEnabled(true);
m_jBtnReadScript.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueDelete(Object value) {
Object[] resource = (Object[]) value;
m_oId = resource[0];
m_jName.setText((String) resource[1]);
m_ResourceModel.setSelectedKey(resource[2]);
ResourceType restype = (ResourceType) m_ResourceModel.getSelectedItem();
if (restype == ResourceType.TEXT) {
m_jText.setText(Formats.BYTEA.formatValue(resource[3]));
m_jText.setCaretPosition(0);
m_jImage.setImage(null);
} else if (restype == ResourceType.IMAGE) {
m_jText.setText(null);
m_jImage.setImage(ImageUtils.readImage((byte[]) resource[3]));
} else if (restype == ResourceType.BINARY) {
m_jText.setText(resource[3] == null
? null
: Base64Encoder.encodeChunked((byte[]) resource[3]));
m_jText.setCaretPosition(0);
m_jImage.setImage(null);
} else {
m_jText.setText(null);
m_jImage.setImage(null);
}
m_jName.setEnabled(false);
m_jType.setEnabled(false);
m_jText.setEnabled(false);
m_jImage.setEnabled(false);
m_jBtnReadScript.setEnabled(false);
}
/**
*
* @param value
*/
@Override
public void writeValueEdit(Object value) {
Object[] resource = (Object[]) value;
m_oId = resource[0];
m_jName.setText((String) resource[1]);
m_ResourceModel.setSelectedKey(resource[2]);
ResourceType restype = (ResourceType) m_ResourceModel.getSelectedItem();
if (restype == ResourceType.TEXT) {
m_jText.setText(Formats.BYTEA.formatValue(resource[3]));
m_jText.setCaretPosition(0);
m_jImage.setImage(null);
m_jBtnReadScript.setVisible(true);
} else if (restype == ResourceType.IMAGE) {
m_jText.setText(null);
m_jImage.setImage(ImageUtils.readImage((byte[]) resource[3]));
m_jBtnReadScript.setVisible(false);
} else if (restype == ResourceType.BINARY) {
m_jText.setText(resource[2] == null
? null
: Base64Encoder.encodeChunked((byte[]) resource[3]));
m_jText.setCaretPosition(0);
m_jImage.setImage(null);
m_jBtnReadScript.setVisible(true);
} else {
m_jText.setText(null);
m_jImage.setImage(null);
m_jBtnReadScript.setVisible(true);
}
m_jName.setEnabled(true);
m_jType.setEnabled(true);
m_jText.setEnabled(true);
m_jImage.setEnabled(true);
m_jBtnReadScript.setEnabled(true);
}
/**
*
* @return
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] resource = new Object[4];
resource[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
resource[1] = m_jName.getText();
ResourceType restype = (ResourceType) m_ResourceModel.getSelectedItem();
resource[2] = restype.getKey();
if (restype == ResourceType.TEXT) {
resource[3] = Formats.BYTEA.parseValue(m_jText.getText());
} else if (restype == ResourceType.IMAGE) {
resource[3] = ImageUtils.writeImage(m_jImage.getImage());
} else if (restype == ResourceType.BINARY) {
resource[3] = Base64Encoder.decode(m_jText.getText());
} else {
resource[3] = null;
}
return resource;
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
*/
@Override
public void refresh() {
}
private void showView(String view) {
CardLayout cl = (CardLayout)(m_jContainer.getLayout());
cl.show(m_jContainer, view);
}
public static String readFileAsString(String fileName) {
JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(null);
File f = chooser.getSelectedFile();
String filename = f.getAbsolutePath();
String data = "";
try {
data = new String(Files.readAllBytes(Paths.get(filename)));
} catch (IOException e) {
e.printStackTrace();
}
return data;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
m_jGroupType = new javax.swing.ButtonGroup();
jPanel3 = new javax.swing.JPanel();
m_jContainer = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
m_jText = new javax.swing.JTextArea();
jPanel1 = new javax.swing.JPanel();
m_jImage = new com.unicenta.data.gui.JImageEditor();
jLabel2 = new javax.swing.JLabel();
m_jName = new javax.swing.JTextField();
m_jType = new javax.swing.JComboBox();
m_jBtnReadScript = new javax.swing.JButton();
jPanel3.setLayout(new java.awt.BorderLayout());
m_jContainer.setLayout(new java.awt.CardLayout());
m_jText.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jScrollPane1.setViewportView(m_jText);
m_jContainer.add(jScrollPane1, "text");
m_jContainer.add(jPanel1, "null");
m_jContainer.add(m_jImage, "image");
jPanel3.add(m_jContainer, java.awt.BorderLayout.CENTER);
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel2.setText(AppLocal.getIntString("label.resname")); // NOI18N
jLabel2.setPreferredSize(new java.awt.Dimension(0, 30));
m_jName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jName.setPreferredSize(new java.awt.Dimension(0, 30));
m_jType.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jType.setPreferredSize(new java.awt.Dimension(150, 30));
m_jType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jTypeActionPerformed(evt);
}
});
m_jBtnReadScript.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
m_jBtnReadScript.setText(bundle.getString("button.readscript")); // NOI18N
m_jBtnReadScript.setPreferredSize(new java.awt.Dimension(80, 30));
m_jBtnReadScript.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jBtnReadScriptActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(m_jBtnReadScript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jBtnReadScript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void m_jTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jTypeActionPerformed
ResourceType restype = (ResourceType) m_ResourceModel.getSelectedItem();
if (restype == ResourceType.TEXT) {
showView("text");
m_jBtnReadScript.setVisible(true);
} else if (restype == ResourceType.IMAGE) {
showView("image");
m_jBtnReadScript.setVisible(false);
} else if (restype == ResourceType.BINARY) {
showView("text");
m_jBtnReadScript.setVisible(true);
} else {
showView("null");
m_jBtnReadScript.setVisible(true);
}
}//GEN-LAST:event_m_jTypeActionPerformed
private void m_jBtnReadScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnReadScriptActionPerformed
String filename="";
String data = readFileAsString(filename);
if (data != null) {
m_jText.setText(data);
}
}//GEN-LAST:event_m_jBtnReadScriptActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton m_jBtnReadScript;
private javax.swing.JPanel m_jContainer;
private javax.swing.ButtonGroup m_jGroupType;
private com.unicenta.data.gui.JImageEditor m_jImage;
private javax.swing.JTextField m_jName;
private javax.swing.JTextArea m_jText;
private javax.swing.JComboBox m_jType;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,80 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.DataRead;
/**
*
* @author adrianromero
* Created on 27 de febrero de 2007, 23:46
*
*/
public class RoleExtInfo extends RoleInfo {
/**
*
*/
protected byte[] m_aPermissions;
/** Creates a new instance of RoleExtInfo */
public RoleExtInfo() {
super();
m_aPermissions = null;
}
/**
*
* @param dr
* @throws BasicException
*/
@Override
public void readValues(DataRead dr) throws BasicException {
m_sName = dr.getString(1);
m_aPermissions = dr.getBytes(2);
}
// implements Vectorer, ComparatorCreator
/**
*
* @return
*/
public static String[] getHeaders() {
return new String[] {"Name"};
}
/**
*
* @return
*/
public String[] toStringArray() {
return new String[] {m_sName};
}
/**
*
* @return
*/
public Comparable[] toComparableArray() {
return new Comparable[] {m_sName};
}
}
@@ -0,0 +1,105 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.DataRead;
import com.unicenta.data.loader.IKeyed;
import com.unicenta.data.loader.SerializableRead;
/**
*
* @author adrianromero
* Created on 27 de febrero de 2007, 23:27
*
*/
public class RoleInfo implements SerializableRead, IKeyed {
private static final long serialVersionUID = 9110127845966L;
private String m_sID;
/**
*
*/
protected String m_sName;
/** Creates a new instance of RoleInfo */
public RoleInfo() {
m_sID = null;
m_sName = null;
}
/**
*
* @return
*/
@Override
public Object getKey() {
return m_sID;
}
/**
*
* @param dr
* @throws BasicException
*/
@Override
public void readValues(DataRead dr) throws BasicException {
m_sID = dr.getString(1);
m_sName = dr.getString(2);
}
/**
*
* @param sID
*/
public void setID(String sID) {
m_sID = sID;
}
/**
*
* @return
*/
public String getID() {
return m_sID;
}
/**
*
* @return
*/
public String getName() {
return m_sName;
}
/**
*
* @param sValue
*/
public void setName(String sValue) {
m_sName = sValue;
}
@Override
public String toString() {
return m_sName;
}
}
@@ -0,0 +1,121 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.data.gui.ListCellRendererBasic;
import com.unicenta.data.loader.ComparatorCreator;
import com.unicenta.data.loader.TableDefinition;
import com.unicenta.data.loader.Vectorer;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.data.user.SaveProvider;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.panels.JPanelTable;
import javax.swing.ListCellRenderer;
/**
*
* @author adrianromero
*/
public class RolesPanel extends JPanelTable {
private TableDefinition troles;
private TableDefinition trolesmenu;
private RolesView jeditor;
/** Creates a new instance of RolesPanel */
public RolesPanel() {
}
/**
*
*/
@Override
protected void init() {
DataLogicAdmin dlAdmin = (DataLogicAdmin) app.getBean("com.unicenta.pos.admin.DataLogicAdmin");
troles = dlAdmin.getTableRoles();
jeditor = new RolesView(dirty);
}
/**
*
* @return
*/
@Override
public ListProvider getListProvider() {
return new ListProviderCreator(troles);
}
/**
*
* @return
*/
@Override
public SaveProvider getSaveProvider() {
return new SaveProvider(troles);
}
/**
*
* @return
*/
@Override
public Vectorer getVectorer() {
return troles.getVectorerBasic(new int[] {1});
}
/**
*
* @return
*/
@Override
public ComparatorCreator getComparatorCreator() {
return troles.getComparatorCreator(new int[] {1});
}
/**
*
* @return
*/
@Override
public ListCellRenderer getListCellRenderer() {
return new ListCellRendererBasic(troles.getRenderStringBasic(new int[] {1}));
}
/**
*
* @return
*/
@Override
public EditorRecord getEditor() {
return jeditor;
}
/**
*
* @return
*/
@Override
public String getTitle() {
return AppLocal.getIntString("Menu.Roles");
}
}
@@ -0,0 +1,192 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.admin;
import com.unicenta.basic.BasicException;
import com.unicenta.data.user.DirtyManager;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.AppLocal;
import java.awt.Component;
import java.util.UUID;
/**
*
* @author adrianromero
*/
public final class RolesView extends javax.swing.JPanel implements EditorRecord {
private Object m_oId;
/** Creates new form RolesEditor
* @param dirty */
public RolesView(DirtyManager dirty) {
initComponents();
m_jName.getDocument().addDocumentListener(dirty);
m_jText.getDocument().addDocumentListener(dirty);
writeValueEOF();
}
/**
*
*/
@Override
public void writeValueEOF() {
m_oId = null;
m_jName.setText(null);
m_jText.setText(null);
m_jName.setEnabled(false);
m_jText.setEnabled(false);
}
/**
*
*/
@Override
public void writeValueInsert() {
m_oId = null;
m_jName.setText(null);
m_jText.setText(null);
m_jName.setEnabled(true);
m_jText.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueDelete(Object value) {
Object[] role = (Object[]) value;
m_oId = role[0];
m_jName.setText(Formats.STRING.formatValue(role[1]));
m_jText.setText(Formats.BYTEA.formatValue(role[2]));
m_jText.setCaretPosition(0);
m_jName.setEnabled(false);
m_jText.setEnabled(false);
}
/**
*
* @param value
*/
@Override
public void writeValueEdit(Object value) {
Object[] role = (Object[]) value;
m_oId = role[0];
m_jName.setText(Formats.STRING.formatValue(role[1]));
m_jText.setText(Formats.BYTEA.formatValue(role[2]));
m_jText.setCaretPosition(0);
m_jName.setEnabled(true);
m_jText.setEnabled(true);
}
/**
*
* @return
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] role = new Object[3];
role[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
role[1] = m_jName.getText();
role[2] = Formats.BYTEA.parseValue(m_jText.getText());
return role;
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
*/
@Override
public void refresh() {
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
m_jText = new javax.swing.JTextArea();
jLabel2 = new javax.swing.JLabel();
m_jName = new javax.swing.JTextField();
m_jText.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jScrollPane1.setViewportView(m_jText);
jLabel2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jLabel2.setText(AppLocal.getIntString("label.namem")); // NOI18N
m_jName.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField m_jName;
private javax.swing.JTextArea m_jText;
// End of variables declaration//GEN-END:variables
}