|
/******************************************************************************
Copyright (C) 2006 MakeLogic
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Date : 14th December 2005
Authors : MakeLogic
Design : Ujjwal
Developer : Dharma
********************************************************************************/
package com.makeLogic.utils;
import com.makeLogic.Tail;
import com.makeLogic.TailMDI;
import com.makeLogic.TailInternalFrame;
import com.makeLogic.FileDetailsInternalFrame;
import java.awt.*;
import java.io.PrintStream;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.border.EmptyBorder;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* Summary description for FindDialog.
*/
public class FindDialog extends JDialog
{
int height;
int width;
FindDialogCenterComp findDialogCenterComp;
FindDialogEastComp findDialogEastComp;
//..TailMDI Obj
TailMDI tailMDI;
public FindDialog(TailMDI tailMDI)
{
//..Call the super class
super(tailMDI);
try
{
Trace.enter("FindDialog.FindDialog");
this.tailMDI = tailMDI;
setTitle("Find - MakeLogic Tail");
getContentPane().setLayout(new BorderLayout());
setModal(false);
this.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
Trace.enter("WindowAdapter.windowClosing");
TailMDI.findDialogOpened = false;
Trace.exit("WindowAdapter.windowClosing");
}
}
);
//..Verify if the selected frame is FileDetailsInternalFrame
TailInternalFrame internalFrame = null;
try
{
internalFrame = (TailInternalFrame)getMDI().getDesktop().getSelectedFrame();
}
catch(ClassCastException cce)
{
JOptionPane.showMessageDialog(Tail.tailMDI, "Cannot search inside \"File Details\" table.\nSelect a \"Tail\" window and then click on search.", "MakeLogic - Tail", JOptionPane.INFORMATION_MESSAGE);
return;
}
//..When no internal frame is selected.
//..This happens when all the internal frames are minimized
if(internalFrame == null)
{
Trace.message("No internal frame is selected");
JOptionPane.showMessageDialog(Tail.tailMDI, "Cannot perform search.\nNo Tail window is active.", "MakeLogic - Tail", JOptionPane.INFORMATION_MESSAGE);
Trace.exit("FindDialog.FindDialog");
return;
}
//..Set the text in Text box to the highlighted text in textarea.
String selectedFrameText = internalFrame.getHighlightedText();
findDialogCenterComp = new FindDialogCenterComp(selectedFrameText);
getContentPane().add(findDialogCenterComp, "Center");
findDialogEastComp = new FindDialogEastComp(this,findDialogCenterComp);
getContentPane().add(findDialogEastComp, "East");
//..Flag: Set the dialog as opened
TailMDI.findDialogOpened = true;
height = 140;
width = 360;
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((dimension.width - width) / 2, (dimension.height - height) / 2);
setSize(width, height);
setResizable(false);
Trace.exit("FindDialog.FindDialog");
}
catch(Exception exp)
{
Trace.exception(exp);
}
}
//..return the tailMDI object
public TailMDI getMDI()
{
Trace.enter("FindDialog.getMDI");
Trace.exit("FindDialog.getMDI");
return tailMDI;
}
//..Get the searchText
public String getSearchText(){
Trace.enter("FindDialog.getSearchText");
Trace.exit("FindDialog.getSearchText");
return findDialogCenterComp.getSearchText();
}
//..Set the searchText
public void setSearchText(String text){
Trace.enter("FindDialog.setSearchText "+text);
findDialogCenterComp.setSearchText(text);
Trace.exit("FindDialog.setSearchText "+text);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Founder of MakeLogic - A Mobile Solutions and XML Web Services Company. B-Tech engineer from India's reputed IITs.
Designed and Authored products like MicroGraphs, MakeLogic VersionManager and MakeLogic Device Broker. Pls see http://www.makelogic.com
MakeLogic is a strategic business partner of Microsoft, Sun, IBM, HP and Citrix.
Contact : madanuuk@makelogic.com OR +91 - 40 - 55322433