The document discusses creating an infinite scrolling list of contacts in Codename One. It shows how to:
1. Define an InfiniteContainer class that fetches contact data in batches from the device's contacts.
2. Populate each list item with a MultiButton displaying the contact name and placeholder image.
3. Asynchronously load the actual contact image on idle to display in the button.
4. Add a search toolbar that filters the contact list as the user types.
How do I - Create a List of Items - Transcript.pdfShaiAlmog1
The document discusses how to create lists in Codename One using a BoxLayout rather than the built-in List class. It recommends using a BoxLayout with the Y axis and adding components, or an InfiniteContainer for larger data sets. Sample code is provided to create a basic list and an contacts list pulling from the device contacts. Key aspects covered include setting the container to scroll, checking array bounds, and loading images asynchronously.
The document discusses creating an infinite scrolling list of contacts in Codename One. It shows how to:
1. Define an InfiniteContainer class that fetches contact data in batches from the device's contacts.
2. Populate each list item with a MultiButton displaying the contact name and placeholder image.
3. Asynchronously load the actual contact image on idle to display in the button.
4. Add a search toolbar that filters the contact list as the user types.
How do I - Create a List of Items - Transcript.pdfShaiAlmog1
The document discusses how to create lists in Codename One using a BoxLayout rather than the built-in List class. It recommends using a BoxLayout with the Y axis and adding components, or an InfiniteContainer for larger data sets. Sample code is provided to create a basic list and an contacts list pulling from the device contacts. Key aspects covered include setting the container to scroll, checking array bounds, and loading images asynchronously.
Creating a Facebook Clone - Part XLIII.pdfShaiAlmog1
The document discusses code for creating a Facebook clone mobile application. It defines a MainForm class that initializes the main UI with tabs for the newsfeed, friends, notifications, and more. It also defines methods for refreshing, taking photos with the camera, and uploading contacts. A CameraForm class is defined to display the camera view and handle capturing and sharing photos.
Creating a Facebook Clone - Part VII.pdfShaiAlmog1
The document discusses code for creating a signup form for a mobile app. It includes code to create fields for a user's name, birthday, and gender. Styles are defined for gender radio buttons. The code collects the user's input and navigates between forms as each field is completed.
please code in c#- please note that im a complete beginner- northwind.docxAustinaGRPaigey
please code in c#.
please note that im a complete beginner.
northwind.mdf.
northwind_log.ldf
OrderDetailsMaintenance.zip
1. Include the two above files in the root of your OrderDetailsMaintenance project.
2. Make sure to mark them as "Content" and "Copy Always" or "Copy if newer" in the properties window of those two files.
3. Run the Scaffold-DbContext command to create a context class as well as a class to encapsulate the Orders objects from the associated table in the mdf file. Make sure to include the parameters for -Tables Customers (only worry about the attributes associated with the text boxes, you don't need to worry about any other rows from the table)
4. Once you have ran the command, include an app.config file and add a connection string element. Make sure to copy the connection string from your Context class to your app.config. Then edit your context to grab the connection string from the app.config (ConfigurationManager.ConnectionString["Northwind"].ConnectionString)
5. Code the Find button to Find the customer id and populate the details in the below text boxes.
1. If no order is found, display a message box.
6. Code the exit button
7. Code the Save button to update its attributes and call Update and SaveChanges() on that particular entity.
1. Note: If you close the program, reopen it, and search for the entity you recently updated. You may not see the changes depending on how you setup the mdf file in your project (because it copies a new version to the bin directory each time you run the program). So, if you don't see your changes, don't be alarmed.
============
HERE IS WHAT I HAVE SO FAR
frmCustomerMaintenance.cs
namespace OrderDetailsMaintenance
{
public partial class frmCustomerMaintenance : Form
{
public frmCustomerMaintenance()
{
InitializeComponent();
}
}
}
frmCustomerMaintenance.resx
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name".
New client side features - Microsoft Dynamics CRM 2016Naveen Kumar
The document discusses new client side features in Microsoft Dynamics CRM 2016, including a new getValue method and keypress event methods (addOnKeyPress, removeOnKeyPress, fireOnKeyPress). The getValue method allows retrieving a field value as the user enters data. The keypress methods allow attaching, detaching, and firing functions on the keypress event. An example shows using these to format a telephone number field, removing invalid characters on keypress.
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
Creating a Facebook Clone - Part XLIII.pdfShaiAlmog1
The document discusses code for creating a Facebook clone mobile application. It defines a MainForm class that initializes the main UI with tabs for the newsfeed, friends, notifications, and more. It also defines methods for refreshing, taking photos with the camera, and uploading contacts. A CameraForm class is defined to display the camera view and handle capturing and sharing photos.
Creating a Facebook Clone - Part VII.pdfShaiAlmog1
The document discusses code for creating a signup form for a mobile app. It includes code to create fields for a user's name, birthday, and gender. Styles are defined for gender radio buttons. The code collects the user's input and navigates between forms as each field is completed.
please code in c#- please note that im a complete beginner- northwind.docxAustinaGRPaigey
please code in c#.
please note that im a complete beginner.
northwind.mdf.
northwind_log.ldf
OrderDetailsMaintenance.zip
1. Include the two above files in the root of your OrderDetailsMaintenance project.
2. Make sure to mark them as "Content" and "Copy Always" or "Copy if newer" in the properties window of those two files.
3. Run the Scaffold-DbContext command to create a context class as well as a class to encapsulate the Orders objects from the associated table in the mdf file. Make sure to include the parameters for -Tables Customers (only worry about the attributes associated with the text boxes, you don't need to worry about any other rows from the table)
4. Once you have ran the command, include an app.config file and add a connection string element. Make sure to copy the connection string from your Context class to your app.config. Then edit your context to grab the connection string from the app.config (ConfigurationManager.ConnectionString["Northwind"].ConnectionString)
5. Code the Find button to Find the customer id and populate the details in the below text boxes.
1. If no order is found, display a message box.
6. Code the exit button
7. Code the Save button to update its attributes and call Update and SaveChanges() on that particular entity.
1. Note: If you close the program, reopen it, and search for the entity you recently updated. You may not see the changes depending on how you setup the mdf file in your project (because it copies a new version to the bin directory each time you run the program). So, if you don't see your changes, don't be alarmed.
============
HERE IS WHAT I HAVE SO FAR
frmCustomerMaintenance.cs
namespace OrderDetailsMaintenance
{
public partial class frmCustomerMaintenance : Form
{
public frmCustomerMaintenance()
{
InitializeComponent();
}
}
}
frmCustomerMaintenance.resx
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name".
New client side features - Microsoft Dynamics CRM 2016Naveen Kumar
The document discusses new client side features in Microsoft Dynamics CRM 2016, including a new getValue method and keypress event methods (addOnKeyPress, removeOnKeyPress, fireOnKeyPress). The getValue method allows retrieving a field value as the user enters data. The keypress methods allow attaching, detaching, and firing functions on the keypress event. An example shows using these to format a telephone number field, removing invalid characters on keypress.
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
The document describes code for implementing the server-side functionality of a WhatsApp clone. It includes classes for representing users, messages, and server connections. The Server class initializes user and message data from files, handles login/signup, and establishes a websocket connection for real-time messaging. It can send and receive messages when connected, or queue messages when offline.
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
GraphRAG for Life Science to increase LLM accuracyTomaz Bratanic
GraphRAG for life science domain, where you retriever information from biomedical knowledge graphs using LLMs to increase the accuracy and performance of generated answers
Main news related to the CCS TSI 2023 (2023/1695)Jakub Marek
An English 🇬🇧 translation of a presentation to the speech I gave about the main changes brought by CCS TSI 2023 at the biggest Czech conference on Communications and signalling systems on Railways, which was held in Clarion Hotel Olomouc from 7th to 9th November 2023 (konferenceszt.cz). Attended by around 500 participants and 200 on-line followers.
The original Czech 🇨🇿 version of the presentation can be found here: https://www.slideshare.net/slideshow/hlavni-novinky-souvisejici-s-ccs-tsi-2023-2023-1695/269688092 .
The videorecording (in Czech) from the presentation is available here: https://youtu.be/WzjJWm4IyPk?si=SImb06tuXGb30BEH .
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
Your One-Stop Shop for Python Success: Top 10 US Python Development Providersakankshawande
Simplify your search for a reliable Python development partner! This list presents the top 10 trusted US providers offering comprehensive Python development services, ensuring your project's success from conception to completion.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
Webinar: Designing a schema for a Data WarehouseFederico Razzoli
Are you new to data warehouses (DWH)? Do you need to check whether your data warehouse follows the best practices for a good design? In both cases, this webinar is for you.
A data warehouse is a central relational database that contains all measurements about a business or an organisation. This data comes from a variety of heterogeneous data sources, which includes databases of any type that back the applications used by the company, data files exported by some applications, or APIs provided by internal or external services.
But designing a data warehouse correctly is a hard task, which requires gathering information about the business processes that need to be analysed in the first place. These processes must be translated into so-called star schemas, which means, denormalised databases where each table represents a dimension or facts.
We will discuss these topics:
- How to gather information about a business;
- Understanding dictionaries and how to identify business entities;
- Dimensions and facts;
- Setting a table granularity;
- Types of facts;
- Types of dimensions;
- Snowflakes and how to avoid them;
- Expanding existing dimensions and facts.
Creating a Whatsapp Clone - Part X - Transcript.pdf
1. Creating a WhatsApp Clone - Part X
The final part discussing the client side code covers the NewMessageForm class
2. public class NewMessageForm extends Form {
public NewMessageForm() {
super("Select Contact", BoxLayout.y());
Form current = getCurrentForm();
getToolbar().setBackCommand("", e -> current.showBack());
MultiButton newGroup = new MultiButton("New group");
MultiButton newContact = new MultiButton("New contact");
FontImage.setMaterialIcon(newGroup,
FontImage.MATERIAL_GROUP_ADD, 3.5f);
FontImage.setMaterialIcon(newContact,
FontImage.MATERIAL_PERSON_ADD, 3.5f);
add(newGroup);
add(newContact);
Server.fetchContacts(lst -> {
for(ChatContact c : lst) {
MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
NewMessageForm
NewMessageForm is a form we see when we press the floating action button in the main form
3. public class NewMessageForm extends Form {
public NewMessageForm() {
super("Select Contact", BoxLayout.y());
Form current = getCurrentForm();
getToolbar().setBackCommand("", e -> current.showBack());
MultiButton newGroup = new MultiButton("New group");
MultiButton newContact = new MultiButton("New contact");
FontImage.setMaterialIcon(newGroup,
FontImage.MATERIAL_GROUP_ADD, 3.5f);
FontImage.setMaterialIcon(newContact,
FontImage.MATERIAL_PERSON_ADD, 3.5f);
add(newGroup);
add(newContact);
Server.fetchContacts(lst -> {
for(ChatContact c : lst) {
MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
NewMessageForm
This class is trivial by comparison to the previous class. It’s just a box layout Y form that lets us pick the contact we wish to chat with
4. public NewMessageForm() {
super("Select Contact", BoxLayout.y());
Form current = getCurrentForm();
getToolbar().setBackCommand("", e -> current.showBack());
MultiButton newGroup = new MultiButton("New group");
MultiButton newContact = new MultiButton("New contact");
FontImage.setMaterialIcon(newGroup,
FontImage.MATERIAL_GROUP_ADD, 3.5f);
FontImage.setMaterialIcon(newContact,
FontImage.MATERIAL_PERSON_ADD, 3.5f);
add(newGroup);
add(newContact);
Server.fetchContacts(lst -> {
for(ChatContact c : lst) {
MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
NewMessageForm
The new group and contact buttons aren’t currently mapped to anything. They are just simple buttons.
5. FontImage.MATERIAL_GROUP_ADD, 3.5f);
FontImage.setMaterialIcon(newContact,
FontImage.MATERIAL_PERSON_ADD, 3.5f);
add(newGroup);
add(newContact);
Server.fetchContacts(lst -> {
for(ChatContact c : lst) {
MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
NewMessageForm
We use the fetch contacts method to fetch the list of contacts to show here
6. add(newGroup);
add(newContact);
Server.fetchContacts(lst -> {
for(ChatContact c : lst) {
MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
NewMessageForm
For every contact in the list of contacts we create a multi button matching the name and icon.
7. MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
return;
}
new ChatForm(c, current).show();
});
add(mb);
NewMessageForm
If a contact is clicked we check if he has an ID. If not this is someone that might not be in the app yet. So we need to contact the server and check.
8. MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
return;
}
new ChatForm(c, current).show();
});
add(mb);
NewMessageForm
findRegisteredUser finds the specific user based on his phone number
9. MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
return;
}
new ChatForm(c, current).show();
});
add(mb);
NewMessageForm
If we get null as a result it means there is no such registered user in the app. We go back to the previous form and show a toastbar message there
10. MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
return;
}
new ChatForm(c, current).show();
});
add(mb);
NewMessageForm
If there is we update the user id and save
11. MultiButton mb = new MultiButton(c.name.get());
mb.setTextLine2(c.tagline.get());
mb.setIcon(c.getSmallIcon());
c.photo.addChangeListener(p ->
mb.setIcon(c.getSmallIcon()));
mb.addActionListener(e -> {
if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
return;
}
new ChatForm(c, current).show();
});
add(mb);
NewMessageForm
We can then launch the chat form with this new contact
12. if(c.id.get() == null) {
Server.findRegisteredUser(
c.phone.get(), contact -> {
if(contact == null) {
current.showBack();
callSerially(() ->
ToastBar.showErrorMessage(
"Contact isn't registered"));
return;
}
c.id.set(contact.id.get());
Server.saveContacts();
});
return;
}
new ChatForm(c, current).show();
});
add(mb);
}
revalidate();
});
}
}
NewMessageForm
Since all the multibuttons are added asynchronously we need to revalidate so they will show on the form. As I said this is a super simple short class and with that we
finished the client side work…