2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.ui
.popup
;
18 import com
.intellij
.openapi
.ui
.popup
.Balloon
;
19 import com
.intellij
.openapi
.ui
.popup
.BalloonBuilder
;
20 import com
.intellij
.ui
.BalloonImpl
;
21 import org
.jetbrains
.annotations
.NotNull
;
25 import java
.awt
.event
.ActionListener
;
27 public class BalloonPopupBuilderImpl
implements BalloonBuilder
{
30 Color myBorder
= Color
.gray
;
31 Color myFill
= new Color(186, 238, 186, 230);
32 boolean myHideOnMouseOutside
= true;
33 boolean myHideOnKeyOutside
= true;
34 long myFadeoutTime
= -1;
36 private Balloon
.Position myPrefferedPosition
= Balloon
.Position
.below
;
38 boolean myShowCalllout
= true;
39 private boolean myCloseButtonEnabled
;
40 private boolean myHideOnFrameResize
= true;
42 private ActionListener myClickHandler
;
43 private boolean myCloseOnClick
;
45 public BalloonPopupBuilderImpl(@NotNull final JComponent content
) {
50 public BalloonBuilder
setPreferredPosition(final Balloon
.Position position
) {
51 myPrefferedPosition
= position
;
56 public BalloonBuilder
setBorderColor(@NotNull final Color color
) {
62 public BalloonBuilder
setFillColor(@NotNull final Color color
) {
68 public BalloonBuilder
setHideOnClickOutside(final boolean hide
) {
69 myHideOnMouseOutside
= hide
;
74 public BalloonBuilder
setHideOnKeyOutside(final boolean hide
) {
75 myHideOnKeyOutside
= hide
;
80 public BalloonBuilder
setShowCallout(final boolean show
) {
81 myShowCalllout
= show
;
86 public BalloonBuilder
setFadeoutTime(long fadeoutTime
) {
87 myFadeoutTime
= fadeoutTime
;
92 public BalloonBuilder
setHideOnFrameResize(boolean hide
) {
93 myHideOnFrameResize
= hide
;
98 public Balloon
createBalloon() {
99 return new BalloonImpl(myContent
, myBorder
, myFill
, myHideOnMouseOutside
, myHideOnKeyOutside
, myShowCalllout
, myCloseButtonEnabled
, myFadeoutTime
, myHideOnFrameResize
, myClickHandler
, myCloseOnClick
);
103 public BalloonBuilder
setCloseButtonEnabled(boolean enabled
) {
104 myCloseButtonEnabled
= enabled
;
109 public BalloonBuilder
setClickHandler(ActionListener listener
, boolean closeOnClick
) {
110 myClickHandler
= listener
;
111 myCloseOnClick
= closeOnClick
;