no message

This commit is contained in:
2024-10-09 22:21:57 +03:00
parent 54c80c516b
commit 6252af944e
699 changed files with 2634 additions and 1997 deletions

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.Repository.Subscribes.UI.SubscriberFields">
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="81c98" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="имя"/>
</properties>
</component>
<vspacer id="8f1c6">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="4c488" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="адрес"/>
</properties>
</component>
<component id="675ad" class="javax.swing.JTextField" binding="tfName" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a96c1" class="javax.swing.JTextField" binding="tfAddress" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="1c24b" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="роль"/>
</properties>
</component>
<component id="81d94" class="javax.swing.JComboBox" binding="cbRole" custom-create="true">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="fe07e" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="рассылка"/>
</properties>
</component>
<component id="e0879" class="javax.swing.JCheckBox" binding="cbMail">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<horizontalAlignment value="0"/>
<icon value="icons/NotPick.png"/>
<selectedIcon value="icons/Pick.png"/>
<text value=""/>
<toolTipText value="Будет ли включена рассылка для этого пользователя"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@@ -0,0 +1,27 @@
package _VisualDVM.Repository.Subscribes.UI;
import Common.Visual.TextField.StyledTextField;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.GlobalData.Account.AccountRole;
import javax.swing.*;
import java.awt.*;
public class SubscriberFields implements DialogFields {
private JPanel content;
public JTextField tfName;
public JTextField tfAddress;
public JComboBox<AccountRole> cbRole;
public JCheckBox cbMail;
@Override
public Component getContent() {
return content;
}
private void createUIComponents() {
// TODO: place custom component creation code here
tfName = new StyledTextField();
tfAddress = new StyledTextField();
cbRole = new JComboBox<>();
cbRole.addItem(AccountRole.User);
cbRole.addItem(AccountRole.Developer);
cbRole.addItem(AccountRole.Admin);
}
}

View File

@@ -0,0 +1,53 @@
package _VisualDVM.Repository.Subscribes.UI;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import _VisualDVM.Global;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.GlobalData.Account.AccountRole;
import _VisualDVM.Repository.Subscribes.Subscriber;
public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields> {
public SubscriberForm() {
super(SubscriberFields.class);
}
@Override
public int getDefaultHeight() {
return 250;
}
@Override
public int getDefaultWidth() {
return 450;
}
@Override
public void validateFields() {
if (fields.tfName.getText().isEmpty())
Log.Writeln("Имя учётной записи не может быть пустым");
CommonUtils.validateEmail(fields.tfAddress.getText(), Log);
if (fields.tfAddress.getText().isEmpty())
Log.Writeln_("Адрес электронной почты не может быть пустым");
if (!title_text.equals("Регистрация") && (fields.tfAddress.isEditable() && Global.componentsServer.db.subscribers.Data.containsKey(fields.tfAddress.getText()))) {
Log.Writeln_("Адрес электронной почты " + CommonUtils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
}
}
@Override
public void fillFields() {
fields.tfName.setText(Result.name);
fields.tfAddress.setText(Result.address);
fields.cbMail.setSelected(Result.mailOn!=0);
CommonUI.TrySelect(fields.cbRole, Result.role);
}
@Override
public void SetEditLimits() {
fields.tfAddress.setEditable(false);
}
private AccountRole getSelectedRole() {
return (AccountRole) fields.cbRole.getSelectedItem();
}
@Override
public void ProcessResult() {
Result.name = fields.tfName.getText();
Result.address = fields.tfAddress.getText();
Result.mailOn = fields.cbMail.isSelected()?1:0;
Result.role = getSelectedRole();
}
};